]> git.pld-linux.org Git - packages/acpid.git/blame - acpid.init
- CVE-2009-0798 security blocker
[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
37b4ae3e
ER
23# Start daemons.
24start() {
c0743e1f 25 if [ ! -f /var/lock/subsys/acpid ]; then
121466a7
ER
26 msg_already_running "ACPI Event Daemon"
27 return
28 fi
29
30 if [ ! -d /proc/acpi/button ]; then
31 modprobe -s ospm_button
32 modprobe -s button
33 fi
34 if [ "$(kernelverser)" -lt "002006" ] && is_yes "$MODPROBE_OSPM_SYSTEM"; then
35 modprobe -s ospm_system
36 fi
37 # Load additional modules:
38 if [ -n "$LAPTOP_MODULES" ]; then
39 for i in $LAPTOP_MODULES; do
40 modprobe -s $i
41 done
c0743e1f 42 fi
121466a7
ER
43 if [ -n "$VARIOUS_MODULES" ]; then
44 for i in $VARIOUS_MODULES; do
45 modprobe -s $i
46 done
47 fi
48 # Determine if it's ASUS or TOSHIBA laptop
49 if is_yes "$ASUS_LAPTOP"; then
50 modprobe -s asus_acpi
51 elif is_yes "$TOSHIBA_LAPTOP"; then
52 modprobe -s toshiba_acpi
53 elif is_yes "$IBM_LAPTOP"; then
54 modprobe -s ibm_acpi
55 fi
56
57 # starting:
58 msg_starting "ACPI Event Daemon"
59 daemon /usr/sbin/acpid $PROGRAM_ARGS
60 RETVAL=$?
61 [ $RETVAL -eq 0 ] && touch /var/lock/subsys/acpid
37b4ae3e
ER
62}
63
64# Stop daemons.
65stop() {
121466a7
ER
66 if [ ! -f /var/lock/subsys/acpid ]; then
67 msg_not_running "ACPI Event Daemon"
68 return
69 fi
70
71 msg_stopping "ACPI Event Daemon"
72 killproc acpid
73 rm -f /var/lock/subsys/acpid >/dev/null 2>&1
74}
75
76condrestart() {
77 if [ ! -f /var/lock/subsys/acpid ]; then
78 msg_not_running "ACPI Event Daemon"
79 RETVAL=$1
80 return
c0743e1f 81 fi
121466a7
ER
82
83 stop
84 start
37b4ae3e
ER
85}
86
87RETVAL=0
88# See how we were called.
89case "$1" in
90 start)
91 start
92 ;;
93 stop)
94 stop
95 ;;
96 restart)
97 stop
98 start
c0743e1f 99 ;;
121466a7
ER
100 try-restart)
101 condrestart 0
102 ;;
1b772a07 103 reload|force-reload)
c0743e1f 104 if [ -f /var/lock/subsys/acpid ]; then
121466a7 105 msg_reloading "ACPI Event Daemon"
c0743e1f 106 killproc acpid -HUP
107 RETVAL=$?
c0743e1f 108 else
121466a7 109 msg_not_running "ACPI Event Daemon"
1b772a07 110 exit 7
c0743e1f 111 fi
112 ;;
c0743e1f 113 status)
114 status acpid
115 ;;
116 *)
121466a7 117 msg_usage "$0 {start|stop|restart|try-restart|reload|force-reload|status}"
1b772a07 118 exit 3
94f6e9a1 119esac
c0743e1f 120
121exit $RETVAL
This page took 0.254564 seconds and 4 git commands to generate.