summaryrefslogtreecommitdiff
path: root/app-misc/lirc/files/lircd-0.8.6-r2
blob: e651f19da50ddf4580dd8bf6c5c309924b11a14d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
#!/sbin/runscript
# Copyright 1999-2012 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/app-misc/lirc/files/lircd-0.8.6-r2,v 1.1 2012/07/19 19:52:17 axs Exp $
 
PIDFILE=/var/run/lirc/${SVCNAME}.pid
: ${LIRCD_SYMLINKFILE:=/dev/lircd}
: ${LIRCD_SOCKET:=/var/run/lirc/lircd}
 
depend() {
need localmount
use modules
provide lirc
}
 
start() {
local retval
 
ebegin "Starting lircd"
 
for retval in ${LIRCD_SET_SYSCLASSRCS} ; do
if [ -e /sys/class/rc/${retval}/protocols ] && \
grep 'lirc' /sys/class/rc/${retval}/protocols &>/dev/null ; then
einfo "Setting lirc protocol active for ${retval}"
echo lirc >/sys/class/rc/${retval}/protocols
fi
done
 
checkpath -q -d -m 0755 -o root:root /var/run/lirc
rm -Rf ${LIRCD_SOCKET} && ln -s ${LIRCD_SOCKET} ${LIRCD_SYMLINKFILE}
if [ $? -ne 0 ]; then
eend $? "Unable to create symbolic link ${LIRCD_SYMLINKFILE}"
return 1
fi
 
start-stop-daemon --start --quiet --pidfile "${PIDFILE}" --exec /usr/sbin/lircd -- \
-P "${PIDFILE}" ${LIRCD_OPTS}
retval=$?
 
if [ ${retval} -ne 0 ]; then
rm -Rf ${LIRCD_SOCKET}
fi
 
eend ${retval}
}
 
stop() {
ebegin "Stopping lircd"
rm -f ${LIRCD_SYMLINKFILE}
start-stop-daemon --stop --quiet --pidfile "${PIDFILE}" --exec /usr/sbin/lircd
eend $?
}