blob: 6881df845e8d573a6332d4372caeefa47aa09a92 (
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
|
#!/sbin/openrc-run
# Copyright 1999-2014 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Id$
# Init script for g15daemon
pidfile="/var/run/g15daemon.pid"
command="/usr/sbin/g15daemon"
start_stop_daemon_args="--wait 30"
command_args=""
depend() {
after hotplug
after usb
after modules
}
start_pre() {
# Does the input device already exist?
if [ -e "/proc/modules" ] ; then
if [ ! -e "/dev/input/uinput" ] && [ ! -e "/dev/uinput" ] ; then
# We can load modules, but uinput device does not exist
einfo "Loading uinput module"
/sbin/modprobe uinput > /dev/null 2> /dev/null \
|| return 1
fi
fi
if [ "${CLIENT_SWITCH_L1}" = "yes" ] ; then
command_args="--switch"
fi
}
stop() {
ebegin "Stopping g15daemon"
local KILLOPT="-k"
if [ $BACKLIGHT_OFF = "yes" ]; then
KILLOPT="-K"
fi
while [ -f "${pidfile}" ] && kill -0 $(cat ${pidfile}) ; do
${command} ${KILLOPT}
sleep 1
done
eend $?
}
|