1
0

Make container update parameter available for all kernel commands

This commit is contained in:
dump_stack() 2023-05-10 08:09:53 +00:00
parent e8a7c043d6
commit 5aed593d81
Signed by: dump_stack
GPG Key ID: BE44DA8C062D87DC

View File

@ -32,6 +32,7 @@ type KernelCmd struct {
NoHeaders bool `help:"do not install kernel headers"` NoHeaders bool `help:"do not install kernel headers"`
Shuffle bool `help:"randomize kernels installation order"` Shuffle bool `help:"randomize kernels installation order"`
Retries int64 `help:"amount of tries for each kernel" default:"10"` Retries int64 `help:"amount of tries for each kernel" default:"10"`
Update bool `help:"update container"`
List KernelListCmd `cmd:"" help:"list kernels"` List KernelListCmd `cmd:"" help:"list kernels"`
ListRemote KernelListRemoteCmd `cmd:"" help:"list remote kernels"` ListRemote KernelListRemoteCmd `cmd:"" help:"list remote kernels"`
@ -63,10 +64,9 @@ func (cmd *KernelListCmd) Run(g *Globals) (err error) {
type KernelListRemoteCmd struct { type KernelListRemoteCmd struct {
Distro string `required:"" help:"distribution"` Distro string `required:"" help:"distribution"`
Ver string `required:"" help:"distro version"` Ver string `required:"" help:"distro version"`
Update bool `help:"update Containerfile"`
} }
func (cmd *KernelListRemoteCmd) Run(g *Globals) (err error) { func (cmd *KernelListRemoteCmd) Run(kernelCmd *KernelCmd, g *Globals) (err error) {
distroType, err := config.NewDistroType(cmd.Distro) distroType, err := config.NewDistroType(cmd.Distro)
if err != nil { if err != nil {
return return
@ -87,7 +87,7 @@ func (cmd *KernelListRemoteCmd) Run(g *Globals) (err error) {
g.Config.Docker.Registry, g.Config.Docker.Registry,
g.Config.Docker.Commands, g.Config.Docker.Commands,
km, km,
cmd.Update, kernelCmd.Update,
) )
if err != nil { if err != nil {
return return
@ -129,6 +129,7 @@ func (cmd KernelAutogenCmd) Run(kernelCmd *KernelCmd, g *Globals) (err error) {
kernelCmd.Force, kernelCmd.Force,
!kernelCmd.NoHeaders, !kernelCmd.NoHeaders,
kernelCmd.Shuffle, kernelCmd.Shuffle,
kernelCmd.Update,
&shutdown, &shutdown,
) )
if err != nil { if err != nil {
@ -169,6 +170,7 @@ func (cmd *KernelGenallCmd) Run(kernelCmd *KernelCmd, g *Globals) (err error) {
kernelCmd.Force, kernelCmd.Force,
!kernelCmd.NoHeaders, !kernelCmd.NoHeaders,
kernelCmd.Shuffle, kernelCmd.Shuffle,
kernelCmd.Update,
&shutdown, &shutdown,
) )
if err != nil { if err != nil {
@ -206,6 +208,7 @@ func (cmd *KernelInstallCmd) Run(kernelCmd *KernelCmd, g *Globals) (err error) {
kernelCmd.Force, kernelCmd.Force,
!kernelCmd.NoHeaders, !kernelCmd.NoHeaders,
kernelCmd.Shuffle, kernelCmd.Shuffle,
kernelCmd.Update,
&shutdown, &shutdown,
) )
if err != nil { if err != nil {
@ -811,9 +814,11 @@ func setSigintHandler(variable *bool) {
} }
// FIXME too many parameters
func generateKernels(km config.KernelMask, registry string, func generateKernels(km config.KernelMask, registry string,
commands []config.DockerCommand, max, retries int64, commands []config.DockerCommand, max, retries int64,
download, force, headers, shuffle bool, shutdown *bool) (err error) { download, force, headers, shuffle, update bool,
shutdown *bool) (err error) {
log.Info().Msgf("Generating for kernel mask %v", km) log.Info().Msgf("Generating for kernel mask %v", km)
@ -823,7 +828,7 @@ func generateKernels(km config.KernelMask, registry string,
return return
} }
err = generateBaseDockerImage(registry, commands, km, false) err = generateBaseDockerImage(registry, commands, km, update)
if err != nil || *shutdown { if err != nil || *shutdown {
return return
} }