--- a/src/mount_efs/__init__.py +++ b/src/mount_efs/__init__.py @@ -265,7 +265,8 @@ OPEN_SUSE_LEAP_RELEASE_NAME = "openSUSE Leap" SUSE_RELEASE_NAME = "SUSE Linux Enterprise Server" MACOS_BIG_SUR_RELEASE = "macOS-11" - +ALPINE_RELEASE_NAME = "Alpine Linux" + SKIP_NO_LIBWRAP_RELEASES = [ RHEL8_RELEASE_NAME, CENTOS8_RELEASE_NAME, @@ -274,6 +275,7 @@ SUSE_RELEASE_NAME, MACOS_BIG_SUR_RELEASE, ORACLE_RELEASE_NAME, + ALPINE_RELEASE_NAME, ] # Multiplier for max read ahead buffer size @@ -1304,6 +1306,11 @@ init_system = f.read().strip() except IOError: logging.warning("Unable to read %s", comm_file) + + # OpenRC init system manages services a little differently + if init_system == "init" and os.path.isfile("/sbin/openrc"): + init_system = "openrc-init" + logging.debug("Detected OpenRC init system") else: init_system = "launchd" @@ -1361,6 +1368,24 @@ close_fds=True, ) elif "start" in str(status): + logging.debug("%s is already running", WATCHDOG_SERVICE) + + elif init_system == "openrc-init": + proc = subprocess.Popen( + ["/sbin/service", WATCHDOG_SERVICE, "status"], + stdout=subprocess.PIPE, + stderr=subprocess.PIPE, + close_fds=True, + ) + status, _ = proc.communicate() + if "stopped" in str(status): + subprocess.Popen( + ["/sbin/service", WATCHDOG_SERVICE, "start"], + stdout=subprocess.DEVNULL, + stderr=subprocess.DEVNULL, + close_fds=True, + ) + elif "started" in str(status): logging.debug("%s is already running", WATCHDOG_SERVICE) elif init_system == "systemd":