#!/sbin/runscript # Copyright 1999-2010 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 # $Header: $ extra_commands="${opts} reload" description="Per-device actkbd service for system-wide hotkeys" depend() { need dev localmount use localmount } setup() { local subname="${RC_SVCNAME#*.}" local rc_config=/etc/conf.d/actkbd source ${rc_config} || return 1 test -f ${rc_config}.${subname} && source ${rc_config}.${subname} test -z "${CONFIG}" && CONFIG="/etc/actkbd.conf" if test "${subname}" = "${RC_SVCNAME}"; then PIDFILE=/var/run/actkbd.pid LOGNAME="actkbd" else PIDFILE=/var/run/actkbd.${subname}.pid LOGNAME="actkbd [${subname}]" fi if ! test -f ${CONFIG} ; then eerror "Config file \"${CONFIG}\" does not exist." return 1 fi if ! test -c ${EVENT_DEVICE} ; then eerror "Device \"${EVENT_DEVICE}\" is not valid." return 1 fi return 0 } start() { setup || return $? ebegin "Starting ${LOGNAME}" start-stop-daemon --start --name ${RC_SVCNAME} \ --pidfile ${PIDFILE} \ --exec /usr/bin/actkbd \ -- \ -D -q \ -c ${CONFIG} \ -d ${EVENT_DEVICE} \ -p ${PIDFILE} \ ${OPTIONS} eend $? } stop() { setup || return $? ebegin "Stopping ${LOGNAME}" start-stop-daemon --stop --quiet --pidfile ${PIDFILE} eend $? } reload() { setup || return $? ebegin "Reloading ${LOGNAME}" start-stop-daemon --signal HUP --pidfile ${PIDFILE} eend $? }