From f71af5728888e7f6e16951de366094b74621328e Mon Sep 17 00:00:00 2001 From: Thomas Oettli Date: Fri, 12 Aug 2022 09:30:52 +0200 Subject: [PATCH] fix installation of systemd service file --- pyinotifyd/_install.py | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/pyinotifyd/_install.py b/pyinotifyd/_install.py index 717a667..50da3af 100755 --- a/pyinotifyd/_install.py +++ b/pyinotifyd/_install.py @@ -21,14 +21,19 @@ import shutil import sys -SYSTEMD_PATH = "/lib/systemd/system" +SYSTEMD_PATHS = ["/lib/systemd/system", "/usr/lib/systemd/system"] + OPENRC = "/sbin/openrc" def _systemd_files(pkg_dir, name): + for path in SYSTEMD_PATHS: + if os.path.isdir(path): + break + return [ (f"{pkg_dir}/misc/systemd/{name}.service", - f"{SYSTEMD_PATH}/{name}.service", True)] + f"{path}/{name}.service", True)] def _openrc_files(pkg_dir, name): @@ -113,7 +118,11 @@ def _check_root(): def _check_systemd(): - systemd = os.path.isdir(SYSTEMD_PATH) + for path in SYSTEMD_PATHS: + systemd = os.path.isdir(path) + if systemd: + break + if systemd: logging.info("systemd detected")