mirror of
https://github.com/valitydev/salt.git
synced 2024-11-08 01:18:58 +00:00
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:
parent
19920fac76
commit
0df92e1eb5
@ -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']
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user