1
0

refactor: move ubutu install/cleanup to module

This commit is contained in:
2023-05-18 11:46:12 +00:00
parent 407c1a7975
commit 6a338fc6ad
2 changed files with 32 additions and 4 deletions

View File

@ -229,12 +229,20 @@ func installKernel(sk config.KernelMask, pkgname string, force, headers bool) (e
// TODO install/cleanup kernel interface
switch sk.DistroType {
case config.Ubuntu:
var headerspkg string
if headers {
headerspkg = strings.Replace(pkgname, "image", "headers", -1)
var commands []string
commands, err = oraclelinux.Install(sk, pkgname, headers)
if err != nil {
return
}
defer func() {
if err != nil {
oraclelinux.Cleanup(sk, pkgname)
}
}()
cmd += fmt.Sprintf(" && apt-get install -y %s %s", pkgname, headerspkg)
for _, command := range commands {
cmd += fmt.Sprintf(" && %s", command)
}
case config.OracleLinux, config.CentOS:
var commands []string
commands, err = oraclelinux.Install(sk, pkgname, headers)