2023-05-11 20:08:08 +00:00
|
|
|
package main
|
|
|
|
|
|
|
|
import (
|
|
|
|
"github.com/rs/zerolog/log"
|
|
|
|
|
|
|
|
"code.dumpstack.io/tools/out-of-tree/distro/debian"
|
|
|
|
)
|
|
|
|
|
|
|
|
type DebianCmd struct {
|
|
|
|
Cache DebianCacheCmd `cmd:"" help:"populate cache"`
|
|
|
|
}
|
|
|
|
|
|
|
|
type DebianCacheCmd struct {
|
2023-05-12 00:07:51 +00:00
|
|
|
Path string `help:"path to cache" default:"debian.cache"`
|
|
|
|
Refetch int `help:"days before refetch versions without deb package" default:"7"`
|
2023-05-11 20:08:08 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func (cmd *DebianCacheCmd) Run() (err error) {
|
|
|
|
c, err := debian.NewCache(cmd.Path)
|
|
|
|
if err != nil {
|
|
|
|
log.Error().Err(err).Msg("cache")
|
|
|
|
return
|
|
|
|
}
|
|
|
|
defer c.Close()
|
|
|
|
|
2023-05-12 15:00:50 +00:00
|
|
|
log.Info().Msg("Fetching kernels...")
|
|
|
|
|
|
|
|
_, err = debian.GetKernels(c, cmd.Refetch)
|
2023-05-11 20:08:08 +00:00
|
|
|
if err != nil {
|
2023-05-12 15:00:50 +00:00
|
|
|
log.Error().Err(err).Msg("")
|
2023-05-11 20:08:08 +00:00
|
|
|
return
|
|
|
|
}
|
|
|
|
|
2023-05-12 15:00:50 +00:00
|
|
|
log.Info().Msg("Success")
|
2023-05-11 20:08:08 +00:00
|
|
|
return
|
|
|
|
}
|