3
# Check for daemon presence
4
test -x /usr/sbin/acpid || exit 0
6
# Check for ACPI support on kernel side
7
[ -d /proc/acpi ] || exit 0
9
# Include acpid defaults if available
11
if [ -f /etc/default/acpid ] ; then
16
. /lib/lsb/init-functions
19
if [ "x$VERBOSE" = "xno" ]; then
20
MODPROBE_OPTIONS="$MODPROBE_OPTIONS -Q"
21
export MODPROBE_OPTIONS
24
# As the name says. If the kernel supports modules, it'll try to load
25
# the ones listed in "MODULES".
27
PRINTK=`cat /proc/sys/kernel/printk`
28
[ "$VERBOSE" = no ] && echo "0 0 0 0" > /proc/sys/kernel/printk
30
LIST=`/sbin/lsmod|awk '!/Module/ {print $1}'`
32
# Get list of available modules
33
LOC="/lib/modules/`uname -r`/kernel/drivers/acpi"
35
MODAVAIL=`( find $LOC -type f -name "*.o" -printf "basename %f .o\n"; \
36
find $LOC -type f -name "*.ko" -printf "basename %f .ko\n" ) | /bin/sh`
41
if [ "$MODULES" = "all" ]; then
45
if [ -n "$MODULES" ]; then
46
log_begin_msg "Loading ACPI modules..."
48
for mod in $MODULES; do
49
echo $MODAVAIL | grep -q -w "$mod" || continue
50
if echo $LIST | grep -q -w "$mod"; then
51
[ "$VERBOSE" != no ] && log_success_msg "Module already loaded: $mod"
53
if modprobe $mod 2>/dev/null; then
54
[ "$VERBOSE" != no ] && log_success_msg "Loaded module: $mod"
56
if [ "$VERBOSE" != no ]; then
57
log_warning_msg "Unable to load module: $mod"
64
echo "$PRINTK" > /proc/sys/kernel/printk
69
[ -f /proc/modules ] && load_modules
70
log_begin_msg "Starting ACPI services..."
71
start-stop-daemon --start --quiet --exec /usr/sbin/acpid -- -c /etc/acpi/events $OPTIONS
75
log_begin_msg "Stopping ACPI services..."
76
start-stop-daemon --stop --quiet --oknodo --retry 2 --exec /usr/sbin/acpid
85
log_begin_msg "Reloading ACPI services..."
86
start-stop-daemon --stop --signal 1 --exec /usr/sbin/acpid
90
log_success_msg "Usage: /etc/init.d/acpid {start|stop|restart|reload|force-reload}"