4 # binfmt-detector: Microsoft PE executable type detector.
6 # chkconfig: 2345 95 05
8 # description: Microsoft PE executable type detector. User can run \
9 # programs using Wine or Mono simply by clicking on them \
10 # or typing ./file.exe
13 # Source function library
14 . /etc/rc.d/init.d/functions
16 BINFMT_DIR=/proc/sys/fs/binfmt_misc
18 [ -d $BINFMT_DIR ] || exit 0
21 if [ -f /var/lock/subsys/binfmt-detector ]; then
22 msg_already_running "binfmt detector"
26 # check if binfmt_misc is not already mounted
27 if ! grep -q ${BINFMT_DIR} /proc/mounts; then
28 /bin/mount none -t binfmt_misc ${BINFMT_DIR}
30 msg_starting "binfmt detector"
31 if [ -e "$BINFMT_DIR/register" ]; then
32 echo ':windows:M::MZ::/usr/bin/binfmt-detector:' > ${BINFMT_DIR}/register
33 echo ':windowsPE:M::PE::/usr/bin/binfmt-detector:' > ${BINFMT_DIR}/register
35 touch /var/lock/subsys/binfmt-detector
42 if [ ! -f /var/lock/subsys/binfmt-detector ]; then
43 msg_not_running "binfmt detector"
47 msg_stopping "binfmt detector"
48 echo '-1' > ${BINFMT_DIR}/windows
49 echo '-1' > ${BINFMT_DIR}/windowsPE
50 rm -f /var/lock/subsys/binfmt-detector
55 if [ ! -f /var/lock/subsys/binfmt-detector ]; then
56 msg_not_running "binfmt-detector"
84 if [ ! -f /var/lock/subsys/binfmt-detector ]; then
85 msg_not_running "binfmt detector"
88 for fmt in windows windowsPE; do
89 printf "%s: %s; %s: %s\n" $fmt \
90 $(grep -E '(disabled|enabled)' $BINFMT_DIR/$fmt) \
91 $(grep -E 'interpreter' $BINFMT_DIR/$fmt)
95 msg_usage "$0 {start|stop|restart|reload|try-restart|force-reload|status}"