4 # binfmt-detector: Microsoft PE executable type detector. User can run
5 # programs using Wine or Mono simply by clicking on them
8 # chkconfig: 2345 95 10
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
15 # Source function library
16 . /etc/rc.d/init.d/functions
18 BINFMT_DIR='/proc/sys/fs/binfmt_misc'
20 [ ! -d "$BINFMT_DIR" ] && exit 0
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}
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
33 touch /var/lock/subsys/binfmt-detector
38 msg_already_running 'binfmt-detector'
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
50 msg_not_running 'binfmt-detector'
56 start|reload|force-reload)
69 msg_usage "$0 {start|stop|restart|reload|force-reload|status}"