refactor: move cmdline generation out of distro switch
This commit is contained in:
parent
5ccca6617f
commit
26faa53f8b
@ -223,13 +223,11 @@ func installKernel(sk config.KernelMask, pkgname string, force, headers bool) (e
|
|||||||
|
|
||||||
slog.Debug().Msgf("Installing kernel")
|
slog.Debug().Msgf("Installing kernel")
|
||||||
|
|
||||||
// TODO use list of commands instead of appending to string
|
var commands []string
|
||||||
cmd := "true"
|
|
||||||
|
|
||||||
// TODO install/cleanup kernel interface
|
// TODO install/cleanup kernel interface
|
||||||
switch sk.DistroType {
|
switch sk.DistroType {
|
||||||
case config.Ubuntu:
|
case config.Ubuntu:
|
||||||
var commands []string
|
|
||||||
commands, err = ubuntu.Install(sk, pkgname, headers)
|
commands, err = ubuntu.Install(sk, pkgname, headers)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return
|
return
|
||||||
@ -239,12 +237,7 @@ func installKernel(sk config.KernelMask, pkgname string, force, headers bool) (e
|
|||||||
ubuntu.Cleanup(sk, pkgname)
|
ubuntu.Cleanup(sk, pkgname)
|
||||||
}
|
}
|
||||||
}()
|
}()
|
||||||
|
|
||||||
for _, command := range commands {
|
|
||||||
cmd += fmt.Sprintf(" && %s", command)
|
|
||||||
}
|
|
||||||
case config.OracleLinux, config.CentOS:
|
case config.OracleLinux, config.CentOS:
|
||||||
var commands []string
|
|
||||||
commands, err = oraclelinux.Install(sk, pkgname, headers)
|
commands, err = oraclelinux.Install(sk, pkgname, headers)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return
|
return
|
||||||
@ -254,12 +247,7 @@ func installKernel(sk config.KernelMask, pkgname string, force, headers bool) (e
|
|||||||
oraclelinux.Cleanup(sk, pkgname)
|
oraclelinux.Cleanup(sk, pkgname)
|
||||||
}
|
}
|
||||||
}()
|
}()
|
||||||
|
|
||||||
for _, command := range commands {
|
|
||||||
cmd += fmt.Sprintf(" && %s", command)
|
|
||||||
}
|
|
||||||
case config.Debian:
|
case config.Debian:
|
||||||
var commands []string
|
|
||||||
commands, err = debian.Install(sk, pkgname, headers)
|
commands, err = debian.Install(sk, pkgname, headers)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return
|
return
|
||||||
@ -269,15 +257,16 @@ func installKernel(sk config.KernelMask, pkgname string, force, headers bool) (e
|
|||||||
debian.Cleanup(sk, pkgname)
|
debian.Cleanup(sk, pkgname)
|
||||||
}
|
}
|
||||||
}()
|
}()
|
||||||
|
|
||||||
for _, command := range commands {
|
|
||||||
cmd += fmt.Sprintf(" && %s", command)
|
|
||||||
}
|
|
||||||
default:
|
default:
|
||||||
err = fmt.Errorf("%s not yet supported", sk.DistroType.String())
|
err = fmt.Errorf("%s not yet supported", sk.DistroType.String())
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
cmd := "true"
|
||||||
|
for _, command := range commands {
|
||||||
|
cmd += fmt.Sprintf(" && %s", command)
|
||||||
|
}
|
||||||
|
|
||||||
c.Args = append(c.Args, "-v", volumes.LibModules+":/target/lib/modules")
|
c.Args = append(c.Args, "-v", volumes.LibModules+":/target/lib/modules")
|
||||||
c.Args = append(c.Args, "-v", volumes.UsrSrc+":/target/usr/src")
|
c.Args = append(c.Args, "-v", volumes.UsrSrc+":/target/usr/src")
|
||||||
c.Args = append(c.Args, "-v", volumes.Boot+":/target/boot")
|
c.Args = append(c.Args, "-v", volumes.Boot+":/target/boot")
|
||||||
|
Loading…
x
Reference in New Issue
Block a user