]>
Commit | Line | Data |
---|---|---|
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): |
15 | LAPTOP_MODULES="" | |
16 | VARIOUS_MODULES="" | |
17 | ASUS_LAPTOP="" | |
18 | TOSHIBA_LAPTOP="" | |
19 | ||
94f6e9a1 PG |
20 | # Configuration file. |
21 | . /etc/sysconfig/acpid | |
22 | ||
94f6e9a1 PG |
23 | |
24 | RETVAL=0 | |
94f6e9a1 PG |
25 | # See how we were called. |
26 | case "$1" in | |
c0743e1f | 27 | start) |
94f6e9a1 | 28 | # Start daemons. |
c0743e1f | 29 | if [ ! -f /var/lock/subsys/acpid ]; then |
6fcf695c PG |
30 | if [ ! -d /proc/acpi/button ]; then |
31 | _modprobe ospm_button | |
32 | _modprobe button | |
9f8958e5 | 33 | fi |
f315a54f JK |
34 | if is_yes "$MODPROBE_OSPM_SYSTEM"; then |
35 | _modprobe single ospm_system | |
36 | fi | |
d8325167 | 37 | # starting: |
c0743e1f | 38 | msg_starting acpid $PROGRAM_ARGS |
d8325167 | 39 | # Load additional modules: |
a4b7b25d | 40 | if [ -n "$LAPTOP_MODULES" ]; then |
d8325167 PG |
41 | for i in "$LAPTOP_MODULES"; do |
42 | _modprobe single $i | |
43 | done | |
a4b7b25d | 44 | elif [ -n "$VARIOUS_MODULES" ]; then |
d8325167 PG |
45 | for i in "$VARIOUS_MODULES"; do |
46 | _modprobe single $i | |
47 | done | |
48 | fi | |
49 | # Determine if it's ASUS or TOSHIBA laptop | |
50 | if is_yes "$ASUS_LAPTOP"; then | |
51 | _modprobe asus_acpi | |
52 | elif is_yes "$TOSHIBA_LAPTOP"; then | |
53 | _modprobe toshiba_acpi | |
54 | fi | |
c0743e1f | 55 | daemon acpid |
56 | RETVAL=$? | |
57 | [ $RETVAL -eq 0 ] && touch /var/lock/subsys/acpid | |
58 | else | |
59 | msg_already_running acpid | |
60 | fi | |
61 | ;; | |
62 | stop) | |
63 | # Stop daemons. | |
64 | if [ -f /var/lock/subsys/acpid ]; then | |
65 | msg_stopping acpid | |
66 | killproc acpid | |
67 | rm -f /var/lock/subsys/acpid >/dev/null 2>&1 | |
68 | else | |
69 | msg_not_running acpid | |
c0743e1f | 70 | fi |
71 | ;; | |
1b772a07 | 72 | reload|force-reload) |
c0743e1f | 73 | if [ -f /var/lock/subsys/acpid ]; then |
74 | msg_reloading acpid | |
c0743e1f | 75 | killproc acpid -HUP |
76 | RETVAL=$? | |
c0743e1f | 77 | else |
c0db550f | 78 | msg_not_running acpid >&2 |
1b772a07 | 79 | exit 7 |
c0743e1f | 80 | fi |
81 | ;; | |
82 | restart) | |
83 | $0 stop | |
84 | $0 start | |
97f1f784 | 85 | exit $? |
c0743e1f | 86 | ;; |
87 | status) | |
88 | status acpid | |
97f1f784 | 89 | exit $? |
c0743e1f | 90 | ;; |
91 | *) | |
1b772a07 | 92 | msg_usage "$0 {start|stop|restart|reload|force-reload|status}" |
93 | exit 3 | |
94f6e9a1 | 94 | esac |
c0743e1f | 95 | |
96 | exit $RETVAL |