#! /bin/sh
#
# lirc init-script
# Copy it to /etc/init.d/lirc and type
# > update-rc.d lirc defaults 20
#
# otto@bergercity.de 


test -f /usr/local/sbin/lircd || exit 0

case "$1" in
  start)
    echo -n "Starting lirc daemon: lircd"
    /usr/local/sbin/lircd --driver=default --device=/dev/lirc0 --pidfile=/var/run/lirc0.pid --output=/dev/lircd
    echo "."
    ;;
  stop)
    echo -n "Stopping lirc daemon: lircd"
    kill `cat /var/run/lirc0.pid`
    echo "."
    ;;
  restart)
    echo -n "Stopping lirc daemon: lircd"
    kill `cat /var/run/lirc0.pid`
    echo "."
    sleep 1
    echo -n "Starting lirc daemon: lircd"
    /usr/local/sbin/lircd --driver=default --device=/dev/lirc0 --pidfile=/var/run/lirc0.pid --output=/dev/lircd
    echo "."
    ;;
  *)
    echo "Usage: /etc/init.d/lircd {start|stop|restart}"
    exit 1
esac

exit 0

