#!/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) # ### BEGIN INIT INFO # Provides: wine # Default-Start: 2 3 4 5 # Short-Description: Allow users to run Windows(tm) applications # Description: Allow users to run Windows(tm) applications by just clicking # on them (or typing ./file.exe) ### END INIT INFO #Servicename SERVICE=wine # Source function library. . /etc/rc.d/init.d/functions RETVAL=0 case "$1" in start) gprintf "Starting %s: " "$SERVICE" if [ -e /proc/sys/fs/binfmt_misc/windows ]; then failure echo gprintf "Wine Registration already enabled!\n" exit 1 fi /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 success echo [ $RETVAL -eq 0 ] && touch /var/lock/subsys/$SERVICE ;; stop) gprintf "Stopping %s: " "$SERVICE" if ! [ -e /proc/sys/fs/binfmt_misc/windows ]; then failure echo gprintf "Wine Registration already disabled!\n" exit 1 fi echo "-1" >/proc/sys/fs/binfmt_misc/windows echo "-1" >/proc/sys/fs/binfmt_misc/windowsPE RETVAL=$? success echo [ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/$SERVICE ;; status) if [ -e /proc/sys/fs/binfmt_misc/windows ]; then gprintf "Wine Registration enabled\n" else gprintf "Wine Registration disabled\n" fi ;; restart|reload) $0 stop $0 start ;; *) gprintf "Usage: %s {start|status|stop}\n" "$SERVICE" exit 1 esac exit $RETVAL