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