]>
Commit | Line | Data |
---|---|---|
aab3d22f | 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 | |
802a6ec3 | 6 | # or typing ./file.exe |
aab3d22f | 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 | |
802a6ec3 | 12 | # or typing ./file.exe |
aab3d22f | 13 | # |
14 | ||
15 | # Source function library | |
16 | . /etc/rc.d/init.d/functions | |
17 | ||
18 | BINFMT_DIR='/proc/sys/fs/binfmt_misc' | |
19 | ||
58bd9bf1 AM |
20 | [ ! -e "$BINFMT_DIR" ] && exit 0 |
21 | ||
a62c069c | 22 | start() { |
aab3d22f | 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 | |
58bd9bf1 | 26 | /bin/mount none -t binfmt_misc ${BINFMT_DIR} |
aab3d22f | 27 | fi |
802a6ec3 | 28 | msg_starting 'binfmt-detector' |
aab3d22f | 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 | |
802a6ec3 | 34 | msg_already_running 'binfmt-detector' |
aab3d22f | 35 | fi |
a62c069c ER |
36 | } |
37 | ||
38 | stop() { | |
39 | if [ -f /var/lock/subsys/binfmt-detector ]; then | |
802a6ec3 | 40 | msg_stopping 'binfmt-detector' |
a62c069c ER |
41 | echo '-1' > ${BINFMT_DIR}/windows |
42 | echo '-1' > ${BINFMT_DIR}/windowsPE | |
aab3d22f | 43 | rm -f /var/lock/subsys/binfmt-detector |
44 | ok | |
45 | else | |
802a6ec3 | 46 | msg_not_running 'binfmt-detector' |
aab3d22f | 47 | fi |
a62c069c ER |
48 | } |
49 | ||
50 | RETVAL=0 | |
51 | case "$1" in | |
52 | start|reload|force-reload) | |
53 | start | |
54 | ;; | |
55 | stop) | |
56 | stop | |
aab3d22f | 57 | ;; |
58 | restart) | |
a62c069c ER |
59 | stop |
60 | start | |
aab3d22f | 61 | ;; |
62 | status) | |
63 | ;; | |
64 | *) | |
65 | msg_usage "$0 {start|stop|restart|reload|force-reload|status}" | |
66 | exit 3 | |
67 | esac | |
68 | ||
a62c069c | 69 | exit $RETVAL |