2023-03-22 17:45:56 +00:00
|
|
|
// Copyright 2023 Mikhail Klementev. All rights reserved.
|
2018-11-17 20:24:09 +00:00
|
|
|
// Use of this source code is governed by a AGPLv3 license
|
|
|
|
// (or later) that can be found in the LICENSE file.
|
|
|
|
|
2024-02-17 22:38:43 +00:00
|
|
|
package cmd
|
2018-11-17 20:24:09 +00:00
|
|
|
|
|
|
|
import (
|
|
|
|
"errors"
|
|
|
|
"fmt"
|
2023-05-23 22:00:20 +00:00
|
|
|
"os"
|
2023-05-24 16:29:52 +00:00
|
|
|
"strings"
|
2023-05-23 21:21:06 +00:00
|
|
|
"time"
|
2023-05-13 10:47:47 +00:00
|
|
|
|
2023-05-23 22:00:20 +00:00
|
|
|
"github.com/naoina/toml"
|
2023-05-23 21:21:06 +00:00
|
|
|
"github.com/remeh/sizedwaitgroup"
|
2023-03-18 21:30:07 +00:00
|
|
|
"github.com/rs/zerolog/log"
|
2019-08-16 05:05:26 +00:00
|
|
|
|
2024-02-20 13:25:31 +00:00
|
|
|
"code.dumpstack.io/tools/out-of-tree/artifact"
|
2024-02-21 14:55:04 +00:00
|
|
|
"code.dumpstack.io/tools/out-of-tree/cache"
|
2019-08-16 05:05:26 +00:00
|
|
|
"code.dumpstack.io/tools/out-of-tree/config"
|
2024-02-20 13:25:31 +00:00
|
|
|
"code.dumpstack.io/tools/out-of-tree/config/dotfiles"
|
2023-05-13 10:14:45 +00:00
|
|
|
"code.dumpstack.io/tools/out-of-tree/container"
|
2023-05-18 16:07:24 +00:00
|
|
|
"code.dumpstack.io/tools/out-of-tree/distro"
|
2023-05-13 10:47:47 +00:00
|
|
|
"code.dumpstack.io/tools/out-of-tree/kernel"
|
2018-11-17 20:24:09 +00:00
|
|
|
)
|
|
|
|
|
2023-01-31 07:13:33 +00:00
|
|
|
type KernelCmd struct {
|
2024-02-21 14:55:04 +00:00
|
|
|
NoDownload bool `help:"do not download qemu image while kernel generation"`
|
|
|
|
UseHost bool `help:"also use host kernels"`
|
|
|
|
Force bool `help:"force reinstall kernel"`
|
|
|
|
NoHeaders bool `help:"do not install kernel headers"`
|
|
|
|
Shuffle bool `help:"randomize kernels installation order"`
|
|
|
|
Retries int `help:"amount of tries for each kernel" default:"2"`
|
|
|
|
Threads int `help:"threads for parallel installation" default:"1"`
|
|
|
|
Update bool `help:"update container"`
|
|
|
|
ContainerCache bool `help:"try prebuilt container images first" default:"true" negatable:""`
|
|
|
|
Max int `help:"maximum kernels to download" default:"100500"`
|
|
|
|
NoPrune bool `help:"do not remove dangling or unused images from local storage after build"`
|
|
|
|
NoCfgRegen bool `help:"do not update kernels.toml"`
|
2023-01-31 07:13:33 +00:00
|
|
|
|
2023-05-26 17:01:53 +00:00
|
|
|
ContainerTimeout time.Duration `help:"container timeout"`
|
|
|
|
|
2023-03-24 04:20:28 +00:00
|
|
|
List KernelListCmd `cmd:"" help:"list kernels"`
|
2023-05-10 07:52:44 +00:00
|
|
|
ListRemote KernelListRemoteCmd `cmd:"" help:"list remote kernels"`
|
2023-03-24 04:20:28 +00:00
|
|
|
Autogen KernelAutogenCmd `cmd:"" help:"generate kernels based on the current config"`
|
|
|
|
Genall KernelGenallCmd `cmd:"" help:"generate all kernels for distro"`
|
|
|
|
Install KernelInstallCmd `cmd:"" help:"install specific kernel"`
|
|
|
|
ConfigRegen KernelConfigRegenCmd `cmd:"" help:"regenerate config"`
|
2023-05-24 16:13:12 +00:00
|
|
|
|
|
|
|
shutdown bool
|
2023-05-24 16:29:52 +00:00
|
|
|
kcfg config.KernelConfig
|
2023-05-26 15:33:54 +00:00
|
|
|
|
|
|
|
stats struct {
|
|
|
|
overall int
|
|
|
|
success int
|
|
|
|
}
|
2023-01-31 07:13:33 +00:00
|
|
|
}
|
|
|
|
|
2023-05-23 22:00:20 +00:00
|
|
|
func (cmd KernelCmd) UpdateConfig() (err error) {
|
2023-05-26 15:33:54 +00:00
|
|
|
if cmd.stats.success != cmd.stats.overall {
|
|
|
|
log.Warn().Msgf("%d kernels failed to install",
|
|
|
|
cmd.stats.overall-cmd.stats.success)
|
|
|
|
}
|
|
|
|
|
2024-02-21 09:28:49 +00:00
|
|
|
if cmd.NoCfgRegen {
|
|
|
|
log.Info().Msgf("kernels.toml is not updated")
|
2024-02-21 09:34:28 +00:00
|
|
|
return
|
2024-02-21 09:28:49 +00:00
|
|
|
}
|
|
|
|
|
2023-05-26 15:33:54 +00:00
|
|
|
log.Info().Msgf("updating kernels.toml")
|
2023-05-23 22:00:20 +00:00
|
|
|
kcfg := config.KernelConfig{}
|
|
|
|
|
|
|
|
if cmd.UseHost {
|
|
|
|
// Get host kernels
|
|
|
|
kcfg.Kernels, err = kernel.GenHostKernels(!cmd.NoDownload)
|
|
|
|
if err != nil {
|
|
|
|
return
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
for _, dist := range distro.List() {
|
|
|
|
var kernels []distro.KernelInfo
|
|
|
|
kernels, err = dist.Kernels()
|
|
|
|
if err != nil {
|
|
|
|
return
|
|
|
|
}
|
|
|
|
|
|
|
|
kcfg.Kernels = append(kcfg.Kernels, kernels...)
|
|
|
|
}
|
|
|
|
|
|
|
|
buf, err := toml.Marshal(&kcfg)
|
|
|
|
if err != nil {
|
|
|
|
return
|
|
|
|
}
|
|
|
|
|
2024-02-20 13:25:31 +00:00
|
|
|
err = os.WriteFile(dotfiles.File("kernels.toml"), buf, os.ModePerm)
|
2023-05-23 22:00:20 +00:00
|
|
|
if err != nil {
|
|
|
|
return
|
|
|
|
}
|
|
|
|
|
|
|
|
log.Info().Msgf("kernels.toml successfully updated")
|
|
|
|
return
|
|
|
|
}
|
|
|
|
|
2024-02-20 13:25:31 +00:00
|
|
|
func (cmd *KernelCmd) GenKernel(km artifact.Target, pkg string) {
|
2023-05-24 16:29:52 +00:00
|
|
|
flog := log.With().
|
|
|
|
Str("kernel", pkg).
|
|
|
|
Str("distro", km.Distro.String()).
|
|
|
|
Logger()
|
|
|
|
|
|
|
|
reinstall := false
|
|
|
|
for _, kinfo := range cmd.kcfg.Kernels {
|
2023-06-01 13:52:55 +00:00
|
|
|
if !km.Distro.Equal(kinfo.Distro) {
|
|
|
|
continue
|
|
|
|
}
|
|
|
|
|
2023-05-25 23:00:42 +00:00
|
|
|
var found bool
|
|
|
|
if kinfo.Distro.ID == distro.Debian { // FIXME
|
|
|
|
found = pkg == kinfo.Package
|
2023-06-20 16:01:38 +00:00
|
|
|
} else if kinfo.Distro.ID == distro.OpenSUSE {
|
|
|
|
found = strings.Contains(pkg, kinfo.KernelRelease)
|
2023-05-25 23:00:42 +00:00
|
|
|
} else {
|
|
|
|
found = strings.Contains(pkg, kinfo.KernelVersion)
|
|
|
|
}
|
|
|
|
|
|
|
|
if found {
|
2023-05-24 16:29:52 +00:00
|
|
|
if !cmd.Force {
|
|
|
|
flog.Info().Msg("already installed")
|
|
|
|
return
|
|
|
|
}
|
|
|
|
reinstall = true
|
|
|
|
break
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if reinstall {
|
|
|
|
flog.Info().Msg("reinstall")
|
|
|
|
} else {
|
|
|
|
flog.Info().Msg("install")
|
|
|
|
}
|
|
|
|
|
2023-05-26 16:21:01 +00:00
|
|
|
cmd.stats.overall += 1
|
|
|
|
|
2023-05-24 16:13:12 +00:00
|
|
|
var attempt int
|
|
|
|
for {
|
|
|
|
attempt++
|
|
|
|
|
|
|
|
if cmd.shutdown {
|
|
|
|
return
|
|
|
|
}
|
|
|
|
|
|
|
|
err := km.Distro.Install(pkg, !cmd.NoHeaders)
|
|
|
|
if err == nil {
|
2023-05-26 15:33:54 +00:00
|
|
|
cmd.stats.success += 1
|
2023-05-24 16:29:52 +00:00
|
|
|
flog.Info().Msg("success")
|
2023-05-24 16:13:12 +00:00
|
|
|
break
|
|
|
|
} else if attempt >= cmd.Retries {
|
2023-05-24 16:29:52 +00:00
|
|
|
flog.Error().Err(err).Msg("install kernel")
|
|
|
|
flog.Debug().Msg("skip")
|
2023-05-24 16:13:12 +00:00
|
|
|
break
|
|
|
|
} else {
|
2023-05-24 16:29:52 +00:00
|
|
|
flog.Warn().Err(err).Msg("install kernel")
|
2023-05-24 16:13:12 +00:00
|
|
|
time.Sleep(time.Second)
|
2023-05-24 16:29:52 +00:00
|
|
|
flog.Info().Msg("retry")
|
2023-05-24 16:13:12 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2024-02-20 13:25:31 +00:00
|
|
|
func (cmd *KernelCmd) Generate(g *Globals, km artifact.Target) (err error) {
|
2024-02-21 08:27:34 +00:00
|
|
|
defer func() {
|
|
|
|
if err != nil {
|
|
|
|
log.Warn().Err(err).Msg("")
|
|
|
|
} else {
|
|
|
|
log.Debug().Err(err).Msg("")
|
|
|
|
}
|
|
|
|
}()
|
|
|
|
|
2023-05-24 16:43:25 +00:00
|
|
|
if cmd.Update {
|
2023-05-29 09:09:30 +00:00
|
|
|
container.UseCache = false
|
2023-05-24 16:43:25 +00:00
|
|
|
}
|
2023-06-03 13:05:17 +00:00
|
|
|
if cmd.NoPrune {
|
|
|
|
container.Prune = false
|
|
|
|
}
|
2023-05-23 21:21:06 +00:00
|
|
|
|
2023-05-24 16:29:52 +00:00
|
|
|
cmd.kcfg, err = config.ReadKernelConfig(g.Config.Kernels)
|
|
|
|
if err != nil {
|
|
|
|
log.Debug().Err(err).Msg("read kernels config")
|
|
|
|
}
|
|
|
|
|
2023-05-23 21:21:06 +00:00
|
|
|
container.Commands = g.Config.Docker.Commands
|
|
|
|
container.Registry = g.Config.Docker.Registry
|
2023-05-26 17:01:53 +00:00
|
|
|
container.Timeout = g.Config.Docker.Timeout.Duration
|
|
|
|
if cmd.ContainerTimeout != 0 {
|
|
|
|
container.Timeout = cmd.ContainerTimeout
|
|
|
|
}
|
2023-05-23 21:21:06 +00:00
|
|
|
|
2023-05-24 16:29:52 +00:00
|
|
|
log.Info().Msgf("Generating for target %v", km)
|
2023-05-23 21:21:06 +00:00
|
|
|
|
2023-06-15 15:24:29 +00:00
|
|
|
_, err = kernel.GenRootfsImage(km.Distro.RootFS(), !cmd.NoDownload)
|
2023-05-24 16:13:12 +00:00
|
|
|
if err != nil || cmd.shutdown {
|
2023-05-23 21:21:06 +00:00
|
|
|
return
|
|
|
|
}
|
|
|
|
|
2024-02-21 14:55:04 +00:00
|
|
|
c, err := container.New(km.Distro)
|
|
|
|
if err != nil || cmd.shutdown {
|
|
|
|
return
|
|
|
|
}
|
|
|
|
|
2024-02-21 16:15:38 +00:00
|
|
|
if !c.Exist() && cmd.ContainerCache {
|
2024-02-21 14:55:04 +00:00
|
|
|
path := cache.ContainerURL(c.Name())
|
|
|
|
err = container.Import(path, c.Name())
|
2024-02-21 15:05:59 +00:00
|
|
|
if err != nil {
|
|
|
|
err = nil
|
|
|
|
} else {
|
|
|
|
log.Info().Msgf("container %s -> %s",
|
|
|
|
path, c.Name())
|
2024-02-21 14:55:04 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2023-05-23 21:21:06 +00:00
|
|
|
pkgs, err := kernel.MatchPackages(km)
|
2023-05-24 16:13:12 +00:00
|
|
|
if err != nil || cmd.shutdown {
|
2023-05-23 21:21:06 +00:00
|
|
|
return
|
|
|
|
}
|
|
|
|
|
|
|
|
if cmd.Shuffle {
|
|
|
|
pkgs = kernel.ShuffleStrings(pkgs)
|
|
|
|
}
|
|
|
|
|
|
|
|
swg := sizedwaitgroup.New(cmd.Threads)
|
|
|
|
|
|
|
|
for i, pkg := range pkgs {
|
2023-05-24 16:13:12 +00:00
|
|
|
if cmd.shutdown {
|
2023-05-23 21:21:06 +00:00
|
|
|
err = nil
|
|
|
|
return
|
|
|
|
}
|
|
|
|
|
|
|
|
swg.Add()
|
|
|
|
|
2023-05-25 23:01:42 +00:00
|
|
|
if cmd.shutdown {
|
|
|
|
err = nil
|
|
|
|
swg.Done()
|
|
|
|
return
|
|
|
|
}
|
|
|
|
|
2023-05-26 15:33:54 +00:00
|
|
|
if cmd.stats.success >= cmd.Max {
|
2023-05-23 21:21:06 +00:00
|
|
|
log.Print("Max is reached")
|
|
|
|
swg.Done()
|
|
|
|
break
|
|
|
|
}
|
|
|
|
|
|
|
|
log.Info().Msgf("%d/%d %s", i+1, len(pkgs), pkg)
|
|
|
|
|
|
|
|
go func(p string) {
|
|
|
|
defer swg.Done()
|
2023-05-26 15:33:54 +00:00
|
|
|
cmd.GenKernel(km, p)
|
2023-05-23 21:21:06 +00:00
|
|
|
}(pkg)
|
|
|
|
}
|
|
|
|
swg.Wait()
|
|
|
|
|
|
|
|
return
|
|
|
|
}
|
|
|
|
|
2023-01-31 07:13:33 +00:00
|
|
|
type KernelListCmd struct{}
|
|
|
|
|
|
|
|
func (cmd *KernelListCmd) Run(g *Globals) (err error) {
|
|
|
|
kcfg, err := config.ReadKernelConfig(g.Config.Kernels)
|
|
|
|
if err != nil {
|
2023-03-22 17:45:56 +00:00
|
|
|
log.Debug().Err(err).Msg("read kernel config")
|
2023-01-31 07:13:33 +00:00
|
|
|
}
|
2019-08-12 22:58:34 +00:00
|
|
|
|
2018-11-17 20:24:09 +00:00
|
|
|
if len(kcfg.Kernels) == 0 {
|
2024-02-20 11:37:19 +00:00
|
|
|
return errors.New("no kernels found")
|
2018-11-17 20:24:09 +00:00
|
|
|
}
|
2023-01-31 07:13:33 +00:00
|
|
|
|
2018-11-17 20:24:09 +00:00
|
|
|
for _, k := range kcfg.Kernels {
|
2023-05-18 16:07:24 +00:00
|
|
|
fmt.Println(k.Distro.ID, k.Distro.Release, k.KernelRelease)
|
2018-11-17 20:24:09 +00:00
|
|
|
}
|
2023-01-31 07:13:33 +00:00
|
|
|
|
2018-11-17 20:24:09 +00:00
|
|
|
return
|
|
|
|
}
|
2018-11-28 22:41:17 +00:00
|
|
|
|
2023-05-10 07:52:44 +00:00
|
|
|
type KernelListRemoteCmd struct {
|
|
|
|
Distro string `required:"" help:"distribution"`
|
2023-05-29 08:14:32 +00:00
|
|
|
Ver string `help:"distro version"`
|
2023-05-10 07:52:44 +00:00
|
|
|
}
|
|
|
|
|
2023-05-10 08:09:53 +00:00
|
|
|
func (cmd *KernelListRemoteCmd) Run(kernelCmd *KernelCmd, g *Globals) (err error) {
|
2023-06-03 13:05:17 +00:00
|
|
|
if kernelCmd.Update {
|
|
|
|
container.UseCache = false
|
|
|
|
}
|
|
|
|
if kernelCmd.NoPrune {
|
|
|
|
container.Prune = false
|
|
|
|
}
|
|
|
|
|
2023-05-18 16:07:24 +00:00
|
|
|
distroType, err := distro.NewID(cmd.Distro)
|
2023-05-10 07:52:44 +00:00
|
|
|
if err != nil {
|
|
|
|
return
|
|
|
|
}
|
|
|
|
|
2024-02-20 13:25:31 +00:00
|
|
|
km := artifact.Target{
|
2023-05-18 18:48:09 +00:00
|
|
|
Distro: distro.Distro{ID: distroType, Release: cmd.Ver},
|
2024-02-20 13:25:31 +00:00
|
|
|
Kernel: artifact.Kernel{Regex: ".*"},
|
2023-05-10 07:52:44 +00:00
|
|
|
}
|
|
|
|
|
2023-06-15 15:24:29 +00:00
|
|
|
_, err = kernel.GenRootfsImage(km.Distro.RootFS(), false)
|
2023-05-10 07:52:44 +00:00
|
|
|
if err != nil {
|
|
|
|
return
|
|
|
|
}
|
|
|
|
|
2023-05-23 13:20:48 +00:00
|
|
|
container.Registry = g.Config.Docker.Registry
|
|
|
|
container.Commands = g.Config.Docker.Commands
|
2023-05-10 07:52:44 +00:00
|
|
|
|
2023-05-13 10:47:47 +00:00
|
|
|
pkgs, err := kernel.MatchPackages(km)
|
|
|
|
// error check skipped on purpose
|
2023-05-10 07:52:44 +00:00
|
|
|
|
|
|
|
for _, k := range pkgs {
|
|
|
|
fmt.Println(k)
|
|
|
|
}
|
|
|
|
|
|
|
|
return
|
|
|
|
}
|
|
|
|
|
2023-05-26 15:33:54 +00:00
|
|
|
type KernelAutogenCmd struct{}
|
2023-01-31 07:13:33 +00:00
|
|
|
|
2023-06-01 14:02:28 +00:00
|
|
|
func (cmd *KernelAutogenCmd) Run(kernelCmd *KernelCmd, g *Globals) (err error) {
|
2024-02-20 13:25:31 +00:00
|
|
|
ka, err := artifact.Artifact{}.Read(g.WorkDir + "/.out-of-tree.toml")
|
2023-01-31 07:13:33 +00:00
|
|
|
if err != nil {
|
|
|
|
return
|
|
|
|
}
|
|
|
|
|
2023-05-24 16:13:12 +00:00
|
|
|
kernel.SetSigintHandler(&kernelCmd.shutdown)
|
2023-04-07 20:52:45 +00:00
|
|
|
|
2023-05-18 18:13:09 +00:00
|
|
|
for _, sk := range ka.Targets {
|
2023-05-18 16:07:24 +00:00
|
|
|
if sk.Distro.Release == "" {
|
2024-02-20 11:37:19 +00:00
|
|
|
err = errors.New("please set distro_release")
|
2023-01-31 07:13:33 +00:00
|
|
|
return
|
|
|
|
}
|
|
|
|
|
2023-05-26 15:33:54 +00:00
|
|
|
err = kernelCmd.Generate(g, sk)
|
2023-01-31 07:13:33 +00:00
|
|
|
if err != nil {
|
|
|
|
return
|
|
|
|
}
|
2023-05-24 16:13:12 +00:00
|
|
|
if kernelCmd.shutdown {
|
2023-04-07 20:52:45 +00:00
|
|
|
break
|
|
|
|
}
|
2023-01-31 07:13:33 +00:00
|
|
|
}
|
|
|
|
|
2023-05-23 22:00:20 +00:00
|
|
|
return kernelCmd.UpdateConfig()
|
2023-01-31 07:13:33 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
type KernelGenallCmd struct {
|
2023-05-25 06:36:02 +00:00
|
|
|
Distro string `help:"distribution"`
|
|
|
|
Ver string `help:"distro version"`
|
2023-01-31 07:13:33 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func (cmd *KernelGenallCmd) Run(kernelCmd *KernelCmd, g *Globals) (err error) {
|
2023-05-18 16:07:24 +00:00
|
|
|
distroType, err := distro.NewID(cmd.Distro)
|
2023-01-31 07:13:33 +00:00
|
|
|
if err != nil {
|
|
|
|
return
|
|
|
|
}
|
|
|
|
|
2023-05-24 16:13:12 +00:00
|
|
|
kernel.SetSigintHandler(&kernelCmd.shutdown)
|
2023-04-07 20:52:45 +00:00
|
|
|
|
2023-05-25 06:36:02 +00:00
|
|
|
for _, dist := range distro.List() {
|
2023-06-01 14:18:27 +00:00
|
|
|
if kernelCmd.shutdown {
|
|
|
|
break
|
|
|
|
}
|
|
|
|
|
2023-05-25 06:36:02 +00:00
|
|
|
if distroType != distro.None && distroType != dist.ID {
|
|
|
|
continue
|
|
|
|
}
|
|
|
|
|
|
|
|
if cmd.Ver != "" && dist.Release != cmd.Ver {
|
|
|
|
continue
|
|
|
|
}
|
|
|
|
|
2024-02-20 13:25:31 +00:00
|
|
|
target := artifact.Target{
|
2023-05-25 06:36:02 +00:00
|
|
|
Distro: dist,
|
2024-02-20 13:25:31 +00:00
|
|
|
Kernel: artifact.Kernel{Regex: ".*"},
|
2023-05-25 06:36:02 +00:00
|
|
|
}
|
|
|
|
|
2023-05-26 15:33:54 +00:00
|
|
|
err = kernelCmd.Generate(g, target)
|
2023-05-25 06:36:02 +00:00
|
|
|
if err != nil {
|
2024-02-21 08:27:34 +00:00
|
|
|
continue
|
2023-05-25 06:36:02 +00:00
|
|
|
}
|
2023-03-22 18:21:21 +00:00
|
|
|
}
|
|
|
|
|
2023-05-23 22:00:20 +00:00
|
|
|
return kernelCmd.UpdateConfig()
|
2023-03-22 18:21:21 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
type KernelInstallCmd struct {
|
|
|
|
Distro string `required:"" help:"distribution"`
|
|
|
|
Ver string `required:"" help:"distro version"`
|
|
|
|
Kernel string `required:"" help:"kernel release mask"`
|
|
|
|
}
|
|
|
|
|
|
|
|
func (cmd *KernelInstallCmd) Run(kernelCmd *KernelCmd, g *Globals) (err error) {
|
2023-05-18 16:07:24 +00:00
|
|
|
distroType, err := distro.NewID(cmd.Distro)
|
2023-03-22 18:21:21 +00:00
|
|
|
if err != nil {
|
|
|
|
return
|
|
|
|
}
|
|
|
|
|
2023-05-24 16:13:12 +00:00
|
|
|
kernel.SetSigintHandler(&kernelCmd.shutdown)
|
2023-04-07 20:52:45 +00:00
|
|
|
|
2024-02-20 13:25:31 +00:00
|
|
|
km := artifact.Target{
|
2023-05-18 18:48:09 +00:00
|
|
|
Distro: distro.Distro{ID: distroType, Release: cmd.Ver},
|
2024-02-20 13:25:31 +00:00
|
|
|
Kernel: artifact.Kernel{Regex: cmd.Kernel},
|
2023-03-22 18:21:21 +00:00
|
|
|
}
|
2023-05-26 15:33:54 +00:00
|
|
|
err = kernelCmd.Generate(g, km)
|
2023-01-31 07:13:33 +00:00
|
|
|
if err != nil {
|
|
|
|
return
|
|
|
|
}
|
|
|
|
|
2023-05-23 22:00:20 +00:00
|
|
|
return kernelCmd.UpdateConfig()
|
2023-01-31 07:13:33 +00:00
|
|
|
}
|
|
|
|
|
2023-03-24 04:20:28 +00:00
|
|
|
type KernelConfigRegenCmd struct{}
|
|
|
|
|
|
|
|
func (cmd *KernelConfigRegenCmd) Run(kernelCmd *KernelCmd, g *Globals) (err error) {
|
2023-05-23 22:00:20 +00:00
|
|
|
return kernelCmd.UpdateConfig()
|
2018-12-02 19:54:09 +00:00
|
|
|
}
|