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