]> git.pld-linux.org Git - packages/binfmt-detector.git/blame - binfmt-detector.init
- rel 2
[packages/binfmt-detector.git] / binfmt-detector.init
CommitLineData
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
18BINFMT_DIR='/proc/sys/fs/binfmt_misc'
19
4d915dda
AM
20[ ! -d "$BINFMT_DIR" ] && exit 0
21
a62c069c 22start() {
aab3d22f 23 if [ ! -f /var/lock/subsys/binfmt-detector ]; then
24 # check if binfmt_misc is not already mounted
4d915dda 25 if ! grep -q "${BINFMT_DIR}" /proc/mounts; then
58bd9bf1 26 /bin/mount none -t binfmt_misc ${BINFMT_DIR}
aab3d22f 27 fi
4d915dda
AM
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
aab3d22f 37 else
802a6ec3 38 msg_already_running 'binfmt-detector'
aab3d22f 39 fi
a62c069c
ER
40}
41
42stop() {
43 if [ -f /var/lock/subsys/binfmt-detector ]; then
802a6ec3 44 msg_stopping 'binfmt-detector'
a62c069c
ER
45 echo '-1' > ${BINFMT_DIR}/windows
46 echo '-1' > ${BINFMT_DIR}/windowsPE
aab3d22f 47 rm -f /var/lock/subsys/binfmt-detector
48 ok
49 else
802a6ec3 50 msg_not_running 'binfmt-detector'
aab3d22f 51 fi
a62c069c
ER
52}
53
54RETVAL=0
55case "$1" in
56 start|reload|force-reload)
57 start
58 ;;
59 stop)
60 stop
aab3d22f 61 ;;
62 restart)
a62c069c
ER
63 stop
64 start
aab3d22f 65 ;;
66 status)
67 ;;
68 *)
69 msg_usage "$0 {start|stop|restart|reload|force-reload|status}"
70 exit 3
71esac
72
a62c069c 73exit $RETVAL
This page took 0.104231 seconds and 4 git commands to generate.