--- ._cfg0000_actkbd 2013-03-29 23:42:12.000000000 +0400 +++ actkbd 2013-03-30 14:17:36.000000000 +0400 @@ -1,32 +1,76 @@ #!/sbin/runscript -# Copyright 1999-2013 Gentoo Foundation +# Copyright 1999-2010 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 -# $Header: /var/cvsroot/gentoo-x86/app-misc/actkbd/files/actkbd.initd,v 1.1 2013/03/14 19:50:09 scarabeus Exp $ +# $Header: $ -checkconfig() { - if [ ! -f ${CONFIG} ] ; then - eerror "Config file \"${CONFIG}\" does not exist. Create it prior launching the daemon." +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 [ ! -c ${EVENT_DEVICE} ] ; then - eerror "Device \"${EVENT_DEVICE}\" is not valid pointer to input provider." + + if ! test -c ${EVENT_DEVICE} ; then + eerror "Device \"${EVENT_DEVICE}\" is not valid." return 1 fi -} -depend() { - before acpid + return 0 } start() { - checkconfig || return 1 - ebegin "Starting actkbd" - start-stop-daemon --start --quiet --pidfile ${PIDFILE} --exec /usr/bin/actkbd -- -c "${CONFIG}" -D -q -x -l -p "${PIDFILE}" -d "${EVENT_DEVICE}" + 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() { - ebegin "Stopping actkbd" - start-stop-daemon --stop --quiet --pidfile ${PIDFILE} --exec /usr/bin/actkbd + 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 $? }