summaryrefslogtreecommitdiff
path: root/pcr/openresolv-openrc/fs33801.patch
blob: 53b44e4f8d749a1b2ba77f3044cb3df1f3cd647d (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
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
diff -u -r openresolv-3.6.1/configure openresolv-3.6.1-arch/configure
--- openresolv-3.6.1/configure	2014-10-28 23:03:14.000000000 +0100
+++ openresolv-3.6.1-arch/configure	2015-01-01 12:20:34.805786238 +0100
@@ -7,6 +7,7 @@
 HOST=
 TARGET=
 RESTARTCMD=
+RELOADCMD=
 RCDIR=
 
 for x do
@@ -33,6 +34,7 @@
 	--target) TARGET=$var;;
 	--libdir) LIBDIR=$var;;
 	--restartcmd) RESTARTCMD=$var;;
+	--reloadcmd) RELOADCMD=$var;;
 	--includedir) eval INCLUDEDIR="$INCLUDEDIR${INCLUDEDIR:+ }$var";;
 	--datadir|--infodir) ;; # ignore autotools
 	--disable-maintainer-mode|--disable-dependency-tracking) ;;
@@ -60,7 +62,7 @@
 		echo "no"
 		RUNDIR=/var/run
 	fi
-fi	
+fi
 
 : ${SED:=sed}
 
@@ -68,7 +70,6 @@
 : ${SBINDIR:=$PREFIX/sbin}
 : ${LIBEXECDIR:=$PREFIX/libexec/resolvconf}
 : ${STATEDIR:=/var}
-: ${RUNDIR:=$STATEDIR/run}
 : ${MANDIR:=${PREFIX:-/usr}/share/man}
 
 eval SYSCONFDIR="$SYSCONFDIR"
@@ -117,7 +118,7 @@
 rm -rf $CONFIG_MK
 echo "# $OS" >$CONFIG_MK
 
-for x in SYSCONFDIR SBINDIR LIBEXECDIR VARDIR MANDIR; do
+for x in SYSCONFDIR SBINDIR LIBEXECDIR VARDIR MANDIR RUNDIR; do
 	eval v=\$$x
 	# Make files look nice for import
 	l=$((10 - ${#x}))
@@ -126,26 +127,30 @@
 	echo "$x=$t	$v" >>$CONFIG_MK
 done
 
-if [ -z "$RESTARTCMD" ]; then
+if [ -z "$RESTARTCMD" -o -z "$RELOADCMD" ]; then
 	printf "Checking for systemd ... "
 	if [ -x /bin/systemctl ]; then
-		RESTARTCMD="/bin/systemctl try-restart \1"
+		: ${RESTARTCMD:="/bin/systemctl --fail --no-block try-restart \1"}
+		: ${RELOADCMD:="/bin/systemctl --fail --no-block reload \1"}
 		echo "yes"
 	elif [ -x /usr/bin/systemctl ]; then
-		RESTARTCMD="/usr/bin/systemctl try-restart \1"
+		: ${RESTARTCMD:="/usr/bin/systemctl --fail --no-block try-restart \1"}
+		: ${RELOADCMD:="/usr/bin/systemctl --fail --no-block reload \1"}
 		echo "yes"
 	else
 		echo "no"
 	fi
 fi
 
+: ${RELOADCMD:='[ -s "\2" ] \&\& kill -HUP \\`cat "\2"\\` 2>/dev/null'}
+
 # Arch upgraded to systemd, so this check has to be just after systemd
 # but higher than the others
 if [ -z "$RESTARTCMD" ]; then
 	printf "Checking for Arch ... "
 	if [ -e /etc/arch-release -a -d /etc/rc.d ]; then
 		RCDIR=/etc/rc.d
-		RESTARTCMD="[ -e /var/run/daemons/\1 ] \&\& /etc/rc.d/\1 restart"
+		RESTARTCMD="[ -e $RUNDIR/daemons/\1 ] \&\& /etc/rc.d/\1 restart"
 		echo "yes"
 	else
 		echo "no"
@@ -203,11 +208,13 @@
 echo "RCDIR=		$RCDIR" >>$CONFIG_MK
 # Work around bug in the dash shell as "echo 'foo \1'" does bad things
 printf "%s\n" "RESTARTCMD=	$RESTARTCMD" >>$CONFIG_MK
+printf "%s\n" "RELOADCMD=	$RELOADCMD"  >>$CONFIG_MK
 
 echo
 echo "   SYSCONFDIR =		$SYSCONFDIR"
 echo "   SBINDIR =		$SBINDIR"
 echo "   LIBEXECDIR =		$LIBEXECDIR"
-echo "   VARDIR =		$RUNDIR"
+echo "   RUNDIR =		$RUNDIR"
+echo "   VARDIR =		$VARDIR"
 echo "   MANDIR =		$MANDIR"
 echo
diff -u -r openresolv-3.6.1/dnsmasq.in openresolv-3.6.1-arch/dnsmasq.in
--- openresolv-3.6.1/dnsmasq.in	2014-10-28 23:03:14.000000000 +0100
+++ openresolv-3.6.1-arch/dnsmasq.in	2015-01-01 12:22:47.265204837 +0100
@@ -33,11 +33,12 @@
 NL="
 "
 
-: ${dnsmasq_pid:=/var/run/dnsmasq.pid}
-[ -s "$dnsmasq_pid" ] || dnsmasq_pid=/var/run/dnsmasq/dnsmasq.pid
+: ${dnsmasq_pid:=@RUNDIR@/dnsmasq.pid}
+[ -s "$dnsmasq_pid" ] || : ${dnsmasq_pid:=@RUNDIR@/dnsmasq/dnsmasq.pid}
 [ -s "$dnsmasq_pid" ] || unset dnsmasq_pid
 : ${dnsmasq_service:=dnsmasq}
 : ${dnsmasq_restart:=@RESTARTCMD ${dnsmasq_service}@}
+: ${dnsmasq_reload:=@RELOADCMD ${dnsmasq_service} ${dnsmasq_pid}@}
 newconf="# Generated by resolvconf$NL"
 newresolv="$newconf"
 
@@ -184,7 +185,7 @@
 fi
 if $dbus; then
 	if [ -s "$dnsmasq_pid" ]; then
-        	$changed || kill -HUP $(cat "$dnsmasq_pid")
+        	$changed || eval $dnsmasq_reload
 	fi
 	# Send even if empty so old servers are cleared
 	if $dbus_ex; then
diff -u -r openresolv-3.6.1/Makefile openresolv-3.6.1-arch/Makefile
--- openresolv-3.6.1/Makefile	2014-10-28 23:03:14.000000000 +0100
+++ openresolv-3.6.1-arch/Makefile	2015-01-01 12:20:34.862452655 +0100
@@ -10,11 +10,13 @@
 SBINDIR?=	/sbin
 SYSCONFDIR?=	/etc
 LIBEXECDIR?=	/libexec/resolvconf
-VARDIR?=	/var/run/resolvconf
+RUNDIR?=	/var/run
+VARDIR?=	${RUNDIR}/resolvconf
 RCDIR?=		/etc/rc.d
 RESTARTCMD?=	if ${RCDIR}/\1 status >/dev/null 2>\&1; then \
 			${RCDIR}/\1 restart; \
 		fi
+RELOADCMD?=	[ -s "\2" ] \&\& kill -HUP \\`cat "\2"\\` 2>/dev/null
 
 INSTALL?=	install
 SED?=		sed
@@ -32,17 +34,19 @@
 SED_SBINDIR=		-e 's:@SBINDIR@:${SBINDIR}:g'
 SED_SYSCONFDIR=		-e 's:@SYSCONFDIR@:${SYSCONFDIR}:g'
 SED_LIBEXECDIR=		-e 's:@LIBEXECDIR@:${LIBEXECDIR}:g'
+SED_RUNDIR=		-e 's:@RUNDIR@:${RUNDIR}:g'
 SED_VARDIR=		-e 's:@VARDIR@:${VARDIR}:g'
 SED_RCDIR=		-e 's:@RCDIR@:${RCDIR}:g'
 SED_RESTARTCMD=		-e 's:@RESTARTCMD \(.*\)@:${RESTARTCMD}:g'
+SED_RELOADCMD=		-e 's:@RELOADCMD \([^ ]*\) \(.*\)@:${RELOADCMD}:g'
 
 .SUFFIXES: .in
 
 all: ${TARGET}
 
 .in:
-	${SED}	${SED_SBINDIR} ${SED_SYSCONFDIR} ${SED_LIBEXECDIR} \
-		${SED_VARDIR} ${SED_RCDIR} ${SED_RESTARTCMD} \
+	${SED}	${SED_SBINDIR} ${SED_SYSCONFDIR} ${SED_LIBEXECDIR} ${SED_RUNDIR} \
+		${SED_VARDIR} ${SED_RCDIR} ${SED_RESTARTCMD} ${SED_RELOADCMD} \
 		$< > $@
 
 clean:
diff -u -r openresolv-3.6.1/resolvconf.8.in openresolv-3.6.1-arch/resolvconf.8.in
--- openresolv-3.6.1/resolvconf.8.in	2014-10-28 23:03:14.000000000 +0100
+++ openresolv-3.6.1-arch/resolvconf.8.in	2015-01-01 12:20:34.882452568 +0100
@@ -124,7 +124,7 @@
 This only needs to be called if the initial system boot sequence does not
 automatically clean it out; for example the state directory is moved
 somewhere other than
-.Pa /var/run .
+.Pa @RUNDIR@ .
 If used, it should only be called once as early in the system boot sequence
 as possible and before
 .Nm
diff -u -r openresolv-3.6.1/resolvconf.conf.5.in openresolv-3.6.1-arch/resolvconf.conf.5.in
--- openresolv-3.6.1/resolvconf.conf.5.in	2014-10-28 23:03:14.000000000 +0100
+++ openresolv-3.6.1-arch/resolvconf.conf.5.in	2015-01-01 12:20:34.882452568 +0100
@@ -281,6 +281,8 @@
 Command to restart the dnsmasq service.
 .It Sy dnsmasq_pid
 Location of the dnsmasq pidfile.
+.It Sy dnsmasq_reload
+Command to reload the dnsmasq service.
 .It Sy libc_service
 Location of the libc service.
 .It Sy libc_restart
@@ -297,6 +299,8 @@
 Command to restart the unbound service.
 .It Sy unbound_pid
 Location of the unbound pidfile.
+.It Sy unbound_reload
+Command to reload the unbound service.
 .El
 .Sh SEE ALSO
 .Xr resolv.conf 5 ,
diff -u -r openresolv-3.6.1/unbound.in openresolv-3.6.1-arch/unbound.in
--- openresolv-3.6.1/unbound.in	2014-10-28 23:03:14.000000000 +0100
+++ openresolv-3.6.1-arch/unbound.in	2015-01-01 12:20:34.882452568 +0100
@@ -35,9 +35,10 @@
 NL="
 "
 
-: ${unbound_pid:=/var/run/unbound.pid}
+: ${unbound_pid:=@RUNDIR@/unbound.pid}
 : ${unbound_service:=unbound}
 : ${unbound_restart:=@RESTARTCMD ${unbound_service}@}
+: ${unbound_reload:=@RELOADCMD ${unbound_service} ${unbound_pid}@}
 newconf="# Generated by resolvconf$NL"
 
 for d in $DOMAINS; do
@@ -75,11 +76,5 @@
 then
 	printf %s "$newconf" >"$unbound_conf"
 	# If we can't sent a HUP then force a restart
-	if [ -s "$unbound_pid" ]; then
-		if ! kill -HUP $(cat "$unbound_pid") 2>/dev/null; then
-			eval $unbound_restart
-		fi
-	else
-		eval $unbound_restart
-	fi
+	eval $unbound_reload || eval $unbound_restart
 fi