home *** CD-ROM | disk | FTP | other *** search
/ Personal Computer World 2007 September / PCWSEP07.iso / Software / Linux / Linux Mint 3.0 Light / LinuxMint-3.0-Light.iso / casper / filesystem.squashfs / etc / init.d / acpi-support < prev    next >
Encoding:
Text File  |  2006-03-28  |  867 b   |  40 lines

  1. #!/bin/bash
  2. # INIT script to check whether we're on batteries, and so start with laptop 
  3. # mode etc enabled.
  4.  
  5. # BUGS: unless we start *really* late, we have no way of throttling 
  6. # xscreensaver, since it won't be there to command.
  7. . /usr/share/acpi-support/power-funcs
  8.  
  9. test -f /lib/lsb/init-functions || exit 1
  10. . /lib/lsb/init-functions
  11.  
  12. test -d /var/lib/acpi-support || exit 0
  13.  
  14. shopt -s nullglob
  15.  
  16. case "$1" in
  17.   start)
  18.     log_begin_msg "Checking battery state..."
  19.     if [ `echo /proc/acpi/ac_adapter/*` ]; then 
  20.     /etc/acpi/power.sh
  21.     fi
  22.     # Source everything in /etc/acpi/start.d/
  23.     for SCRIPT in /etc/acpi/start.d/*.sh; do
  24.     . $SCRIPT
  25.     done
  26.     log_end_msg 0
  27.     ;;
  28.   stop)
  29.     log_begin_msg "Disabling power management..."
  30.     if [ `echo /proc/acpi/ac_adapter/*` ]; then
  31.     /etc/acpi/power.sh stop
  32.     fi
  33.     log_end_msg 0
  34.     ;;
  35.   *)
  36.   ;;
  37. esac
  38.         
  39.  
  40.