feat: improve systemd detection with additional fallback checks

This commit is contained in:
kake26 2025-05-23 22:07:43 -05:00
parent 014a645a22
commit 85b291a5f8
Signed by: kake26
GPG key ID: E0A989B571D1F99F

View file

@ -3,8 +3,8 @@
# svc.sh - Unified service and package management wrapper for systemd, OpenRC (Devuan), and OpenRC (Alpine)
# Usage: svc.sh <command> [service|package]
# Detect init system and distribution
if [ -f /run/systemd/system ]; then
# Detect init system
if [ -f /run/systemd/system ] || command -v systemctl >/dev/null || grep -q systemd /proc/1/comm; then
INIT_SYSTEM="systemd"
elif [ -f /sbin/openrc ]; then
if grep -qi "alpine" /etc/os-release; then
@ -136,4 +136,4 @@ case "$1" in
echo "Usage: $0 {start|stop|enable|disable|status|list|install|remove|update|search} [service|package]"
exit 1
;;
esac
esac