| 1 |
#! /bin/sh |
| 2 |
|
| 3 |
# Watch out: we also check for the nonexistence of /proc/pmu because |
| 4 |
# some kernel versions emulate /proc/apm for PMU hardware. |
| 5 |
if [ ! -f /proc/apm -o -d /proc/pmu ] ; then |
| 6 |
APM_FOUND=0 |
| 7 |
elif [ ! -f /usr/sbin/apmd] ; then |
| 8 |
echo APM support found in the kernel but apmd is not installed. Laptop mode |
| 9 |
echo will NOT be enabled automatically using APM. |
| 10 |
APM_FOUND=1 |
| 11 |
else |
| 12 |
APM_FOUND=1 |
| 13 |
fi |
| 14 |
|
| 15 |
if [ ! -d /proc/acpi/ac_adapter ] ; then |
| 16 |
ACPI_FOUND=0 |
| 17 |
elif [ ! -f /usr/sbin/acpid ] ; then |
| 18 |
echo ACPI support found in the kernel, but acpid is not installed. Laptop mode |
| 19 |
echo will NOT be enabled automatically using ACPI. |
| 20 |
ACPI_FOUND=1 |
| 21 |
else |
| 22 |
ACPI_FOUND=1 |
| 23 |
fi |
| 24 |
|
| 25 |
if [ ! -d /proc/pmu ] ; then |
| 26 |
PMU_FOUND=0 |
| 27 |
elif [ ! -f /sbin/pmud -a ! -f /sbin/pbbuttonsd ] ; then |
| 28 |
echo PMU support found in the kernel, but neither pmud nor pbbuttonsd is |
| 29 |
echo installed. Laptop mode will NOT be enabled automatically. If you want |
| 30 |
echo to start laptop mode automatically, install either pmud or pbbuttonsd, |
| 31 |
echo and then *manually* edit /etc/power/pwrctl-local to call |
| 32 |
echo "/usr/sbin/laptop_mode auto". |
| 33 |
PMU_FOUND=1 |
| 34 |
else |
| 35 |
PMU_FOUND=1 |
| 36 |
fi |
| 37 |
|
| 38 |
if [ $PMU_FOUND -ne 0 -a -f /etc/apm/event.d/laptop-mode ] ; then |
| 39 |
# This is a HACK. We install the apm thing always but simply remove |
| 40 |
# it afterwards. I haven't found out how to make dpkg install these |
| 41 |
# things conditionally (like the install.sh does) unless I take them |
| 42 |
# out of the package and install them manually in the postinst. :( |
| 43 |
rm /etc/apm/event.d/laptop-mode |
| 44 |
fi |
| 45 |
|
| 46 |
if [ $APM_FOUND -eq 0 -a $ACPI_FOUND -eq 0 -a $PMU_FOUND=0 ] ; then |
| 47 |
echo "Warning: No ACPI, APM or PMU support was found in the running kernel. To" |
| 48 |
echo "be able to start laptop mode automatically when running on battery, you" |
| 49 |
echo "must recompile your kernel with support for ACPI/APM/PMU (depending on" |
| 50 |
echo "what your computer supports). It is possible that your computer supports" |
| 51 |
echo "none of these. If this is the case, then you must control laptop mode" |
| 52 |
echo "manually, using the laptop_mode command, or you can enable the " |
| 53 |
echo "ENABLE_LAPTOP_MODE_ON_AC option in the configuration file" |
| 54 |
echo "/etc/laptop-mode/laptop-mode.conf." |
| 55 |
fi |
| 56 |
|
| 57 |
exit 0 |