]> git.pld-linux.org Git - packages/lirc.git/blame - lircd.init
- rebuild for kernel-3.6.10-1
[packages/lirc.git] / lircd.init
CommitLineData
c62825f4 1#!/bin/sh
24daa3e2 2#
3# lircd Linux Infrared Remote Control daemon
4#
5# chkconfig: 2345 65 35
69aaf812 6# description: LIRC is a package that allows you to decode and send \
7# infra-red signals of many (but not all) commonly used \
24daa3e2 8# remote controls.
9#
10# processname: lircd
5eb8c54f
KK
11# pidfile: /var/run/lirc/lircd.pid
12# config: /etc/lirc/lircd.conf
e9abebc8 13# config: /etc/sysconfig/lircd
24daa3e2 14
15# Source function library
16. /etc/rc.d/init.d/functions
17
18# Get service config
e9abebc8 19[ -f /etc/sysconfig/lircd ] && . /etc/sysconfig/lircd
24daa3e2 20
1e7a4611 21start() {
c62825f4 22 # Check if the service is already running?
23 if [ ! -f /var/lock/subsys/lircd ]; then
24 msg_starting "Linux Infrared Remote Control daemon"
24daa3e2 25 OPTIONS=""
26 [ -n "$DRIVER" ] && OPTIONS="--driver=$DRIVER"
27 [ -n "$DEVICE" ] && OPTIONS="$OPTIONS --device=$DEVICE"
0ea31a28 28 #Check if use serial port
29 [ -n "$COM_PORT" ] && setserial $COM_PORT uart none
30 MODULE_OPTIONS=""
31 [ -n "$DRIVER_OPTS" ] && MODULE_OPTIONS="$DRIVER_OPTS"
32 modprobe -s lirc $MODULE_OPTIONS > /dev/null 2>&1
0d8a80c5 33 ln -sf /tmp/.lircd /dev/lircd
24daa3e2 34 daemon lircd $OPTIONS
35 RETVAL=$?
36 [ $RETVAL -eq 0 ] && touch /var/lock/subsys/lircd
c62825f4 37 else
38 msg_already_running "Linux Infrared Remote Control daemon"
c62825f4 39 fi
1e7a4611
ER
40}
41
42stop() {
24daa3e2 43 # Stop daemons.
c62825f4 44 if [ -f /var/lock/subsys/lircd ]; then
24daa3e2 45 msg_stopping "Linux Infrared Remote Control daemon"
46 killproc lircd
0d8a80c5 47 rm -f /dev/lircd
24daa3e2 48 rm -f /var/lock/subsys/lircd >/dev/null 2>&1
49 else
c62825f4 50 msg_not_running "Linux Infrared Remote Control daemon"
c62825f4 51 fi
1e7a4611
ER
52}
53
0587d182
JB
54restart() {
55 test -f /var/lock/subsys/lircmd && RESTART_LIRCMD=yes
56 test -n "$RESTART_LIRCMD" && /sbin/service lircmd stop
57 stop
58 start
59 test -n "$RESTART_LIRCMD" && /sbin/service lircmd start
60}
61
62condrestart() {
63 if [ -f /var/lock/subsys/lircd ]; then
64 restart
65 else
66 msg_not_running "Linux Infrared Remote Control daemon"
67 RETVAL=$1
68 fi
69}
70
1e7a4611
ER
71RETVAL=0
72# See how we were called.
73case "$1" in
74 start)
75 start
76 ;;
77 stop)
78 stop
c62825f4 79 ;;
24daa3e2 80 restart)
0587d182
JB
81 restart
82 ;;
83 try-restart)
84 condrestart 0
c62825f4 85 ;;
4e29ad2e 86 reload|force-reload)
4ace6a84 87 if [ -f /var/lock/subsys/lircd ]; then
88 msg_reloading "Linux Infrared Remote Control daemon"
89 killproc lircd -HUP
90 RETVAL=$?
91 else
b1e43d4e 92 msg_not_running "Linux Infrared Remote Control daemon"
4e29ad2e 93 exit 7
4ace6a84 94 fi
24daa3e2 95 ;;
0587d182
JB
96 status)
97 status lircd
98 exit $?
99 ;;
24daa3e2 100 *)
0587d182 101 msg_usage "$0 {start|stop|restart|try-restart|reload|force-reload|status}"
4e29ad2e 102 exit 3
24daa3e2 103esac
104
105exit $RETVAL
This page took 0.059674 seconds and 4 git commands to generate.