SOURCES: binfmt-detector.init - use functions

glen glen at pld-linux.org
Tue Sep 26 20:56:31 CEST 2006


Author: glen                         Date: Tue Sep 26 18:56:31 2006 GMT
Module: SOURCES                       Tag: HEAD
---- Log message:
- use functions

---- Files affected:
SOURCES:
   binfmt-detector.init (1.1 -> 1.2) 

---- Diffs:

================================================================
Index: SOURCES/binfmt-detector.init
diff -u SOURCES/binfmt-detector.init:1.1 SOURCES/binfmt-detector.init:1.2
--- SOURCES/binfmt-detector.init:1.1	Mon May  1 17:00:43 2006
+++ SOURCES/binfmt-detector.init	Tue Sep 26 20:56:26 2006
@@ -17,9 +17,7 @@
 
 BINFMT_DIR='/proc/sys/fs/binfmt_misc'
 
-
-case "$1" in
-  start|reload|force-reload)
+start() {
 	if [ ! -f /var/lock/subsys/binfmt-detector ]; then
 		# check if binfmt_misc is not already mounted
 		if ! /bin/mount | grep -q "${BINFMT_DIR} type binfmt_misc"; then
@@ -33,21 +31,31 @@
 	else
 		msg_already_running "binfmt-detector"
 	fi
-	;;
-  stop)
-        if [ -f /var/lock/subsys/binfmt-detector ]; then
+}
+
+stop() {
+	if [ -f /var/lock/subsys/binfmt-detector ]; then
 		msg_stopping "binfmt-detector"
-		echo "-1" > ${BINFMT_DIR}/windows
-		echo "-1" > ${BINFMT_DIR}/windowsPE
+		echo '-1' > ${BINFMT_DIR}/windows
+		echo '-1' > ${BINFMT_DIR}/windowsPE
 		rm -f /var/lock/subsys/binfmt-detector
 		ok
 	else
 		msg_not_running "binfmt-detector"
 	fi
+}
+
+RETVAL=0
+case "$1" in
+  start|reload|force-reload)
+  	start
+	;;
+  stop)
+  	stop
 	;;
   restart)
-    $0 stop;
-    $0 start;
+    stop
+    start
 	;;
   status)
 	;;
@@ -56,4 +64,4 @@
 	exit 3
 esac
 
-exit 0
+exit $RETVAL
================================================================

---- CVS-web:
    http://cvs.pld-linux.org/SOURCES/binfmt-detector.init?r1=1.1&r2=1.2&f=u



More information about the pld-cvs-commit mailing list