[Frugalware-darcs] frugalware-current: uml_utilities-20040406-4-i686

VMiklos vmiklos at frugalware.org
Sat Jun 16 04:03:44 CEST 2007


Darcsweb-Url: http://darcs.frugalware.org/darcsweb/darcsweb.cgi?r=frugalware-current;a=darcs_commitdiff;h=20070615203108-e2957-6360c34f5e170519f53a2ac238eefcd0a5cb7815.gz;

[uml_utilities-20040406-4-i686
VMiklos <vmiklos at frugalware.org>**20070615203108
 rc.uml: added rc_status()
 wait till the machines are shut down
 the timeout can be set from config :)
] {
hunk ./source/apps-extra/uml_utilities/FrugalBuild 6
-pkgrel=3
+pkgrel=4
hunk ./source/apps-extra/uml_utilities/FrugalBuild 17
-          '579a60ab33e1c6115846294b41f20ebb0071c143' \
-          '82718c7730a1a7a959ed207473c557cc7e5cf8f0')
+          'ed4b6fc81670b159eef6e275d61a3937b19311f5' \
+          '53c415d9f3231ed37a35caa96c36bdb2850a59ba')
hunk ./source/apps-extra/uml_utilities/rc.uml 22
-	if [ -n "`type -p linux`" -a "$(eval ${pid})" == "" ]; then
+	if [[ "$(eval ${pid})" == "" ]] ; then
hunk ./source/apps-extra/uml_utilities/rc.uml 37
+rc_status()
+{
+	msg "$daemon are"
+	if ! ls /var/run/uml*.pid &>/dev/null; then
+		ok 998
+		return
+	fi
+	# if one of the machines is running then the service is on
+	for i in /var/run/uml*.pid
+	do
+		if [ -d "/proc/`cat $i`" ]; then
+			ok 997
+			return 0
+		fi
+	done
+	ok 998
+	return 1
+}
+
hunk ./source/apps-extra/uml_utilities/rc.uml 58
+	# defaults
+	SHUTDOWN_POLL=2
+	SHUTDOWN_TIMEOUT=300
+	source /etc/sysconfig/uml
hunk ./source/apps-extra/uml_utilities/rc.uml 63
-	if [ "$(eval ${pid})" != "" ] ; then
+	if [[ "$(eval ${pid})" != "" ]] ; then
+		# send ctrl-alt-del to each machine
hunk ./source/apps-extra/uml_utilities/rc.uml 69
-			rm -f $i
hunk ./source/apps-extra/uml_utilities/rc.uml 70
-		ok $?
+		# now wait till they are shut down
+		TIME=0
+		while true
+		do
+			if ! rc_status &>/dev/null; then
+				rm -f /var/run/uml*.pid
+				ok 0
+				return
+			fi
+			echo -n .
+			sleep $SHUTDOWN_POLL
+			TIME=`expr $TIME + $SHUTDOWN_POLL`
+			if [ $TIME -gt $SHUTDOWN_TIMEOUT ]; then
+				break
+			fi
+		done
+		rm -f /var/run/uml*.pid
+		ok 1
hunk ./source/apps-extra/uml_utilities/rc.uml 95
+# vim: ft=sh
+
hunk ./source/apps-extra/uml_utilities/uml 9
+
+# how often in seconds rc.uml polls to check if the machines are shut down
+SHUTDOWN_POLL=2
+# don't wait more than this for machines to properly shut down
+SHUTDOWN_TIMEOUT=300
}


More information about the Frugalware-darcs mailing list