[BOOT-5104] Add service manager detection support for runit

This fixes issue #1134.
This commit is contained in:
Johannes Heimansberg 2021-04-25 10:52:56 +02:00
parent f41a2ead38
commit 1d45d5534e
1 changed files with 5 additions and 1 deletions

View File

@ -63,6 +63,7 @@
# Description : Determine service manager # Description : Determine service manager
# Notes : # Notes :
# initscripts - Used by Arch before # initscripts - Used by Arch before
# runit - Used by Artix, Devuan, Dragora and Void
# systemd - Common option with more Linux distros implementing it # systemd - Common option with more Linux distros implementing it
# upstart - Used by Debian/Ubuntu # upstart - Used by Debian/Ubuntu
Register --test-no BOOT-5104 --weight L --network NO --category security --description "Determine service manager" Register --test-no BOOT-5104 --weight L --network NO --category security --description "Determine service manager"
@ -71,7 +72,7 @@
case ${OS} in case ${OS} in
"Linux") "Linux")
if [ -f /proc/1/cmdline ]; then if [ -f /proc/1/cmdline ]; then
OUTPUT=$(${AWKBINARY} '/(^\/|init)/ { print $1 }' /proc/1/cmdline | ${TRBINARY} '\0' ' ' | ${SEDBINARY} 's/ $//') OUTPUT=$(${AWKBINARY} '/(^\/|init|runit)/ { print $1 }' /proc/1/cmdline | ${TRBINARY} '\0' ' ' | ${SEDBINARY} 's/ $//')
LogText "Result: cmdline found = ${OUTPUT}" LogText "Result: cmdline found = ${OUTPUT}"
FILENAME=$(echo "${OUTPUT}" | ${AWKBINARY} '{print $1}') FILENAME=$(echo "${OUTPUT}" | ${AWKBINARY} '{print $1}')
LogText "Result: file on disk = ${FILENAME}" LogText "Result: file on disk = ${FILENAME}"
@ -108,6 +109,9 @@
upstart) upstart)
SERVICE_MANAGER="upstart" SERVICE_MANAGER="upstart"
;; ;;
runit)
SERVICE_MANAGER="runit"
;;
*) *)
CONTAINS_SYSTEMD=$(echo ${SHORTNAME} | ${GREPBINARY} "systemd") CONTAINS_SYSTEMD=$(echo ${SHORTNAME} | ${GREPBINARY} "systemd")
if [ -n "${CONTAINS_SYSTEMD}" ]; then if [ -n "${CONTAINS_SYSTEMD}" ]; then