Repository URL to install this package:
Version:
1.1.3-1 ▾
|
#!/bin/bash
PATH=/opt/brother/modem:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
BROTHERPATH=/opt/brother/modem
DAEMON=brfaxd
DRIVER=brusbmfc
NAME=brfax-service
PIDFILE=$BROTHERPATH/$NAME.pid
DESC="Brother FAX Driver"
CHECK_VERSION=$(modinfo $BROTHERPATH/$DRIVER.ko | grep `uname -r`)
unset TMPDIR
test -x $BROTHERPATH/$DAEMON || exit 0
. /lib/lsb/init-functions
# Get the timezone set.
if [ -z "$TZ" -a -e /etc/timezone ]; then
TZ=`cat /etc/timezone`
export TZ
fi
prompt_compiler()
{
echo "******************"
echo "*"
echo "* The driver isn't compatible with the current kernel ($(uname -r))"
echo "* Please read INSTALL.txt in '$BROTHERPATH/src' ."
echo "*"
echo "******************"
}
start_service()
{
if [ -z "$CHECK_VERSION" ];
then
prompt_compiler
else
/sbin/insmod -f $BROTHERPATH/brusbmfc.ko
mjn=$(grep $DRIVER /proc/devices | sed s/$DRIVER//)
mknod -m 666 /dev/$DRIVER c $mjn 1
ln -s /dev/$DRIVER /dev/modem
mkdir -p `dirname "$PIDFILE"`
start-stop-daemon --start --quiet --oknodo --make-pidfile --pidfile "$PIDFILE" --exec $BROTHERPATH/$DAEMON & success=1
fi
}
stop_service()
{
if [ -z "$CHECK_VERSION" ];
then
prompt_compiler
else
start-stop-daemon --stop --quiet --retry 5 --oknodo --pidfile $PIDFILE --name $DAEMON & success=1
rm -f /dev/$DRIVER
rm -f /dev/modem
/sbin/rmmod $DRIVER
rm -f $PIDFILE
fi
}
case "$1" in
start)
log_begin_msg "Starting $DESC:"
if [ -z "$CHECK_VERSION" ];
then
log_end_msg 1 || true
prompt_compiler
else
start_service
log_end_msg $?
fi
;;
stop)
log_begin_msg "Stopping $DESC:"
if [ -z "$CHECK_VERSION" ];
then
log_end_msg 1 || true
else
stop_service
log_end_msg $?
fi
;;
restart)
log_begin_msg "Restarting $DESC:"
if [ -z "$CHECK_VERSION" ];
then
log_end_msg 1 || true
else
stop_service
sleep 1
start_service
log_end_msg $?
fi
;;
*)
N=/etc/init.d/${0##*/}
echo "Usage: $N {start|stop|restart}" >&2
exit 1
;;
esac
exit 0