This repository has been archived by the owner on Apr 4, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
wine.init
89 lines (81 loc) · 1.92 KB
/
wine.init
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
#!/bin/sh
#
# wine Allow users to run Windows(tm) applications by just clicking on them
# (or typing ./file.exe)
#
# chkconfig: 35 98 10
# description: Allow users to run Windows(tm) applications by just clicking \
# on them (or typing ./file.exe)
### BEGIN INIT INFO
# Provides: wine-binfmt
# Required-Start:
# Required-Stop:
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Add and remove wine binary handler
# Description: Allow users to run Windows(tm) applications by just clicking
# on them (or typing ./file.exe)
### END INIT INFO
. /etc/rc.d/init.d/functions
RETVAL=0
start() {
# fix bug on changing runlevels #213230
if [ -e /proc/sys/fs/binfmt_misc/windows ]; then
echo -n $"Binary handler for Windows applications already registered"
else
echo -n $"Registering binary handler for Windows applications: "
/sbin/modprobe binfmt_misc &>/dev/null
echo ':windows:M::MZ::/usr/bin/wine:' >/proc/sys/fs/binfmt_misc/register || :
echo ':windowsPE:M::PE::/usr/bin/wine:' >/proc/sys/fs/binfmt_misc/register || :
RETVAL=$?
[ $RETVAL -eq 0 ] && success || failure
fi
echo
}
stop() {
echo -n $"Unregistering binary handler for Windows applications: "
echo "-1" >/proc/sys/fs/binfmt_misc/windows || :
echo "-1" >/proc/sys/fs/binfmt_misc/windowsPE || :
RETVAL=$?
[ $RETVAL -eq 0 ] && success || failure
echo
}
wine_status() {
if [ -e /proc/sys/fs/binfmt_misc/windows ]; then
echo $"Wine binary format handlers are registered."
return 0
else
echo $"Wine binary format handlers are not registered."
return 3
fi
}
case "$1" in
start)
start
;;
stop)
stop
;;
status)
wine_status
RETVAL=$?
;;
restart)
stop
start
;;
reload)
stop
start
;;
condrestart|try-restart)
if [ -e /proc/sys/fs/binfmt_misc/windows ]; then
stop
start
fi
;;
*)
echo $"Usage: $prog {start|stop|status|restart|reload|try-restart}"
exit 1
esac
exit $RETVAL