PKGBUILDs/extra/irda-utils/irda
2009-10-09 21:23:22 -05:00

46 lines
838 B
Bash
Executable file

#!/bin/bash
# source application-specific settings
[ -f /etc/conf.d/irda ] && . /etc/conf.d/irda
ARGS=
if [ $DONGLE ]; then
ARGS="$ARGS -d $DONGLE"
fi
if [ "$DISCOVERY" = "yes" -o "$DISCOVERY" = "YES" ]; then
ARGS="$ARGS -s"
fi
ARGS="$DEVICE $ARGS"
. /etc/rc.conf
. /etc/rc.d/functions
PID=`pidof -o %PPID /usr/sbin/irattach`
case "$1" in
start)
stat_busy "Starting IrDA"
[ -z "$PID" ] && /usr/sbin/irattach ${ARGS}
if [ $? -gt 0 ]; then
stat_fail
else
add_daemon irda
stat_done
fi
;;
stop)
stat_busy "Shutting down IrDA"
[ ! -z "$PID" ] && kill $PID &> /dev/null
if [ $? -gt 0 ]; then
stat_fail
else
rm_daemon irda
stat_done
fi
;;
restart)
$0 stop
$0 start
;;
*)
echo "usage: `basename $0` {start|stop|restart}"
esac
exit 0