Updated check for systemd

Based on http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=703600
and http://cgit.freedesktop.org/systemd/systemd/commit/?id=66e411811b8090

This will probably need testing on a variety of oses.
This commit is contained in:
Joe Healy 2013-04-30 09:15:22 +10:00
parent 19920fac76
commit 0df92e1eb5

View File

@ -31,15 +31,10 @@ def _sd_booted():
try:
# This check does the same as sd_booted() from libsystemd-daemon:
# http://www.freedesktop.org/software/systemd/man/sd_booted.html
cgroup_fs = os.stat('/sys/fs/cgroup')
cgroup_systemd = os.stat('/sys/fs/cgroup/systemd')
if os.stat('/run/systemd/system'):
__context__['systemd.sd_booted'] = True
except OSError:
__context__['systemd.sd_booted'] = False
else:
if cgroup_fs.st_dev != cgroup_systemd.st_dev:
__context__['systemd.sd_booted'] = True
else:
__context__['systemd.sd_booted'] = False
return __context__['systemd.sd_booted']