tomh / rpms / lirc

Forked from rpms/lirc 6 years ago
Clone
Blob Blame History Raw
#!/bin/sh
#
# $Id: lircd.init,v 1.1 2004/02/26 17:54:30 thias Exp $
# Startup script for the Linux Infrared Remote Control.
#
# chkconfig: - 90 10
# description: Enables infrared controls through LIRC.
#
# config: /etc/lircd.conf

# Source 'em up
. /etc/init.d/functions

[ -x @SBINDIR@/lircd ]  || exit 1
[ -x @SBINDIR@/lircmd ] || exit 1
[ -f /etc/lircd.conf ]  || [ -f /etc/lircmd.conf ] || exit 1

RETVAL=0

start(){
	if [ -f /etc/lircd.conf ]; then
		echo -n $"Starting infrared remote control daemon: "
		daemon lircd
		RETVAL=$?
		echo
	fi
	if [ -f /etc/lircmd.conf ]; then
		echo -n $"Starting infrared remote control mouse daemon: "
		daemon lircmd
		RETVAL=$?
		echo
	fi
	touch /var/lock/subsys/lircd
	return $RETVAL
}

stop(){
	if [ -f /etc/lircmd.conf ]; then
		echo -n $"Stopping infrared remote control mouse daemon: "
		killproc lircmd
		echo
	fi
	if [ -f /etc/lircd.conf ]; then
		echo -n $"Stopping infrared remote control daemon: "
		killproc lircd
		echo
	fi
	RETVAL=$?
	rm -f /var/lock/subsys/lircd
	return $RETVAL
}

restart(){
	stop
	start
}


# See how we were called.
case "$1" in
	start)
		start
		;;
	stop)
		stop
		;;
	restart)
		restart
		;;
	status)
		status lircd
		;;
	condrestart)
		[ -e /var/lock/subsys/lircd ] && restart
		;;
	*)
		echo $"Usage: $0 {start|stop|status|restart|condrestart}"
		RETVAL=1
esac

exit $RETVAL