BOOT-5104: Rewrote test to detect service manager

This commit is contained in:
mboelen 2016-03-16 12:10:10 +01:00
parent 488c08c3f3
commit 237c0f87a7

View File

@ -70,34 +70,28 @@
case ${OS} in case ${OS} in
"Linux") "Linux")
if [ -f /proc/1/cmdline ]; then if [ -f /proc/1/cmdline ]; then
FILE=`awk '/^\// { print $1 }' /proc/1/cmdline` FIND=`awk '/^\// { print $1 }' /proc/1/cmdline`
if [ ! "${FILE}" = "" ]; then if [ ! "${FIND}" = "" ]; then
if [ -L ${FILE} ]; then SHORTNAME=`echo ${FIND} | awk -F/ '{ print $NF }'`
ShowSymlinkPath ${FILE} LogText "Found: ${SHORTNAME}"
if [ -f ${sFILE} ]; then case ${SHORTNAME} in
SHORTNAME=`echo ${sFILE} | awk -F/ '{ print $NF }'` "init")
case ${SHORTNAME} in SERVICE_MANAGER="SysV Init"
upstart) ;;
SERVICE_MANAGER="upstart" systemd)
;;
systemd)
SERVICE_MANAGER="systemd"
;;
*)
LogText "Found ${SHORTNAME} but unclear what service manager this is"
;;
esac
else
LogText "Result: Could not find linked file ${sFILE}"
fi
else
FIND=`echo ${FILE} | grep "/systemd"`
if [ ! "${FIND}" = "" ]; then
SERVICE_MANAGER="systemd" SERVICE_MANAGER="systemd"
fi ;;
fi upstart)
SERVICE_MANAGER="upstart"
;;
*)
LogText "Found ${SHORTNAME}. Unclear what service manager this is"
ReportException "${TEST_NO}:001" "Unknown service manager"
;;
esac
else else
LogText "Result: /proc/1/cmdline does not link to a binary on disk" LogText "Result: /proc/1/cmdline seems to be empty"
ReportException "${TEST_NO}:002" "No data found in /proc/1/cmdline"
fi fi
fi fi
# Continue testing if we didn't find it yet # Continue testing if we didn't find it yet
@ -113,7 +107,8 @@
*) *)
LogText "Result: unknown service manager" LogText "Result: unknown service manager"
esac esac
if [ "${SERVICE_MANAGER}" = "unknown" ]; then LogText "Result: service manager found = ${SERVICE_MANAGER}"
if [ "${SERVICE_MANAGER}" = "" -o "${SERVICE_MANAGER}" = "unknown" ]; then
Display --indent 2 --text "- Service Manager" --result "UNKNOWN" --color YELLOW Display --indent 2 --text "- Service Manager" --result "UNKNOWN" --color YELLOW
else else
Display --indent 2 --text "- Service Manager" --result "${SERVICE_MANAGER}" --color GREEN Display --indent 2 --text "- Service Manager" --result "${SERVICE_MANAGER}" --color GREEN