summaryrefslogtreecommitdiff
path: root/repo/openresolv/detect_init-remove-irrelevant.patch
diff options
context:
space:
mode:
Diffstat (limited to 'repo/openresolv/detect_init-remove-irrelevant.patch')
-rw-r--r--repo/openresolv/detect_init-remove-irrelevant.patch87
1 files changed, 87 insertions, 0 deletions
diff --git a/repo/openresolv/detect_init-remove-irrelevant.patch b/repo/openresolv/detect_init-remove-irrelevant.patch
new file mode 100644
index 0000000..e34d037
--- /dev/null
+++ b/repo/openresolv/detect_init-remove-irrelevant.patch
@@ -0,0 +1,87 @@
+From: Jakub Jirutka <jakub@jirutka.cz>
+Date: Sat, 25 Jun 2022 19:51:00 +0200
+Subject: Remove support for init systems we don't have, add support for s6
+
+Don't waste resources looking for init systems we don't have in Alpine.
+
+--- a/resolvconf.in
++++ b/resolvconf.in
+@@ -299,74 +299,19 @@
+ [ -n "$RESTARTCMD" ] && return 0
+
+ # Detect the running init system.
+- # As systemd and OpenRC can be installed on top of legacy init
+- # systems we try to detect them first.
+ status="@STATUSARG@"
+ : ${status:=status}
+- if [ -x /bin/systemctl ] && [ -S /run/systemd/private ]; then
+- RESTARTCMD='
+- if /bin/systemctl --quiet is-active $1.service
+- then
+- /bin/systemctl restart $1.service
+- fi'
+- elif [ -x /usr/bin/systemctl ] && [ -S /run/systemd/private ]; then
+- RESTARTCMD='
+- if /usr/bin/systemctl --quiet is-active $1.service
+- then
+- /usr/bin/systemctl restart $1.service
+- fi'
+- elif [ -x /sbin/rc-service ] &&
++ if [ -x /sbin/rc-service ] &&
+ { [ -s /libexec/rc/init.d/softlevel ] ||
+ [ -s /run/openrc/softlevel ]; }
+ then
+ RESTARTCMD='/sbin/rc-service -i $1 -- -Ds restart'
+- elif [ -x /usr/sbin/invoke-rc.d ]; then
+- RCDIR=/etc/init.d
+- RESTARTCMD='
+- if /usr/sbin/invoke-rc.d --quiet $1 status >/dev/null 2>&1
+- then
+- /usr/sbin/invoke-rc.d $1 restart
+- fi'
+- elif [ -x /sbin/service ]; then
+- # Old RedHat
+- RCDIR=/etc/init.d
+- RESTARTCMD='
+- if /sbin/service $1; then
+- /sbin/service $1 restart
+- fi'
+- elif [ -x /usr/sbin/service ]; then
+- # Could be FreeBSD
+- RESTARTCMD="
+- if /usr/sbin/service \$1 $status >/dev/null 2>&1
+- then
+- /usr/sbin/service \$1 restart
+- fi"
+ elif [ -x /bin/sv ]; then
+ RESTARTCMD='/bin/sv status $1 >/dev/null 2>&1 &&
+ /bin/sv try-restart $1'
+- elif [ -x /usr/bin/sv ]; then
+- RESTARTCMD='/usr/bin/sv status $1 >/dev/null 2>&1 &&
+- /usr/bin/sv try-restart $1'
+- elif [ -e /etc/arch-release ] && [ -d /etc/rc.d ]; then
+- RCDIR=/etc/rc.d
+- RESTARTCMD='
+- if [ -e /var/run/daemons/$1 ]
+- then
+- /etc/rc.d/$1 restart
+- fi'
+- elif [ -e /etc/slackware-version ] && [ -d /etc/rc.d ]; then
+- RESTARTCMD='
+- if /etc/rc.d/rc.$1 status >/dev/null 2>&1
+- then
+- /etc/rc.d/rc.$1 restart
+- fi'
+- elif [ -e /etc/rc.d/rc.subr ] && [ -d /etc/rc.d ]; then
+- # OpenBSD
+- RESTARTCMD='
+- if /etc/rc.d/$1 check >/dev/null 2>&1
+- then
+- /etc/rc.d/$1 restart
+- fi'
++ # TODO: Test if this works correctly.
++ elif [ -x /bin/s6-svc ] && [ -e /run/s6-rc ]; then
++ RESTARTCMD='/bin/s6-svc -r /run/service/$1'
+ else
+ for x in /etc/init.d/rc.d /etc/rc.d /etc/init.d; do
+ [ -d $x ] || continue