1 |
ahmad |
36061 |
#!/bin/bash |
2 |
|
|
# |
3 |
|
|
# wine Allow users to run Windows(tm) applications by just clicking |
4 |
|
|
# on them (or typing ./file.exe) |
5 |
|
|
# |
6 |
|
|
# chkconfig: 2345 99 10 |
7 |
|
|
# description: Allow users to run Windows(tm) applications by just clicking \ |
8 |
|
|
# on them (or typing ./file.exe) |
9 |
|
|
# |
10 |
|
|
### BEGIN INIT INFO |
11 |
|
|
# Provides: wine |
12 |
fwang |
138551 |
# Required-Start: |
13 |
|
|
# Required-Stop: |
14 |
ahmad |
36061 |
# Default-Start: 2 3 4 5 |
15 |
fwang |
138551 |
# Default-Stop: 0 1 6 |
16 |
ahmad |
36061 |
# Short-Description: Allow users to run Windows(tm) applications |
17 |
|
|
# Description: Allow users to run Windows(tm) applications by just clicking |
18 |
|
|
# on them (or typing ./file.exe) |
19 |
|
|
### END INIT INFO |
20 |
|
|
|
21 |
|
|
#Servicename |
22 |
|
|
SERVICE=wine |
23 |
|
|
|
24 |
|
|
# Source function library. |
25 |
|
|
. /etc/rc.d/init.d/functions |
26 |
|
|
|
27 |
|
|
RETVAL=0 |
28 |
|
|
|
29 |
|
|
case "$1" in |
30 |
|
|
start) |
31 |
|
|
gprintf "Starting %s: " "$SERVICE" |
32 |
|
|
if [ -e /proc/sys/fs/binfmt_misc/windows ]; then |
33 |
|
|
failure |
34 |
|
|
echo |
35 |
|
|
gprintf "Wine Registration already enabled!\n" |
36 |
|
|
exit 1 |
37 |
|
|
fi |
38 |
|
|
/sbin/modprobe binfmt_misc &>/dev/null |
39 |
|
|
RETVAL=$? |
40 |
|
|
echo ':windows:M::MZ::/usr/bin/wine:' >/proc/sys/fs/binfmt_misc/register |
41 |
|
|
echo ':windowsPE:M::PE::/usr/bin/wine:' >/proc/sys/fs/binfmt_misc/register |
42 |
|
|
success |
43 |
|
|
echo |
44 |
|
|
[ $RETVAL -eq 0 ] && touch /var/lock/subsys/$SERVICE |
45 |
|
|
;; |
46 |
|
|
stop) |
47 |
|
|
gprintf "Stopping %s: " "$SERVICE" |
48 |
|
|
if ! [ -e /proc/sys/fs/binfmt_misc/windows ]; then |
49 |
|
|
failure |
50 |
|
|
echo |
51 |
|
|
gprintf "Wine Registration already disabled!\n" |
52 |
|
|
exit 1 |
53 |
|
|
fi |
54 |
|
|
echo "-1" >/proc/sys/fs/binfmt_misc/windows |
55 |
|
|
echo "-1" >/proc/sys/fs/binfmt_misc/windowsPE |
56 |
|
|
RETVAL=$? |
57 |
|
|
success |
58 |
|
|
echo |
59 |
|
|
[ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/$SERVICE |
60 |
|
|
;; |
61 |
|
|
status) |
62 |
|
|
if [ -e /proc/sys/fs/binfmt_misc/windows ]; then |
63 |
|
|
gprintf "Wine Registration enabled\n" |
64 |
|
|
else |
65 |
|
|
gprintf "Wine Registration disabled\n" |
66 |
|
|
fi |
67 |
|
|
;; |
68 |
|
|
restart|reload) |
69 |
|
|
$0 stop |
70 |
|
|
$0 start |
71 |
|
|
;; |
72 |
|
|
*) |
73 |
|
|
gprintf "Usage: %s {start|status|stop}\n" "$SERVICE" |
74 |
|
|
exit 1 |
75 |
|
|
esac |
76 |
|
|
|
77 |
|
|
exit $RETVAL |