feat: improve systemd detection with additional fallback checks
This commit is contained in:
parent
014a645a22
commit
85b291a5f8
1 changed files with 3 additions and 3 deletions
6
svc.bash
6
svc.bash
|
@ -3,8 +3,8 @@
|
||||||
# svc.sh - Unified service and package management wrapper for systemd, OpenRC (Devuan), and OpenRC (Alpine)
|
# svc.sh - Unified service and package management wrapper for systemd, OpenRC (Devuan), and OpenRC (Alpine)
|
||||||
# Usage: svc.sh <command> [service|package]
|
# Usage: svc.sh <command> [service|package]
|
||||||
|
|
||||||
# Detect init system and distribution
|
# Detect init system
|
||||||
if [ -f /run/systemd/system ]; then
|
if [ -f /run/systemd/system ] || command -v systemctl >/dev/null || grep -q systemd /proc/1/comm; then
|
||||||
INIT_SYSTEM="systemd"
|
INIT_SYSTEM="systemd"
|
||||||
elif [ -f /sbin/openrc ]; then
|
elif [ -f /sbin/openrc ]; then
|
||||||
if grep -qi "alpine" /etc/os-release; 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]"
|
echo "Usage: $0 {start|stop|enable|disable|status|list|install|remove|update|search} [service|package]"
|
||||||
exit 1
|
exit 1
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
Loading…
Add table
Add a link
Reference in a new issue