mirror of https://github.com/CISOfy/lynis.git
[KRNL-5830] ignore rescue image for kernels
This commit is contained in:
parent
6283b9a7dd
commit
d8ab98b845
|
@ -529,14 +529,14 @@
|
||||||
# Extra current kernel version and replace dashes to allow numeric sort later on
|
# Extra current kernel version and replace dashes to allow numeric sort later on
|
||||||
MYKERNEL=`uname -r | sed 's/\.[a-z].*.//g' | sed 's/-[a-z].*.//g' | sed 's/-/./g'`
|
MYKERNEL=`uname -r | sed 's/\.[a-z].*.//g' | sed 's/-[a-z].*.//g' | sed 's/-/./g'`
|
||||||
LogText "Result: using ${MYKERNEL} as my kernel version (stripped)"
|
LogText "Result: using ${MYKERNEL} as my kernel version (stripped)"
|
||||||
FIND=`ls /boot/vmlinuz* 2> /dev/null`
|
FIND=$(ls /boot/vmlinuz* 2> /dev/null | grep -v rescue)
|
||||||
if [ ! "${FIND}" = "" ]; then
|
if [ ! "${FIND}" = "" ]; then
|
||||||
LogText "Result: found ${FIND}"
|
LogText "Result: found ${FIND}"
|
||||||
# Display kernels, extract version numbers and sort them numeric per column (up to 6 numbers)
|
# Display kernels, extract version numbers and sort them numeric per column (up to 6 numbers)
|
||||||
# Remove generic. and huge. for Slackware machines
|
# Ignore rescue images. Remove generic. and huge. for Slackware machines
|
||||||
KERNELS=`ls /boot/vmlinuz* | sed 's/vmlinuz-//' | sed 's/generic.//' | sed 's/huge.//' | sed 's/\.[a-z].*.//g' | sed 's/-[a-z].*.//g' | sed 's./boot/..' | sed 's/-/./g' | sort -n -k1,1 -k2,2 -k3,3 -k4,4 -k5,5 -k6,6 -t \.`
|
KERNELS=`ls /boot/vmlinuz* | grep -v rescue | sed 's/vmlinuz-//' | sed 's/generic.//' | sed 's/huge.//' | sed 's/\.[a-z].*.//g' | sed 's/-[a-z].*.//g' | sed 's./boot/..' | sed 's/-/./g' | sort -n -k1,1 -k2,2 -k3,3 -k4,4 -k5,5 -k6,6 -t \.`
|
||||||
LogText "Output: ${KERNELS}"
|
LogText "Output: ${KERNELS}"
|
||||||
elif [ ! `ls /boot/kernel* 2> /dev/null` = "" ]; then
|
elif [ ! "$(ls /boot/kernel* 2> /dev/null)" = "" ]; then
|
||||||
LogText "Output: Found a kernel file in /boot"
|
LogText "Output: Found a kernel file in /boot"
|
||||||
# Display kernels, extract version numbers and sort them numeric per column (up to 6 numbers)
|
# Display kernels, extract version numbers and sort them numeric per column (up to 6 numbers)
|
||||||
# Examples:
|
# Examples:
|
||||||
|
|
Loading…
Reference in New Issue