diff options
author | Dimitri John Ledkov <dimitri.ledkov@canonical.com> | 2014-07-24 12:08:20 +0100 |
---|---|---|
committer | Dimitri John Ledkov <dimitri.ledkov@canonical.com> | 2014-07-24 12:08:20 +0100 |
commit | ee2ec1a47946f24ef75b45ec3bc35ea575d298c7 (patch) | |
tree | 234be728f6255f32ad5f55f1a58078adc9e0b7df | |
parent | 5f0b1c3ef92acc34f532188627da9eabefed272a (diff) | |
parent | c0a423ea72b4e9c8e21c07c5ca27dee54133fc19 (diff) | |
download | vyos-cloud-init-ee2ec1a47946f24ef75b45ec3bc35ea575d298c7.tar.gz vyos-cloud-init-ee2ec1a47946f24ef75b45ec3bc35ea575d298c7.zip |
Merge systemd instlal paths.
-rwxr-xr-x | setup.py | 38 |
1 files changed, 22 insertions, 16 deletions
@@ -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'] |