updated on Thu Jan 12 04:00:44 UTC 2012
[aur-mirror.git] / lirc-bede / lircd
blobe9739b36e2190c20f68568e52c67bb9a7fb7c30b
1 #!/bin/bash
3 . /etc/rc.conf
4 . /etc/rc.d/functions
5 . /etc/conf.d/lircd.conf
7 PID=$(pidof -o %PPID /usr/sbin/lircd)
8 LIRCD_SYMLINKFILE=/dev/lircd
9 LIRCD_SOCKET=/var/run/lirc/lircd
10 case "$1" in
11 start)
12 stat_busy "Starting LIRC Daemon"
13 [ ! -d /var/run/lirc ] && install -d /var/run/lirc &>/dev/null
14 rm -f $LIRCD_SOCKET && ln -s $LIRCD_SOCKET $LIRCD_SYMLINKFILE
15 if [ $? -ne 0 ]; then
16 stat_fail
17 exit 0
19 [ -n "$LIRC_DRIVER" ] && LIRC_EXTRAOPTS="-H $LIRC_DRIVER $LIRC_EXTRAOPTS"
20 [ -z "$PID" ] &&
21 if [ -n "$LIRC_DEVICE" ] ; then
22 eval /usr/sbin/lircd -d "$LIRC_DEVICE" $LIRC_EXTRAOPTS $LIRC_CONFIGFILE
23 else
24 /usr/sbin/lircd $LIRC_EXTRAOPTS $LIRC_CONFIGFILE
26 if [ $? -gt 0 ]; then
27 stat_fail
28 else
29 add_daemon lircd
30 stat_done
33 stop)
34 stat_busy "Stopping LIRC Daemon"
35 rm -f $LIRCD_SYMLINKFILE
36 [ ! -z "$PID" ] && kill $PID &> /dev/null
37 if [ $? -gt 0 ]; then
38 stat_fail
39 else
40 rm_daemon lircd
41 stat_done
44 restart)
45 $0 stop
46 sleep 1
47 $0 start
50 echo "usage: $0 start|stop|restart"
51 esac
52 exit 0