]> git.pld-linux.org Git - packages/acpid.git/blame - acpid.init
- make it handle every battery
[packages/acpid.git] / acpid.init
CommitLineData
94f6e9a1
PG
1#!/bin/sh
2#
3# acpid Starts the acpi daemon
4#
5# chkconfig: 345 44 56
6# description: Listen and dispatch ACPI events from the kernel
7# processname: acpid
8#
9# pidfile: /var/run/acpid.pid
10
11# Source function library.
12. /etc/rc.d/init.d/functions
13
d8325167
PG
14# Initial values (just in case):
15LAPTOP_MODULES=""
16VARIOUS_MODULES=""
17ASUS_LAPTOP=""
18TOSHIBA_LAPTOP=""
19
94f6e9a1
PG
20# Configuration file.
21. /etc/sysconfig/acpid
22
94f6e9a1 23RETVAL=0
94f6e9a1
PG
24# See how we were called.
25case "$1" in
c0743e1f 26 start)
94f6e9a1 27 # Start daemons.
c0743e1f 28 if [ ! -f /var/lock/subsys/acpid ]; then
6fcf695c
PG
29 if [ ! -d /proc/acpi/button ]; then
30 _modprobe ospm_button
31 _modprobe button
9f8958e5 32 fi
4cfcd4bc 33 if [ "$(kernelverser)" -lt "002006" ] && is_yes "$MODPROBE_OSPM_SYSTEM"; then
f315a54f
JK
34 _modprobe single ospm_system
35 fi
d8325167 36 # Load additional modules:
a4b7b25d 37 if [ -n "$LAPTOP_MODULES" ]; then
782b6c6f 38 for i in $LAPTOP_MODULES; do
d8325167
PG
39 _modprobe single $i
40 done
a3be5270
PG
41 fi
42 if [ -n "$VARIOUS_MODULES" ]; then
782b6c6f 43 for i in $VARIOUS_MODULES; do
d8325167
PG
44 _modprobe single $i
45 done
46 fi
47 # Determine if it's ASUS or TOSHIBA laptop
48 if is_yes "$ASUS_LAPTOP"; then
49 _modprobe asus_acpi
50 elif is_yes "$TOSHIBA_LAPTOP"; then
51 _modprobe toshiba_acpi
461c3aff 52 elif is_yes "$IBM_LAPTOP"; then
53 _modprobe ibm_acpi
d8325167 54 fi
299a6963
PG
55 # starting:
56 msg_starting acpid $PROGRAM_ARGS
c0743e1f 57 daemon acpid
58 RETVAL=$?
59 [ $RETVAL -eq 0 ] && touch /var/lock/subsys/acpid
60 else
61 msg_already_running acpid
62 fi
63 ;;
64 stop)
65 # Stop daemons.
66 if [ -f /var/lock/subsys/acpid ]; then
67 msg_stopping acpid
68 killproc acpid
69 rm -f /var/lock/subsys/acpid >/dev/null 2>&1
70 else
71 msg_not_running acpid
c0743e1f 72 fi
73 ;;
1b772a07 74 reload|force-reload)
c0743e1f 75 if [ -f /var/lock/subsys/acpid ]; then
76 msg_reloading acpid
c0743e1f 77 killproc acpid -HUP
78 RETVAL=$?
c0743e1f 79 else
c0db550f 80 msg_not_running acpid >&2
1b772a07 81 exit 7
c0743e1f 82 fi
83 ;;
84 restart)
85 $0 stop
86 $0 start
97f1f784 87 exit $?
c0743e1f 88 ;;
89 status)
90 status acpid
97f1f784 91 exit $?
c0743e1f 92 ;;
93 *)
1b772a07 94 msg_usage "$0 {start|stop|restart|reload|force-reload|status}"
95 exit 3
94f6e9a1 96esac
c0743e1f 97
98exit $RETVAL
This page took 0.096594 seconds and 4 git commands to generate.