1
0

fix: install/remove kernel in one layer

This commit is contained in:
dump_stack() 2023-05-18 10:50:24 +00:00
parent 3cd901b1be
commit 4eed03ec2a
Signed by: dump_stack
GPG Key ID: BE44DA8C062D87DC
2 changed files with 17 additions and 14 deletions

View File

@ -85,16 +85,17 @@ func Runs(km config.KernelMask) (commands []string) {
// Install and remove a single kernel and headers. // Install and remove a single kernel and headers.
// This ensures that all dependencies are cached. // This ensures that all dependencies are cached.
cmdf("export TMP_HEADERS=$(yum search kernel-devel --showduplicates " + cmd := "export HEADERS=$(yum search kernel-devel --showduplicates " +
"| grep '^kernel-devel' | cut -d ' ' -f 1 | head -n 1)") "| grep '^kernel-devel' | cut -d ' ' -f 1 | head -n 1)"
cmdf("export TMP_KERNEL=$(echo $TMP_HEADERS | sed 's/-devel//')") cmd += " KERNEL=$(echo $HEADERS | sed 's/-devel//')"
cmdf("export TMP_MODULES=$(echo $TMP_HEADERS | sed 's/-devel/-modules/')") cmd += " MODULES=$(echo $HEADERS | sed 's/-devel/-modules/')"
cmdf("export TMP_CORE=$(echo $TMP_HEADERS | sed 's/-devel/-core/')") cmd += " CORE=$(echo $HEADERS | sed 's/-devel/-core/')"
cmdf("yum -y install $TMP_KERNEL $TMP_HEADERS") cmd += " && yum -y install $KERNEL $HEADERS"
cmdf("yum -y remove %s $TMP_KERNEL $TMP_HEADERS $TMP_MODULES $TMP_CORE", cmd += " && yum -y remove %s $KERNEL $HEADERS $MODULES $CORE"
flags)
cmdf(cmd, flags)
return return
} }

View File

@ -34,15 +34,17 @@ func Runs(km config.KernelMask) (commands []string) {
// Install and remove a single kernel and headers. // Install and remove a single kernel and headers.
// This ensures that all dependencies are cached. // This ensures that all dependencies are cached.
cmdf("export TMP_HEADERS=$(apt-cache search " + cmd := "export HEADERS=$(apt-cache search " +
"--names-only '^linux-headers-[0-9\\.\\-]*-generic' " + "--names-only '^linux-headers-[0-9\\.\\-]*-generic' " +
"| awk '{ print $1 }' | head -n 1)") "| awk '{ print $1 }' | head -n 1)"
cmdf("export TMP_KERNEL=$(echo $TMP_HEADERS | sed 's/headers/image/')") cmd += " KERNEL=$(echo $HEADERS | sed 's/headers/image/')"
cmdf("export TMP_MODULES=$(echo $TMP_HEADERS | sed 's/headers/modules/')") cmd += " MODULES=$(echo $HEADERS | sed 's/headers/modules/')"
cmdf("apt-get install -y $TMP_HEADERS $TMP_KERNEL $TMP_MODULES") cmd += " && apt-get install -y $HEADERS $KERNEL $MODULES"
cmdf("apt-get remove -y $TMP_HEADERS $TMP_KERNEL $TMP_MODULES") cmd += " && apt-get remove -y $HEADERS $KERNEL $MODULES"
cmdf(cmd)
return return
} }