Lines 1-32
Link Here
|
1 |
#!/sbin/runscript |
1 |
#!/sbin/runscript |
2 |
# Copyright 1999-2013 Gentoo Foundation |
2 |
# Copyright 1999-2010 Gentoo Foundation |
3 |
# Distributed under the terms of the GNU General Public License v2 |
3 |
# Distributed under the terms of the GNU General Public License v2 |
4 |
# $Header: /var/cvsroot/gentoo-x86/app-misc/actkbd/files/actkbd.initd,v 1.1 2013/03/14 19:50:09 scarabeus Exp $ |
4 |
# $Header: $ |
5 |
|
5 |
|
6 |
checkconfig() { |
6 |
extra_commands="${opts} reload" |
7 |
if [ ! -f ${CONFIG} ] ; then |
7 |
description="Per-device actkbd service for system-wide hotkeys" |
8 |
eerror "Config file \"${CONFIG}\" does not exist. Create it prior launching the daemon." |
8 |
|
|
|
9 |
depend() { |
10 |
need dev localmount |
11 |
use localmount |
12 |
} |
13 |
|
14 |
setup() { |
15 |
local subname="${RC_SVCNAME#*.}" |
16 |
local rc_config=/etc/conf.d/actkbd |
17 |
|
18 |
source ${rc_config} || return 1 |
19 |
test -f ${rc_config}.${subname} && source ${rc_config}.${subname} |
20 |
|
21 |
test -z "${CONFIG}" && CONFIG="/etc/actkbd.conf" |
22 |
|
23 |
if test "${subname}" = "${RC_SVCNAME}"; then |
24 |
PIDFILE=/var/run/actkbd.pid |
25 |
LOGNAME="actkbd" |
26 |
else |
27 |
PIDFILE=/var/run/actkbd.${subname}.pid |
28 |
LOGNAME="actkbd [${subname}]" |
29 |
fi |
30 |
|
31 |
if ! test -f ${CONFIG} ; then |
32 |
eerror "Config file \"${CONFIG}\" does not exist." |
9 |
return 1 |
33 |
return 1 |
10 |
fi |
34 |
fi |
11 |
if [ ! -c ${EVENT_DEVICE} ] ; then |
35 |
|
12 |
eerror "Device \"${EVENT_DEVICE}\" is not valid pointer to input provider." |
36 |
if ! test -c ${EVENT_DEVICE} ; then |
|
|
37 |
eerror "Device \"${EVENT_DEVICE}\" is not valid." |
13 |
return 1 |
38 |
return 1 |
14 |
fi |
39 |
fi |
15 |
} |
|
|
16 |
|
40 |
|
17 |
depend() { |
41 |
return 0 |
18 |
before acpid |
|
|
19 |
} |
42 |
} |
20 |
|
43 |
|
21 |
start() { |
44 |
start() { |
22 |
checkconfig || return 1 |
45 |
setup || return $? |
23 |
ebegin "Starting actkbd" |
46 |
|
24 |
start-stop-daemon --start --quiet --pidfile ${PIDFILE} --exec /usr/bin/actkbd -- -c "${CONFIG}" -D -q -x -l -p "${PIDFILE}" -d "${EVENT_DEVICE}" |
47 |
ebegin "Starting ${LOGNAME}" |
|
|
48 |
|
49 |
start-stop-daemon --start --name ${RC_SVCNAME} \ |
50 |
--pidfile ${PIDFILE} \ |
51 |
--exec /usr/bin/actkbd \ |
52 |
-- \ |
53 |
-D -q \ |
54 |
-c ${CONFIG} \ |
55 |
-d ${EVENT_DEVICE} \ |
56 |
-p ${PIDFILE} \ |
57 |
${OPTIONS} |
58 |
|
25 |
eend $? |
59 |
eend $? |
26 |
} |
60 |
} |
27 |
|
61 |
|
28 |
stop() { |
62 |
stop() { |
29 |
ebegin "Stopping actkbd" |
63 |
setup || return $? |
30 |
start-stop-daemon --stop --quiet --pidfile ${PIDFILE} --exec /usr/bin/actkbd |
64 |
|
|
|
65 |
ebegin "Stopping ${LOGNAME}" |
66 |
start-stop-daemon --stop --quiet --pidfile ${PIDFILE} |
67 |
eend $? |
68 |
} |
69 |
|
70 |
reload() { |
71 |
setup || return $? |
72 |
|
73 |
ebegin "Reloading ${LOGNAME}" |
74 |
start-stop-daemon --signal HUP --pidfile ${PIDFILE} |
31 |
eend $? |
75 |
eend $? |
32 |
} |
76 |
} |