diff options
Diffstat (limited to 'app-misc/g15daemon/files/g15daemon-1.9.5.3.initd')
-rw-r--r-- | app-misc/g15daemon/files/g15daemon-1.9.5.3.initd | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/app-misc/g15daemon/files/g15daemon-1.9.5.3.initd b/app-misc/g15daemon/files/g15daemon-1.9.5.3.initd new file mode 100644 index 000000000000..4e7798c7fcfc --- /dev/null +++ b/app-misc/g15daemon/files/g15daemon-1.9.5.3.initd @@ -0,0 +1,46 @@ +#!/sbin/runscript +# 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 $? +} |