]> git.pld-linux.org Git - packages/binfmt-detector.git/blob - binfmt-detector.init
- rel 2
[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 [ ! -d "$BINFMT_DIR" ] && exit 0
21
22 start() {
23         if [ ! -f /var/lock/subsys/binfmt-detector ]; then
24                 # check if binfmt_misc is not already mounted
25                 if ! grep -q "${BINFMT_DIR}" /proc/mounts; then
26                         /bin/mount none -t binfmt_misc ${BINFMT_DIR}
27                 fi
28                 msg_starting 'binfmt-detector'
29                 if [ -e "$BINFMT_DIR/register" ]; then
30                         echo ':windows:M::MZ::/usr/bin/binfmt-detector.sh:' > ${BINFMT_DIR}/register
31                         echo ':windowsPE:M::PE::/usr/bin/binfmt-detector.sh:' > ${BINFMT_DIR}/register
32                         ok
33                         touch /var/lock/subsys/binfmt-detector
34                 else
35                         fail
36                 fi
37         else
38                 msg_already_running 'binfmt-detector'
39         fi
40 }
41
42 stop() {
43         if [ -f /var/lock/subsys/binfmt-detector ]; then
44                 msg_stopping 'binfmt-detector'
45                 echo '-1' > ${BINFMT_DIR}/windows
46                 echo '-1' > ${BINFMT_DIR}/windowsPE
47                 rm -f /var/lock/subsys/binfmt-detector
48                 ok
49         else
50                 msg_not_running 'binfmt-detector'
51         fi
52 }
53
54 RETVAL=0
55 case "$1" in
56   start|reload|force-reload)
57         start
58         ;;
59   stop)
60         stop
61         ;;
62   restart)
63     stop
64     start
65         ;;
66   status)
67         ;;
68   *)
69         msg_usage "$0 {start|stop|restart|reload|force-reload|status}"
70         exit 3
71 esac
72
73 exit $RETVAL
This page took 0.110252 seconds and 3 git commands to generate.