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