Update tests_kernel -> KRNL-5622

Fix runlevel detection for SO without systemd (eg. Slackware)
This commit is contained in:
teoberi 2024-10-01 10:09:43 +03:00 committed by GitHub
parent fa7851e513
commit 42f0b05d10
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 37 additions and 42 deletions

View File

@ -39,11 +39,9 @@
# Description : Check default run level on Linux machines
Register --test-no KRNL-5622 --os Linux --weight L --network NO --category security --description "Determine Linux default run level"
if [ ${SKIPTEST} -eq 0 ]; then
# Only run if systemctl binary is available
if [ -n "${SYSTEMCTLBINARY}" ]; then
# Checking if we can find the systemd default target
LogText "Test: Checking for systemd default.target"
if [ $(${SYSTEMCTLBINARY} get-default) ]; then
if [ $( [ ! -z ${SYSTEMCTLBINARY} ] && ${SYSTEMCTLBINARY} get-default) ]; then
FIND=$(${SYSTEMCTLBINARY} get-default)
FIND2=$(${ECHOCMD} ${FIND} | ${EGREPBINARY} "runlevel5|graphical")
if HasData "${FIND2}"; then
@ -86,9 +84,6 @@
fi
fi
fi
else
LogText "Result: test skipped, as systemctl binary could not be found"
fi
fi
#
#################################################################################