summaryrefslogtreecommitdiff
blob: 7976cff0144f0e672d6b3bd5f904591f2f8024c6 (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
#!/sbin/runscript
# Copyright 1999-2013 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/app-misc/g15daemon/files/g15daemon-1.9.5.3.initd,v 1.2 2013/03/18 17:49:55 polynomial-c Exp $

# Init script for g15daemon

pidfile="/var/run/g15daemon.pid"
command="/usr/sbin/g15daemon"
command_args=""
start_stop_daemon_args="--background --pidfile ${pidfile}"

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
		fi
	fi

	local SWITCHKEY=""
	[ "${CLIENT_SWITCH_L1}" = "yes" ] && command_args="--switch"
}

stop() {
	ebegin "Stopping g15daemon"
	local KILLOPT="-k"
	if [ $BACKLIGHT_OFF = "yes" ]; then
		KILLOPT="-K"
	fi
	start-stop-daemon -R 5 --exec ${command} -- ${KILLOPT}
	eend $?
}