summaryrefslogtreecommitdiff
path: root/repo/openresolv/detect_init-remove-irrelevant.patch
blob: e34d037e21e8b7d50dbb1f2f2ce1b1dbe2a628f3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
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