From 14ce31b3b73c1ad6b448420d49ebb9d78c70d890 Mon Sep 17 00:00:00 2001 From: Michael Prokop Date: Fri, 13 Jan 2017 13:36:20 +0100 Subject: [PATCH] Rely on /proc/1/comm to identify running systemd /proc/[pid]/comm is available since Linux 2.6.33 so we should be able to rely on that. Inside /proc/1/cmdline might end up additional boot options, e.g. when booting with "nocolor" boot option it ends up as "/sbin/initnocolor" and then our check breaks. --- autoconfig.functions | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/autoconfig.functions b/autoconfig.functions index bf5fa92..3fc0232 100755 --- a/autoconfig.functions +++ b/autoconfig.functions @@ -23,7 +23,7 @@ umask 022 # Ignore these signals in non-interactive mode: INT, TERM, SEGV [ -z "$PS1" ] && trap "" 2 3 11 -if [[ "$(realpath "$(cat /proc/1/cmdline)")" == "/lib/systemd/systemd" ]] ; then +if [ "$(cat /proc/1/comm 2>/dev/null)" = "systemd" ] ; then SYSTEMD=true else SYSTEMD=false -- 2.1.4