pbbuttonsd/pbbuttonsd.init

67 lines
1.7 KiB
Bash

#! /bin/sh
#
# pbbuttonsd Power Book Buttons daemon.
#
# chkconfig: 2345 73 61
# description: A special Tool for Apple PowerBook owner. It makes \
# the keys for controlling the brightness and volume work \
# as expected. It also controls trackpad settings and \
# power management.
# processname: pbbuttonsd
# config: /etc/pbbuttonsd.conf
#
### BEGIN INIT INFO
# Provides: pbbuttonsd
# Required-Start: $syslog
# Should-Start: mouseemu
# Required-Stop: $syslog
# Should-Stop: mouseemu
# Default-Start: 2 3 4 5
# Short-Description: Launch PowerBook powermanagement daemon
# Description: A special Tool for Apple PowerBook owner. It makes \
# the keys for controlling the brightness and volume work \
# as expected. It also controls trackpad settings and \
# power management.
### END INIT INFO
# Source function library.
. /etc/rc.d/init.d/functions
# If the machine is not a laptop, bail out elegantly.
MACHINE=`cat /proc/cpuinfo | grep machine | awk '{print $3}' | grep Book`
if [ -z "$MACHINE" ]; then
gprintf "Bypassing pbbuttonsd daemon, not a laptop: "
echo
exit 0
fi
# See how we were called.
case "$1" in
start)
action "Loading event module (evdev):" modprobe evdev
gprintf "Starting pbbuttonsd daemon: "
daemon pbbuttonsd -d
echo
touch /var/lock/subsys/pbbuttonsd
;;
stop)
gprintf "Stopping pbbutonsd daemon: "
killproc pbbuttonsd
echo
rm -f /var/lock/subsys/pbbuttonsd
;;
reload|restart)
$0 stop
$0 start
;;
status)
status pbbuttonsd
;;
*)
gprintf "Usage: pbbuttonsd {start|stop|restart|reload|status}\n"
exit 1
esac
exit 0