1
0
out-of-tree/distro.go

39 lines
704 B
Go
Raw Normal View History

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 DistroCmd struct {
Debian DebianCmd `cmd:""`
}
2023-05-11 20:08:08 +00:00
type DebianCmd struct {
Cache DebianCacheCmd `cmd:"" help:"populate cache"`
}
type DebianCacheCmd struct {
Path string `help:"path to cache"`
2023-05-12 00:07:51 +00:00
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) {
if cmd.Path != "" {
debian.CachePath = cmd.Path
}
2023-05-14 12:37:45 +00:00
debian.RefetchDays = cmd.Refetch
2023-05-11 20:08:08 +00:00
2023-05-12 15:00:50 +00:00
log.Info().Msg("Fetching kernels...")
2023-05-14 12:37:45 +00:00
_, err = debian.GetKernels()
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
}