|
268 | 268 | ROCKY8_RELEASE_NAME = "Rocky Linux release 8" |
269 | 269 | ALMALINUX8_RELEASE_NAME = "AlmaLinux release 8" |
270 | 270 | AMAZON_LINUX_2022_RELEASE_NAME = "Amazon Linux release 2022" |
| 271 | +ALPINE_RELEASE_NAME = "Alpine Linux" |
271 | 272 |
|
272 | 273 | SKIP_NO_LIBWRAP_RELEASES = [ |
273 | 274 | RHEL8_RELEASE_NAME, |
|
280 | 281 | ROCKY8_RELEASE_NAME, |
281 | 282 | AMAZON_LINUX_2022_RELEASE_NAME, |
282 | 283 | ALMALINUX8_RELEASE_NAME, |
| 284 | + ALPINE_RELEASE_NAME, |
283 | 285 | ] |
284 | 286 |
|
285 | 287 | # Multiplier for max read ahead buffer size |
@@ -1310,6 +1312,11 @@ def get_init_system(comm_file="/proc/1/comm"): |
1310 | 1312 | init_system = f.read().strip() |
1311 | 1313 | except IOError: |
1312 | 1314 | logging.warning("Unable to read %s", comm_file) |
| 1315 | + |
| 1316 | + # OpenRC init system manages services a little differently |
| 1317 | + if init_system == "init" and os.path.isfile("/sbin/openrc"): |
| 1318 | + init_system = "openrc-init" |
| 1319 | + logging.debug("Detected OpenRC init system") |
1313 | 1320 | else: |
1314 | 1321 | init_system = "launchd" |
1315 | 1322 |
|
@@ -1369,6 +1376,24 @@ def start_watchdog(init_system): |
1369 | 1376 | elif "start" in str(status): |
1370 | 1377 | logging.debug("%s is already running", WATCHDOG_SERVICE) |
1371 | 1378 |
|
| 1379 | + elif init_system == "openrc-init": |
| 1380 | + proc = subprocess.Popen( |
| 1381 | + ["/sbin/service", WATCHDOG_SERVICE, "status"], |
| 1382 | + stdout=subprocess.PIPE, |
| 1383 | + stderr=subprocess.PIPE, |
| 1384 | + close_fds=True, |
| 1385 | + ) |
| 1386 | + status, _ = proc.communicate() |
| 1387 | + if "stopped" in str(status): |
| 1388 | + subprocess.Popen( |
| 1389 | + ["/sbin/service", WATCHDOG_SERVICE, "start"], |
| 1390 | + stdout=subprocess.DEVNULL, |
| 1391 | + stderr=subprocess.DEVNULL, |
| 1392 | + close_fds=True, |
| 1393 | + ) |
| 1394 | + elif "started" in str(status): |
| 1395 | + logging.debug("%s is already running", WATCHDOG_SERVICE) |
| 1396 | + |
1372 | 1397 | elif init_system == "systemd": |
1373 | 1398 | rc = subprocess.call( |
1374 | 1399 | ["systemctl", "is-active", "--quiet", WATCHDOG_SERVICE], close_fds=True |
|
0 commit comments