summaryrefslogtreecommitdiff
path: root/kernels/xen/parabolainit.patch
blob: 645a66edda63d15aa7c8254ca0dec14d120370a3 (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
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
diff -Naur orig.xen-4.1.1//tools/hotplug/Linux/init.d/xencommons xen-4.1.1//tools/hotplug/Linux/init.d/xencommons
--- orig.xen-4.1.1//tools/hotplug/Linux/init.d/xencommons	2011-07-03 03:08:44.953747064 -0700
+++ xen-4.1.1//tools/hotplug/Linux/init.d/xencommons	2011-07-05 13:47:54.627029164 -0700
@@ -18,6 +18,9 @@
 # Description:       Starts and stops the daemons neeeded for xl/xend
 ### END INIT INFO
 
+. /etc/rc.conf
+. /etc/rc.d/functions
+
 if [ -d /etc/sysconfig ]; then
 	xencommons_config=/etc/sysconfig
 else
@@ -26,7 +29,7 @@
 
 test -f $xencommons_config/xencommons && . $xencommons_config/xencommons
 
-XENCONSOLED_PIDFILE=/var/run/xenconsoled.pid
+XENCONSOLED_PIDFILE=/run/daemons/xenconsoled.pid
 shopt -s extglob
 
 if test "x$1" = xstart && \
@@ -51,8 +54,9 @@
 		rm -f "$XENSTORED_ROOTDIR"/tdb* &>/dev/null
 		test -z "$XENSTORED_TRACE" || XENSTORED_ARGS=" -T /var/log/xen/xenstored-trace.log"
 
-		echo -n Starting xenstored...
-		xenstored --pid-file=/var/run/xenstored.pid $XENSTORED_ARGS
+		#echo -n Starting xenstored...
+		stat_busy "Starting xenstored"
+		xenstored --pid-file=/run/daemons/xenstored.pid $XENSTORED_ARGS
 
 		# Wait for xenstored to actually come up, timing out after 30 seconds
                 while [ $time -lt $timeout ] && ! `xenstore-read -s / >/dev/null 2>&1` ; do
@@ -60,33 +64,39 @@
 		    time=$(($time+1))
                     sleep 1
                 done
-		echo
-
 		# Exit if we timed out
 		if ! [ $time -lt $timeout ] ; then
-		    echo Could not start xenstored
+		    #echo Could not start xenstored
+                    stat_fail
 		    exit 1
 		fi
+                stat_done
 
-		echo Setting domain 0 name...
+		stat_busy "Setting domain 0 name..."
 		xenstore-write "/local/domain/0/name" "Domain-0"
+		stat_done
 	fi
 
-	echo Starting xenconsoled...
+	#echo Starting xenconsoled...
+	stat_busy "Starting xenconsoled"
 	test -z "$XENCONSOLED_TRACE" || XENCONSOLED_ARGS=" --log=$XENCONSOLED_TRACE"
 	xenconsoled --pid-file=$XENCONSOLED_PIDFILE $XENCONSOLED_ARGS
 	test -z "$XENBACKENDD_DEBUG" || XENBACKENDD_ARGS="-d"
 	test "`uname`" != "NetBSD" || xenbackendd $XENBACKENDD_ARGS
+	stat_done
+	add_daemon xencommons
 }
 do_stop () {
-        echo Stopping xenconsoled
+         stat_busy "Stopping xenconsoled"
 	if read 2>/dev/null <$XENCONSOLED_PIDFILE pid; then
 		kill $pid
 		while kill -9 $pid >/dev/null 2>&1; do sleep 0.1; done
 		rm -f $XENCONSOLED_PIDFILE
 	fi
+	stat_done
 
-	echo WARNING: Not stopping xenstored, as it cannot be restarted.
+	printhl "WARNING: Not stopping xenstored, as it cannot be restarted."
+        rm_daemon xencommons
 }
 
 case "$1" in
diff -Naur orig.xen-4.1.1//tools/hotplug/Linux/init.d/xend xen-4.1.1//tools/hotplug/Linux/init.d/xend
--- orig.xen-4.1.1//tools/hotplug/Linux/init.d/xend	2011-07-03 03:08:44.953747064 -0700
+++ xen-4.1.1//tools/hotplug/Linux/init.d/xend	2011-07-05 01:47:40.981951191 -0700
@@ -18,6 +18,10 @@
 # Description:       Starts and stops the Xen control daemon.
 ### END INIT INFO
 
+. /etc/rc.conf
+. /etc/rc.d/functions
+
+
 shopt -s extglob
 
 # Wait for Xend to be up
@@ -37,23 +41,30 @@
 case "$1" in
   start)
 	if [ -z "`ps -C xenconsoled -o pid=`" ]; then
-		echo "xencommons should be started first."
+	 printhl "xencommons should be started first."
 		exit 1
 	fi
 	# mkdir shouldn't be needed as most distros have this already created. Default to using subsys.
 	# See docs/misc/distro_mapping.txt
-	mkdir -p /var/lock
-	if [ -d /var/lock/subsys ] ; then
-		touch /var/lock/subsys/xend
+	if [ -d /run/lock/subsys ] ; then
+		touch /run/lock/subsys/xend
 	else
-		touch /var/lock/xend
+		touch /run/lock/xend
 	fi
+	stat_busy "Starting xend"
 	xend start
 	await_daemons_up
+	stat_done
+	add_daemon xend
 	;;
+
+
   stop)
+   stat_busy "Stopping xend"
 	xend stop
-	rm -f /var/lock/subsys/xend /var/lock/xend
+	rm -f /run/lock/xend /var/lock/xend
+	stat_done
+	rm_daemon xend
 	;;
   status)
 	xend status
@@ -62,8 +73,10 @@
         xend reload
         ;;
   restart|force-reload)
+   stat_busy "Restarting xend"
 	xend restart
 	await_daemons_up
+	stat_done
 	;;
   *)
 	# do not advertise unreasonable commands that there is no reason
diff -Naur orig.xen-4.1.1//tools/hotplug/Linux/init.d/xendomains xen-4.1.1//tools/hotplug/Linux/init.d/xendomains
--- orig.xen-4.1.1//tools/hotplug/Linux/init.d/xendomains	2011-07-03 03:08:44.953747064 -0700
+++ xen-4.1.1//tools/hotplug/Linux/init.d/xendomains	2011-07-05 13:46:36.208222760 -0700
@@ -26,6 +26,9 @@
 # Description:       Start / stop domains automatically when domain 0 
 #                    boots / shuts down.
 ### END INIT INFO
+. /etc/rc.conf
+. /etc/rc.d/functions
+
 
 CMD=xm
 $CMD list &> /dev/null
@@ -46,93 +49,52 @@
 	exit 0
 fi
 
-# See docs/misc/distro_mapping.txt
-if [ -d /var/lock/subsys ]; then
-	LOCKFILE=/var/lock/subsys/xendomains
-else
-	LOCKFILE=/var/lock/xendomains
-fi
-
-if [ -d /etc/sysconfig ]; then
-	XENDOM_CONFIG=/etc/sysconfig/xendomains
-else
-	XENDOM_CONFIG=/etc/default/xendomains
-fi
+LOCKFILE=/run/lock/xendomains
+XENDOM_CONFIG=/etc/default/xendomains
 
-test -r $XENDOM_CONFIG || { echo "$XENDOM_CONFIG not existing";
+test -r $XENDOM_CONFIG || { 
+	printhl "$XENDOM_CONFIG not existing";
 	if [ "$1" = "stop" ]; then exit 0;
 	else exit 6; fi; }
 
 . $XENDOM_CONFIG
 
-# Use the SUSE rc_ init script functions;
-# emulate them on LSB, RH and other systems
-if test -e /etc/rc.status; then
-    # SUSE rc script library
-    . /etc/rc.status
-else    
-    _cmd=$1
-    declare -a _SMSG
-    if test "${_cmd}" = "status"; then
+_cmd=$1
+declare -a _SMSG
+if test "${_cmd}" = "status"; then
 	_SMSG=(running dead dead unused unknown)
 	_RC_UNUSED=3
-    else
+else
 	_SMSG=(done failed failed missed failed skipped unused failed failed)
 	_RC_UNUSED=6
-    fi
-    if test -e /etc/init.d/functions; then
-	# REDHAT
-	. /etc/init.d/functions
-	echo_rc()
-	{
-	    #echo -n "  [${_SMSG[${_RC_RV}]}] "
-	    if test ${_RC_RV} = 0; then
-		success "  [${_SMSG[${_RC_RV}]}] "
-	    else
-		failure "  [${_SMSG[${_RC_RV}]}] "
-	    fi
-	}
-    elif test -e /lib/lsb/init-functions; then
-	# LSB    
-    	. /lib/lsb/init-functions
-        if alias log_success_msg >/dev/null 2>/dev/null; then
-	  echo_rc()
-	  {
-	       echo "  [${_SMSG[${_RC_RV}]}] "
-	  }
-        else
-	  echo_rc()
-	  {
-	    if test ${_RC_RV} = 0; then
-		log_success_msg "  [${_SMSG[${_RC_RV}]}] "
-	    else
-		log_failure_msg "  [${_SMSG[${_RC_RV}]}] "
-	    fi
-	  }
-        fi
-    else    
-	# emulate it
-	echo_rc()
-	{
-	    echo "  [${_SMSG[${_RC_RV}]}] "
-	}
-    fi
-    rc_reset() { _RC_RV=0; }
-    rc_failed()
-    {
+fi
+
+
+
+echo_rc() {
+	echo
+	printhl "Return Status: ${_SMSG[${_RC_RV}]}"
+}
+
+
+rc_reset() { _RC_RV=0; }
+
+
+rc_failed() {
 	if test -z "$1"; then 
-	    _RC_RV=1;
+		_RC_RV=1;
 	elif test "$1" != "0"; then 
-	    _RC_RV=$1; 
-    	fi
+		_RC_RV=$1; 
+	fi
 	return ${_RC_RV}
-    }
-    rc_check()
-    {
+}
+
+rc_check() {
 	return rc_failed $?
-    }	
-    rc_status()
-    {
+}	
+
+
+rc_status() {
 	rc_failed $?
 	if test "$1" = "-r"; then _RC_RV=0; shift; fi
 	if test "$1" = "-s"; then rc_failed 5; echo_rc; rc_failed 3; shift; fi
@@ -140,26 +102,24 @@
 	if test "$1" = "-v"; then echo_rc; shift; fi
 	if test "$1" = "-r"; then _RC_RV=0; shift; fi
 	return ${_RC_RV}
-    }
-    rc_exit() { exit ${_RC_RV}; }
-    rc_active() 
-    {
+}
+
+
+rc_exit() { exit ${_RC_RV}; }
+
+
+rc_active() {
 	if test -z "$RUNLEVEL"; then read RUNLEVEL REST < <(/sbin/runlevel); fi
 	if test -e /etc/init.d/S[0-9][0-9]${1}; then return 0; fi
 	return 1
-    }
-fi
+}
 
-if ! which usleep >&/dev/null
-then
-  usleep()
-  {
-    if [ -n "$1" ]
-    then
-      sleep $(( $1 / 1000000 ))
-    fi
-  }
-fi
+usleep() {
+	if [ -n "$1" ]
+	then
+	  sleep $(( $1 / 1000000 ))
+	fi
+}
 
 # Reset status of this service
 rc_reset
@@ -235,10 +195,12 @@
 start() 
 {
     if [ -f $LOCKFILE ]; then 
-	echo -e "xendomains already running (lockfile exists)"
+	stat_busy "xendomains already running (lockfile exists)"
+	stat_fail
 	return; 
     fi
 
+    printhl "Starting Xen Domains"
     saved_domains=" "
     if [ "$XENDOMAINS_RESTORE" = "true" ] &&
        contains_something "$XENDOMAINS_SAVE"
@@ -299,6 +261,7 @@
 	    fi
 	done
     fi
+    add_daemon xendomains
 }
 
 all_zombies()
@@ -352,7 +315,7 @@
     if test "$XENDOMAINS_AUTO_ONLY" = "true"; then
 	rdnames
     fi
-    echo -n "Shutting down Xen domains:"
+    printhl "Shutting down Xen domains"
     name=;id=
     while read LN; do
 	parseln "$LN" || continue
@@ -465,6 +428,7 @@
     rm -f $LOCKFILE
     
     exec 2>&3
+    rm_daemon xendomains
 }
 
 check_domain_up()
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
--- orig.xen-4.1.1//tools/hotplug/Linux/init.d/xen-watchdog	2011-07-03 03:08:44.957080397 -0700
+++ xen-4.1.1//tools/hotplug/Linux/init.d/xen-watchdog	2011-07-05 13:20:22.515289867 -0700
@@ -17,49 +17,32 @@
 ### END INIT INFO
 #
 
+. /etc/rc.conf
+. /etc/rc.d/functions
+
 DAEMON=/usr/sbin/xenwatchdogd
 base=$(basename $DAEMON)
+initname="xen-watchdog"
 
-# Source function library.
-if [ -e  /etc/init.d/functions ] ; then
-    . /etc/init.d/functions
-elif [ -e /lib/lsb/init-functions ] ; then
-    . /lib/lsb/init-functions
-    success () {
-        log_success_msg $*
-    }
-    failure () {
-        log_failure_msg $*
-    }
-else
-    success () {
-        echo $*
-    }
-    failure () {
-        echo $*
-    }
-fi
 
 start() {
 	local r
-	echo -n $"Starting domain watchdog daemon: "
+	stat_busy "Starting domain watchdog daemon"
 
 	$DAEMON 30 15
 	r=$?
-	[ "$r" -eq 0 ] && success $"$base startup" || failure $"$base startup"
-	echo
+	[ "$r" -eq 0 ] && stat_done ; add_daemon $initname || stat_fail
 
 	return $r
 }
 
 stop() {
 	local r
-	echo -n $"Stopping domain watchdog daemon: "
+	stat_busy "Stopping domain watchdog daemon"
 
 	killall -USR1 $base 2>/dev/null
 	r=$?
-	[ "$r" -eq 0 ] && success $"$base stop" || failure $"$base stop"
-	echo
+	[ "$r" -eq 0 ] && stat_done ; rm_daemon $initname || stat_fail
 
 	return $r
 }