1
0

feat: generate all kernels if no distro is set

This commit is contained in:
dump_stack() 2023-05-25 06:36:02 +00:00
parent ad3a76320e
commit 10c5fb7ac4
Signed by: dump_stack
GPG Key ID: BE44DA8C062D87DC

View File

@ -269,8 +269,8 @@ func (cmd KernelAutogenCmd) Run(kernelCmd *KernelCmd, g *Globals) (err error) {
}
type KernelGenallCmd struct {
Distro string `required:"" help:"distribution"`
Ver string `required:"" help:"distro version"`
Distro string `help:"distribution"`
Ver string `help:"distro version"`
}
func (cmd *KernelGenallCmd) Run(kernelCmd *KernelCmd, g *Globals) (err error) {
@ -281,13 +281,24 @@ func (cmd *KernelGenallCmd) Run(kernelCmd *KernelCmd, g *Globals) (err error) {
kernel.SetSigintHandler(&kernelCmd.shutdown)
km := config.Target{
Distro: distro.Distro{ID: distroType, Release: cmd.Ver},
Kernel: config.Kernel{Regex: ".*"},
}
err = kernelCmd.Generate(g, km, math.MaxUint32)
if err != nil {
return
for _, dist := range distro.List() {
if distroType != distro.None && distroType != dist.ID {
continue
}
if cmd.Ver != "" && dist.Release != cmd.Ver {
continue
}
target := config.Target{
Distro: dist,
Kernel: config.Kernel{Regex: ".*"},
}
err = kernelCmd.Generate(g, target, math.MaxUint32)
if err != nil {
return
}
}
return kernelCmd.UpdateConfig()