From 3c5d0221ff87c22ffd8e08349fba1fa55e30de85 Mon Sep 17 00:00:00 2001 From: Julia Kreger Date: Fri, 12 Feb 2016 16:43:02 -0500 Subject: [PATCH] Revise systemd determination to verify systemctl presence The base ubuntu image utilizes upstart, however it also has a /usr/lib/systemd/system folder, which is not present in the ubuntu-minimal images. As a result of this, glean fails to properly work on hosts created from the base ubuntu image. In order to address this we should check for the presence of the systemd folder and the systemctl utility. Additionally, added a flag and minor logic changes to ensure installation occurs only once. Closes-bug: #1615673 Change-Id: I056819b4ae1e5ae1fea82fa8d34ad8cb05fe0383 --- glean/install.py | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/glean/install.py b/glean/install.py index cf936c9..65618ef 100755 --- a/glean/install.py +++ b/glean/install.py @@ -96,7 +96,16 @@ def main(): log.info('installing openrc services') install('glean.openrc', '/etc/init.d/glean') subprocess.call(['rc-update', 'add', 'glean', 'boot']) - if os.path.exists('/usr/lib/systemd'): + # Needs to check for the presence of systemd and systemctl + # as apparently some packages may stage systemd init files + # when systemd is not present. + # We also cannot check the path for the init pid as the pid + # may be wrong as install is generally executed in a chroot + # with diskimage-builder. + + if (os.path.exists('/usr/lib/systemd/system') and + (os.path.exists('/usr/bin/systemctl') or + os.path.exists('/bin/systemctl'))): p = _find_gleansh_path() log.info("Installing systemd services")