Upon install, test for systemd first

When installing on a systemd based host, for example on a Debian
image, the /etc/init folder may exist, however it may not actually
be executed upon.

As a result, we should test for the presence of systemd first, then
upstart, then finally SysV init.

Change-Id: Iaca62753283fa7bed1e377c4bfe7cb9d7b10ac17
This commit is contained in:
Julia Kreger
2015-07-27 14:14:54 -04:00
parent cc401d456b
commit 346c2a8263

View File

@@ -29,9 +29,7 @@ def install(source_file, target_file, mode='0755'):
def main():
if os.path.exists('/etc/init'):
install('glean.conf', '/etc/init/glean.conf')
elif os.path.exists('/usr/lib/systemd'):
if os.path.exists('/usr/lib/systemd'):
install(
'glean@.service',
'/usr/lib/systemd/system/glean@.service')
@@ -39,6 +37,8 @@ def main():
'glean-udev.rules',
'/etc/udev/rules.d/99-glean.rules',
mode='0644')
elif os.path.exists('/etc/init'):
install('glean.conf', '/etc/init/glean.conf')
else:
install('glean.init', '/etc/init.d/glean')
os.system('update-rc.d glean defaults')