#!/bin/bash # # wine Allow users to run Windows(tm) applications by just clicking # on them (or typing ./file.exe) # # chkconfig: 2345 99 10 # description: Allow users to run Windows(tm) applications by just clicking \\ # on them (or typing ./file.exe) #Servicename SERVICE=wine # Source function library. . /etc/rc.d/init.d/functions RETVAL=0 case "$1" in start) gprintf "Starting %s: " "$SERVICE" /sbin/modprobe binfmt_misc &>/dev/null RETVAL=$? 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 echo `success` [ $RETVAL -eq 0 ] && touch /var/lock/subsys/$SERVICE ;; stop) gprintf "Stopping %s: " "$SERVICE" if ! [ -e /proc/sys/fs/binfmt_misc/windows ]; then echo `failure` echo Wine Registration already disabled! exit 1 fi echo "-1" >/proc/sys/fs/binfmt_misc/windows echo "-1" >/proc/sys/fs/binfmt_misc/windowsPE RETVAL=$? echo `success` [ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/$SERVICE ;; status) if [ -e /proc/sys/fs/binfmt_misc/windows ]; then echo Wine Registration enabled else echo Wine Registration disabled fi ;; restart|reload) $0 stop $0 start ;; *) gprintf "Usage: %s {start|status|stop}\n" "$SERVICE" exit 1 esac exit $RETVAL