summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDimitri John Ledkov <dimitri.ledkov@canonical.com>2014-07-24 12:08:20 +0100
committerDimitri John Ledkov <dimitri.ledkov@canonical.com>2014-07-24 12:08:20 +0100
commitee2ec1a47946f24ef75b45ec3bc35ea575d298c7 (patch)
tree234be728f6255f32ad5f55f1a58078adc9e0b7df
parent5f0b1c3ef92acc34f532188627da9eabefed272a (diff)
parentc0a423ea72b4e9c8e21c07c5ca27dee54133fc19 (diff)
downloadvyos-cloud-init-ee2ec1a47946f24ef75b45ec3bc35ea575d298c7.tar.gz
vyos-cloud-init-ee2ec1a47946f24ef75b45ec3bc35ea575d298c7.zip
Merge systemd instlal paths.
-rwxr-xr-xsetup.py38
1 files changed, 22 insertions, 16 deletions
diff --git a/setup.py b/setup.py
index 8b1e6ece..1b0e8fd0 100755
--- a/setup.py
+++ b/setup.py
@@ -35,22 +35,6 @@ import subprocess
def is_f(p):
return os.path.isfile(p)
-
-INITSYS_FILES = {
- 'sysvinit': [f for f in glob('sysvinit/redhat/*') if is_f(f)],
- 'sysvinit_deb': [f for f in glob('sysvinit/debian/*') if is_f(f)],
- 'systemd': [f for f in glob('systemd/*') if is_f(f)],
- 'upstart': [f for f in glob('upstart/*') if is_f(f)],
-}
-INITSYS_ROOTS = {
- 'sysvinit': '/etc/rc.d/init.d',
- 'sysvinit_deb': '/etc/init.d',
- 'systemd': '/etc/systemd/system/',
- 'upstart': '/etc/init/',
-}
-INITSYS_TYPES = sorted(list(INITSYS_ROOTS.keys()))
-
-
def tiny_p(cmd, capture=True):
# Darn python 2.6 doesn't have check_output (argggg)
stdout = subprocess.PIPE
@@ -67,6 +51,28 @@ def tiny_p(cmd, capture=True):
% (cmd, ret, out, err))
return (out, err)
+def systemd_unitdir():
+ cmd = ['pkg-config', '--variable=systemdsystemunitdir', 'systemd']
+ try:
+ (path, err) = tiny_p(cmd)
+ except:
+ return '/lib/systemd/system'
+ return str(path).strip()
+
+INITSYS_FILES = {
+ 'sysvinit': [f for f in glob('sysvinit/redhat/*') if is_f(f)],
+ 'sysvinit_deb': [f for f in glob('sysvinit/debian/*') if is_f(f)],
+ 'systemd': [f for f in glob('systemd/*') if is_f(f)],
+ 'upstart': [f for f in glob('upstart/*') if is_f(f)],
+}
+INITSYS_ROOTS = {
+ 'sysvinit': '/etc/rc.d/init.d',
+ 'sysvinit_deb': '/etc/init.d',
+ 'systemd': systemd_unitdir(),
+ 'upstart': '/etc/init/',
+}
+INITSYS_TYPES = sorted(list(INITSYS_ROOTS.keys()))
+
def get_version():
cmd = ['tools/read-version']