updated on Thu Jan 26 00:18:00 UTC 2012
[aur-mirror.git] / xen-4.2 / archinit.patch
blob5a89b549f0863e4baa29712ecb42ea94ee8a9c95
1 diff -Naur orig.xen-4.1.1//tools/hotplug/Linux/init.d/xencommons xen-4.1.1//tools/hotplug/Linux/init.d/xencommons
2 --- orig.xen-4.1.1//tools/hotplug/Linux/init.d/xencommons 2011-07-03 03:08:44.953747064 -0700
3 +++ xen-4.1.1//tools/hotplug/Linux/init.d/xencommons 2011-07-05 13:47:54.627029164 -0700
4 @@ -18,6 +18,9 @@
5 # Description: Starts and stops the daemons neeeded for xl/xend
6 ### END INIT INFO
8 +. /etc/rc.conf
9 +. /etc/rc.d/functions
11 if [ -d /etc/sysconfig ]; then
12 xencommons_config=/etc/sysconfig
13 else
14 @@ -26,7 +29,7 @@
16 test -f $xencommons_config/xencommons && . $xencommons_config/xencommons
18 -XENCONSOLED_PIDFILE=/var/run/xenconsoled.pid
19 +XENCONSOLED_PIDFILE=/run/daemons/xenconsoled.pid
20 shopt -s extglob
22 if test "x$1" = xstart && \
23 @@ -60,33 +64,39 @@
24 time=$(($time+1))
25 sleep 1
26 done
27 - echo
29 # Exit if we timed out
30 if ! [ $time -lt $timeout ] ; then
31 - echo Could not start xenstored
32 + #echo Could not start xenstored
33 + stat_fail
34 exit 1
36 + stat_done
38 - echo Setting domain 0 name...
39 + stat_busy "Setting domain 0 name..."
40 xenstore-write "/local/domain/0/name" "Domain-0"
41 + stat_done
44 - echo Starting xenconsoled...
45 + #echo Starting xenconsoled...
46 + stat_busy "Starting xenconsoled"
47 test -z "$XENCONSOLED_TRACE" || XENCONSOLED_ARGS=" --log=$XENCONSOLED_TRACE"
48 xenconsoled --pid-file=$XENCONSOLED_PIDFILE $XENCONSOLED_ARGS
49 test -z "$XENBACKENDD_DEBUG" || XENBACKENDD_ARGS="-d"
50 test "`uname`" != "NetBSD" || xenbackendd $XENBACKENDD_ARGS
51 + stat_done
52 + add_daemon xencommons
54 do_stop () {
55 - echo Stopping xenconsoled
56 + stat_busy "Stopping xenconsoled"
57 if read 2>/dev/null <$XENCONSOLED_PIDFILE pid; then
58 kill $pid
59 while kill -9 $pid >/dev/null 2>&1; do sleep 0.1; done
60 rm -f $XENCONSOLED_PIDFILE
62 + stat_done
64 - echo WARNING: Not stopping xenstored, as it cannot be restarted.
65 + printhl "WARNING: Not stopping xenstored, as it cannot be restarted."
66 + rm_daemon xencommons
69 case "$1" in
70 diff -Naur orig.xen-4.1.1//tools/hotplug/Linux/init.d/xend xen-4.1.1//tools/hotplug/Linux/init.d/xend
71 --- orig.xen-4.1.1//tools/hotplug/Linux/init.d/xend 2011-07-03 03:08:44.953747064 -0700
72 +++ xen-4.1.1//tools/hotplug/Linux/init.d/xend 2011-07-05 01:47:40.981951191 -0700
73 @@ -18,6 +18,10 @@
74 # Description: Starts and stops the Xen control daemon.
75 ### END INIT INFO
77 +. /etc/rc.conf
78 +. /etc/rc.d/functions
81 shopt -s extglob
83 # Wait for Xend to be up
84 @@ -37,23 +41,30 @@
85 case "$1" in
86 start)
87 if [ -z "`ps -C xenconsoled -o pid=`" ]; then
88 - echo "xencommons should be started first."
89 + printhl "xencommons should be started first."
90 exit 1
92 # mkdir shouldn't be needed as most distros have this already created. Default to using subsys.
93 # See docs/misc/distro_mapping.txt
94 - mkdir -p /var/lock
95 - if [ -d /var/lock/subsys ] ; then
96 - touch /var/lock/subsys/xend
97 + if [ -d /run/lock/subsys ] ; then
98 + touch /run/lock/subsys/xend
99 else
100 - touch /var/lock/xend
101 + touch /run/lock/xend
103 + stat_busy "Starting xend"
104 xend start
105 await_daemons_up
106 + stat_done
107 + add_daemon xend
111 stop)
112 + stat_busy "Stopping xend"
113 xend stop
114 - rm -f /var/lock/subsys/xend /var/lock/xend
115 + rm -f /run/lock/xend /var/lock/xend
116 + stat_done
117 + rm_daemon xend
119 status)
120 xend status
121 @@ -62,8 +73,10 @@
122 xend reload
124 restart|force-reload)
125 + stat_busy "Restarting xend"
126 xend restart
127 await_daemons_up
128 + stat_done
131 # do not advertise unreasonable commands that there is no reason
132 diff -Naur orig.xen-4.1.1//tools/hotplug/Linux/init.d/xendomains xen-4.1.1//tools/hotplug/Linux/init.d/xendomains
133 --- orig.xen-4.1.1//tools/hotplug/Linux/init.d/xendomains 2011-07-03 03:08:44.953747064 -0700
134 +++ xen-4.1.1//tools/hotplug/Linux/init.d/xendomains 2011-07-05 13:46:36.208222760 -0700
135 @@ -26,6 +26,9 @@
136 # Description: Start / stop domains automatically when domain 0
137 # boots / shuts down.
138 ### END INIT INFO
139 +. /etc/rc.conf
140 +. /etc/rc.d/functions
143 CMD=xm
144 $CMD list &> /dev/null
145 @@ -46,93 +49,52 @@
146 exit 0
149 -# See docs/misc/distro_mapping.txt
150 -if [ -d /var/lock/subsys ]; then
151 - LOCKFILE=/var/lock/subsys/xendomains
152 -else
153 - LOCKFILE=/var/lock/xendomains
156 -if [ -d /etc/sysconfig ]; then
157 - XENDOM_CONFIG=/etc/sysconfig/xendomains
158 -else
159 - XENDOM_CONFIG=/etc/default/xendomains
161 +LOCKFILE=/run/lock/xendomains
162 +XENDOM_CONFIG=/etc/default/xendomains
164 -test -r $XENDOM_CONFIG || { echo "$XENDOM_CONFIG not existing";
165 +test -r $XENDOM_CONFIG || {
166 + printhl "$XENDOM_CONFIG not existing";
167 if [ "$1" = "stop" ]; then exit 0;
168 else exit 6; fi; }
170 . $XENDOM_CONFIG
172 -# Use the SUSE rc_ init script functions;
173 -# emulate them on LSB, RH and other systems
174 -if test -e /etc/rc.status; then
175 - # SUSE rc script library
176 - . /etc/rc.status
177 -else
178 - _cmd=$1
179 - declare -a _SMSG
180 - if test "${_cmd}" = "status"; then
181 +_cmd=$1
182 +declare -a _SMSG
183 +if test "${_cmd}" = "status"; then
184 _SMSG=(running dead dead unused unknown)
185 _RC_UNUSED=3
186 - else
187 +else
188 _SMSG=(done failed failed missed failed skipped unused failed failed)
189 _RC_UNUSED=6
190 - fi
191 - if test -e /etc/init.d/functions; then
192 - # REDHAT
193 - . /etc/init.d/functions
194 - echo_rc()
196 - #echo -n " [${_SMSG[${_RC_RV}]}] "
197 - if test ${_RC_RV} = 0; then
198 - success " [${_SMSG[${_RC_RV}]}] "
199 - else
200 - failure " [${_SMSG[${_RC_RV}]}] "
201 - fi
203 - elif test -e /lib/lsb/init-functions; then
204 - # LSB
205 - . /lib/lsb/init-functions
206 - if alias log_success_msg >/dev/null 2>/dev/null; then
207 - echo_rc()
209 - echo " [${_SMSG[${_RC_RV}]}] "
211 - else
212 - echo_rc()
214 - if test ${_RC_RV} = 0; then
215 - log_success_msg " [${_SMSG[${_RC_RV}]}] "
216 - else
217 - log_failure_msg " [${_SMSG[${_RC_RV}]}] "
218 - fi
220 - fi
221 - else
222 - # emulate it
223 - echo_rc()
225 - echo " [${_SMSG[${_RC_RV}]}] "
227 - fi
228 - rc_reset() { _RC_RV=0; }
229 - rc_failed()
235 +echo_rc() {
236 + echo
237 + printhl "Return Status: ${_SMSG[${_RC_RV}]}"
241 +rc_reset() { _RC_RV=0; }
244 +rc_failed() {
245 if test -z "$1"; then
246 - _RC_RV=1;
247 + _RC_RV=1;
248 elif test "$1" != "0"; then
249 - _RC_RV=$1;
250 - fi
251 + _RC_RV=$1;
252 + fi
253 return ${_RC_RV}
255 - rc_check()
259 +rc_check() {
260 return rc_failed $?
261 - }
262 - rc_status()
267 +rc_status() {
268 rc_failed $?
269 if test "$1" = "-r"; then _RC_RV=0; shift; fi
270 if test "$1" = "-s"; then rc_failed 5; echo_rc; rc_failed 3; shift; fi
271 @@ -140,26 +102,24 @@
272 if test "$1" = "-v"; then echo_rc; shift; fi
273 if test "$1" = "-r"; then _RC_RV=0; shift; fi
274 return ${_RC_RV}
276 - rc_exit() { exit ${_RC_RV}; }
277 - rc_active()
282 +rc_exit() { exit ${_RC_RV}; }
285 +rc_active() {
286 if test -z "$RUNLEVEL"; then read RUNLEVEL REST < <(/sbin/runlevel); fi
287 if test -e /etc/init.d/S[0-9][0-9]${1}; then return 0; fi
288 return 1
293 -if ! which usleep >&/dev/null
294 -then
295 - usleep()
297 - if [ -n "$1" ]
298 - then
299 - sleep $(( $1 / 1000000 ))
300 - fi
303 +usleep() {
304 + if [ -n "$1" ]
305 + then
306 + sleep $(( $1 / 1000000 ))
307 + fi
310 # Reset status of this service
311 rc_reset
312 @@ -235,10 +195,12 @@
313 start()
315 if [ -f $LOCKFILE ]; then
316 - echo -e "xendomains already running (lockfile exists)"
317 + stat_busy "xendomains already running (lockfile exists)"
318 + stat_fail
319 return;
322 + printhl "Starting Xen Domains"
323 saved_domains=" "
324 if [ "$XENDOMAINS_RESTORE" = "true" ] &&
325 contains_something "$XENDOMAINS_SAVE"
326 @@ -299,6 +261,7 @@
328 done
330 + add_daemon xendomains
333 all_zombies()
334 @@ -352,7 +315,7 @@
335 if test "$XENDOMAINS_AUTO_ONLY" = "true"; then
336 rdnames
338 - echo -n "Shutting down Xen domains:"
339 + printhl "Shutting down Xen domains"
340 name=;id=
341 while read LN; do
342 parseln "$LN" || continue
343 @@ -465,6 +428,7 @@
344 rm -f $LOCKFILE
346 exec 2>&3
347 + rm_daemon xendomains
350 check_domain_up()
351 diff -Naur orig.xen-4.1.1//tools/hotplug/Linux/init.d/xen-watchdog xen-4.1.1//tools/hotplug/Linux/init.d/xen-watchdog
352 --- orig.xen-4.1.1//tools/hotplug/Linux/init.d/xen-watchdog 2011-07-03 03:08:44.957080397 -0700
353 +++ xen-4.1.1//tools/hotplug/Linux/init.d/xen-watchdog 2011-07-05 13:20:22.515289867 -0700
354 @@ -17,49 +17,32 @@
355 ### END INIT INFO
358 +. /etc/rc.conf
359 +. /etc/rc.d/functions
361 DAEMON=/usr/sbin/xenwatchdogd
362 base=$(basename $DAEMON)
363 +initname="xen-watchdog"
365 -# Source function library.
366 -if [ -e /etc/init.d/functions ] ; then
367 - . /etc/init.d/functions
368 -elif [ -e /lib/lsb/init-functions ] ; then
369 - . /lib/lsb/init-functions
370 - success () {
371 - log_success_msg $*
373 - failure () {
374 - log_failure_msg $*
376 -else
377 - success () {
378 - echo $*
380 - failure () {
381 - echo $*
385 start() {
386 local r
387 - echo -n $"Starting domain watchdog daemon: "
388 + stat_busy "Starting domain watchdog daemon"
390 $DAEMON 30 15
391 r=$?
392 - [ "$r" -eq 0 ] && success $"$base startup" || failure $"$base startup"
393 - echo
394 + [ "$r" -eq 0 ] && stat_done ; add_daemon $initname || stat_fail
396 return $r
399 stop() {
400 local r
401 - echo -n $"Stopping domain watchdog daemon: "
402 + stat_busy "Stopping domain watchdog daemon"
404 killall -USR1 $base 2>/dev/null
405 r=$?
406 - [ "$r" -eq 0 ] && success $"$base stop" || failure $"$base stop"
407 - echo
408 + [ "$r" -eq 0 ] && stat_done ; rm_daemon $initname || stat_fail
410 return $r