summaryrefslogtreecommitdiff
path: root/setup.py
diff options
context:
space:
mode:
Diffstat (limited to 'setup.py')
-rwxr-xr-xsetup.py38
1 files changed, 22 insertions, 16 deletions
diff --git a/setup.py b/setup.py
index 9118e5f6..9ec038fd 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']