]> git.pld-linux.org Git - packages/binfmt-detector.git/blobdiff - binfmt-detector.init
- revert; it's more broken
[packages/binfmt-detector.git] / binfmt-detector.init
index 07c561bcec962815e22c5cb0ee3a06bb22c337d3..b1e8ed5df1d61bc3efad658808199bba2444dddf 100644 (file)
@@ -3,13 +3,13 @@
 #
 # binfmt-detector:     Microsoft PE executable type detector. User can run
 #                      programs using Wine or Mono simply by clicking on them
-#                      or typing /file.exe
+#                      or typing ./file.exe
 #
 # chkconfig:   2345 95 10
 #
 # description: Microsoft PE executable type detector. User can run
 #              programs using Wine or Mono simply by clicking on them
-#              or typing /file.exe
+#              or typing ./file.exe
 #
 
 # Source function library
 
 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
-                       /bin/mount none -t binfmt_misc /proc/sys/fs/binfmt_misc
+                       /bin/mount none -t binfmt_misc ${BINFMT_DIR}
                fi
-               msg_starting "binfmt-detector"
+               msg_starting 'binfmt-detector'/proc/sys/fs/binfmt_misc
                echo ':windows:M::MZ::/usr/bin/binfmt-detector.sh:' > ${BINFMT_DIR}/register
                echo ':windowsPE:M::PE::/usr/bin/binfmt-detector.sh:' > ${BINFMT_DIR}/register
                ok
                touch /var/lock/subsys/binfmt-detector
        else
-               msg_already_running "binfmt-detector"
+               msg_already_running 'binfmt-detector'
        fi
-       ;;
-  stop)
-        if [ -f /var/lock/subsys/binfmt-detector ]; then
-               msg_stopping "binfmt-detector"
-               echo "-1" > ${BINFMT_DIR}/windows
-               echo "-1" > ${BINFMT_DIR}/windowsPE
+}
+
+stop() {
+       if [ -f /var/lock/subsys/binfmt-detector ]; then
+               msg_stopping 'binfmt-detector'
+               echo '-1' > ${BINFMT_DIR}/windows
+               echo '-1' > ${BINFMT_DIR}/windowsPE
                rm -f /var/lock/subsys/binfmt-detector
                ok
        else
-               msg_not_running "binfmt-detector"
+               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 @@ case "$1" in
        exit 3
 esac
 
-exit 0
+exit $RETVAL
This page took 0.028817 seconds and 4 git commands to generate.