home *** CD-ROM | disk | FTP | other *** search
/ Chip 2007 January, February, March & April / Chip-Cover-CD-2007-02.iso / boot / i386 / rescue / usr / lib / hal / scripts / linux / hal-system-power-set-power-save-linux < prev    next >
Text File  |  2006-11-29  |  898b  |  45 lines

  1. #!/bin/sh
  2. read value
  3.  
  4. unsupported() {
  5.     echo org.freedesktop.Hal.Device.SystemPowerManagement.NotSupported >&2
  6.     echo No powersave method found >&2
  7.     exit 1
  8. }
  9.  
  10. #SuSE and ALTLinux only support powersave
  11. if [ -f /etc/altlinux-release ] || [ -f /etc/SuSE-release ] ; then
  12.     if [ -x "/usr/bin/powersave" ] ; then
  13.         if [ $value = "true" ]; then
  14.             /usr/bin/powersave -e Powersave
  15.             RET=$?
  16.         elif [ $value = "false" ]; then
  17.             /usr/bin/powersave -e Performance
  18.             RET=$?
  19.         fi
  20.     else
  21.         unsupported
  22.     fi
  23.  
  24. #RedHat/Fedora only support pm-utils
  25. elif [ -f /etc/redhat-release ] || [ -f /etc/fedora-release ] ; then
  26.     if [ -x "/usr/sbin/pm-powersave" ] ; then
  27.         if [ $value = "true" ]; then
  28.             /usr/sbin/pm-powersave true
  29.             RET=$?
  30.         elif [ $value = "false" ]; then
  31.             /usr/sbin/pm-powersave false
  32.             RET=$?
  33.         fi
  34.     else
  35.         unsupported
  36.     fi
  37.  
  38. else
  39.     # cannot set proc stuff here, so error out
  40.     unsupported
  41.     fi 
  42.  
  43. exit $RET
  44.  
  45.