]> git.pld-linux.org Git - packages/binfmt-detector.git/blob - binfmt-detector.init
- revert; it's more broken
[packages/binfmt-detector.git] / binfmt-detector.init
1 #!/bin/sh
2 # $Id$
3 #
4 # binfmt-detector:      Microsoft PE executable type detector. User can run
5 #                       programs using Wine or Mono simply by clicking on them
6 #                       or typing ./file.exe
7 #
8 # chkconfig:    2345 95 10
9 #
10 # description:  Microsoft PE executable type detector. User can run
11 #               programs using Wine or Mono simply by clicking on them
12 #               or typing ./file.exe
13 #
14
15 # Source function library
16 . /etc/rc.d/init.d/functions
17
18 BINFMT_DIR='/proc/sys/fs/binfmt_misc'
19
20 start() {
21         if [ ! -f /var/lock/subsys/binfmt-detector ]; then
22                 # check if binfmt_misc is not already mounted
23                 if ! /bin/mount | grep -q "${BINFMT_DIR} type binfmt_misc"; then
24                         /bin/mount none -t binfmt_misc ${BINFMT_DIR}
25                 fi
26                 msg_starting 'binfmt-detector'/proc/sys/fs/binfmt_misc
27                 echo ':windows:M::MZ::/usr/bin/binfmt-detector.sh:' > ${BINFMT_DIR}/register
28                 echo ':windowsPE:M::PE::/usr/bin/binfmt-detector.sh:' > ${BINFMT_DIR}/register
29                 ok
30                 touch /var/lock/subsys/binfmt-detector
31         else
32                 msg_already_running 'binfmt-detector'
33         fi
34 }
35
36 stop() {
37         if [ -f /var/lock/subsys/binfmt-detector ]; then
38                 msg_stopping 'binfmt-detector'
39                 echo '-1' > ${BINFMT_DIR}/windows
40                 echo '-1' > ${BINFMT_DIR}/windowsPE
41                 rm -f /var/lock/subsys/binfmt-detector
42                 ok
43         else
44                 msg_not_running 'binfmt-detector'
45         fi
46 }
47
48 RETVAL=0
49 case "$1" in
50   start|reload|force-reload)
51         start
52         ;;
53   stop)
54         stop
55         ;;
56   restart)
57     stop
58     start
59         ;;
60   status)
61         ;;
62   *)
63         msg_usage "$0 {start|stop|restart|reload|force-reload|status}"
64         exit 3
65 esac
66
67 exit $RETVAL
This page took 0.109624 seconds and 3 git commands to generate.