# Source function library.
. /etc/rc.d/init.d/functions
+# Initial values (just in case):
+LAPTOP_MODULES=""
+VARIOUS_MODULES=""
+ASUS_LAPTOP=""
+TOSHIBA_LAPTOP=""
+
# Configuration file.
. /etc/sysconfig/acpid
RETVAL=0
-
# See how we were called.
case "$1" in
- start)
+ start)
# Start daemons.
- if [ ! -f /var/lock/subsys/acpid ]; then
- if [ ! -f /proc/acpi/event ]; then
- modprobe ospm_system
- fi
- msg_starting acpid $PROGRAM_ARGS
- daemon acpid
- RETVAL=$?
- [ $RETVAL -eq 0 ] && touch /var/lock/subsys/acpid
- else
- msg_already_running acpid
+ if [ ! -f /var/lock/subsys/acpid ]; then
+ if [ ! -d /proc/acpi/button ]; then
+ _modprobe ospm_button
+ _modprobe button
+ fi
+ if is_yes "$MODPROBE_OSPM_SYSTEM"; then
+ _modprobe single ospm_system
fi
- ;;
- stop)
- # Stop daemons.
- if [ -f /var/lock/subsys/acpid ]; then
- msg_stopping acpid
- killproc acpid
- rm -f /var/lock/subsys/acpid >/dev/null 2>&1
- else
- msg_not_running acpid
- exit 1
+ # starting:
+ msg_starting acpid $PROGRAM_ARGS
+ # Load additional modules:
+ if [ -z "$LAPTOP_MODULES" ]; then
+ for i in "$LAPTOP_MODULES"; do
+ _modprobe single $i
+ done
+ elif [ -z "$VARIOUS_MODULES" ] then
+ for i in "$VARIOUS_MODULES"; do
+ _modprobe single $i
+ done
fi
- ;;
- reload)
- if [ -f /var/lock/subsys/acpid ]; then
- msg_reloading acpid
- killproc acpid -HUP
- else
- msg_not_running acpid
- exit 1
- fi
- ;;
- restart)
- $0 stop
- $0 start
- ;;
- status)
- status acpid
- ;;
- *)
- msg_Usage "$0 {start|stop|restart|reload|status}"
- exit 1
+ # Determine if it's ASUS or TOSHIBA laptop
+ if is_yes "$ASUS_LAPTOP"; then
+ _modprobe asus_acpi
+ elif is_yes "$TOSHIBA_LAPTOP"; then
+ _modprobe toshiba_acpi
+ fi
+ daemon acpid
+ RETVAL=$?
+ [ $RETVAL -eq 0 ] && touch /var/lock/subsys/acpid
+ else
+ msg_already_running acpid
+ fi
+ ;;
+ stop)
+ # Stop daemons.
+ if [ -f /var/lock/subsys/acpid ]; then
+ msg_stopping acpid
+ killproc acpid
+ rm -f /var/lock/subsys/acpid >/dev/null 2>&1
+ else
+ msg_not_running acpid
+ fi
+ ;;
+ reload|force-reload)
+ if [ -f /var/lock/subsys/acpid ]; then
+ msg_reloading acpid
+ killproc acpid -HUP
+ RETVAL=$?
+ else
+ msg_not_running acpid >&2
+ exit 7
+ fi
+ ;;
+ restart)
+ $0 stop
+ $0 start
+ exit $?
+ ;;
+ status)
+ status acpid
+ exit $?
+ ;;
+ *)
+ msg_usage "$0 {start|stop|restart|reload|force-reload|status}"
+ exit 3
esac
+
+exit $RETVAL