Author: glen                         Date: Sun Nov 22 09:36:48 2009 GMT
Module: packages                      Tag: HEAD
---- Log message:
- cosmetics, add try-restart; correct runlevel

---- Files affected:
packages/binfmt-detector:
   binfmt-detector.init (1.7 -> 1.8) 

---- Diffs:

================================================================
Index: packages/binfmt-detector/binfmt-detector.init
diff -u packages/binfmt-detector/binfmt-detector.init:1.7 
packages/binfmt-detector/binfmt-detector.init:1.8
--- packages/binfmt-detector/binfmt-detector.init:1.7   Thu Mar 29 17:59:59 2007
+++ packages/binfmt-detector/binfmt-detector.init       Sun Nov 22 10:36:42 2009
@@ -1,59 +1,70 @@
 #!/bin/sh
 # $Id$
 #
-# binfmt-detector:     Microsoft PE executable type detector. User can run
-#                      programs using Wine or Mono simply by clicking on them
-#                      or typing ./file.exe
+# binfmt-detector:     Microsoft PE executable type detector.
 #
-# chkconfig:   2345 95 10
+# chkconfig:   2345 95 05
 #
-# description: Microsoft PE executable type detector. User can run
-#              programs using Wine or Mono simply by clicking on them
+# description: Microsoft PE executable type detector. User can run \
+#              programs using Wine or Mono simply by clicking on them \
 #              or typing ./file.exe
 #
 
 # Source function library
 . /etc/rc.d/init.d/functions
 
-BINFMT_DIR='/proc/sys/fs/binfmt_misc'
+BINFMT_DIR=/proc/sys/fs/binfmt_misc
 
-[ ! -d "$BINFMT_DIR" ] && exit 0
+[ -d $BINFMT_DIR ] || exit 0
 
 start() {
-       if [ ! -f /var/lock/subsys/binfmt-detector ]; then
-               # check if binfmt_misc is not already mounted
-               if ! grep -q "${BINFMT_DIR}" /proc/mounts; then
-                       /bin/mount none -t binfmt_misc ${BINFMT_DIR}
-               fi
-               msg_starting 'binfmt-detector'
-               if [ -e "$BINFMT_DIR/register" ]; then
-                       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
-                       fail
-               fi
+       if [ -f /var/lock/subsys/binfmt-detector ]; then
+               msg_already_running "binfmt detector"
+               return
+       fi
+
+       # check if binfmt_misc is not already mounted
+       if ! grep -q ${BINFMT_DIR} /proc/mounts; then
+               /bin/mount none -t binfmt_misc ${BINFMT_DIR}
+       fi
+       msg_starting "binfmt detector"
+       if [ -e "$BINFMT_DIR/register" ]; then
+               echo ':windows:M::MZ::/usr/bin/binfmt-detector:' > 
${BINFMT_DIR}/register
+               echo ':windowsPE:M::PE::/usr/bin/binfmt-detector:' > 
${BINFMT_DIR}/register
+               ok
+               touch /var/lock/subsys/binfmt-detector
        else
-               msg_already_running 'binfmt-detector'
+               fail
        fi
 }
 
 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'
+       if [ ! -f /var/lock/subsys/binfmt-detector ]; then
+               msg_not_running "binfmt detector"
+               return
        fi
+
+       msg_stopping "binfmt detector"
+       echo '-1' > ${BINFMT_DIR}/windows
+       echo '-1' > ${BINFMT_DIR}/windowsPE
+       rm -f /var/lock/subsys/binfmt-detector
+       ok
+}
+
+condrestart() {
+       if [ ! -f /var/lock/subsys/binfmt-detector ]; then
+               msg_not_running "binfmt-detector"
+               RETVAL=$1
+               return
+       fi
+
+       stop
+       start
 }
 
 RETVAL=0
 case "$1" in
-  start|reload|force-reload)
+  start|reload)
        start
        ;;
   stop)
@@ -63,10 +74,16 @@
     stop
     start
        ;;
+  try-restart)
+       condrestart 0
+       ;;
+  force-reload)
+       condrestart 7
+       ;;
   status)
        ;;
   *)
-       msg_usage "$0 {start|stop|restart|reload|force-reload|status}"
+       msg_usage "$0 
{start|stop|restart|reload|try-restart|force-reload|status}"
        exit 3
 esac
 
================================================================

---- CVS-web:
    
http://cvs.pld-linux.org/cgi-bin/cvsweb.cgi/packages/binfmt-detector/binfmt-detector.init?r1=1.7&r2=1.8&f=u

_______________________________________________
pld-cvs-commit mailing list
pld-cvs-commit@lists.pld-linux.org
http://lists.pld-linux.org/mailman/listinfo/pld-cvs-commit

Reply via email to