home *** CD-ROM | disk | FTP | other *** search
/ tusportal.tus.k12.pa.us / tusportal.tus.k12.pa.us.tar / tusportal.tus.k12.pa.us / Wyse / latest-image.raw / 0.img / usr / bin / pm-is-supported < prev    next >
Text File  |  2009-02-20  |  1KB  |  53 lines

  1. #!/bin/bash
  2. #
  3. # Copyright 2007 Red Hat, Inc.
  4. #
  5. # This program is free software; you can redistribute it and/or modify
  6. # it under the terms of version 2 of the GNU General Public License as
  7. # published by the Free Software Foundation.
  8. #
  9. # This program is distributed in the hope that it will be useful,
  10. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  12. # GNU General Public License for more details.
  13. #
  14. # You should have received a copy of the GNU General Public License
  15. # along with this program; if not, write to the Free Software
  16. # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  17. #
  18.  
  19. help_options() {
  20.     echo "pm-is-supported [--suspend | --hibernate | --suspend-hybrid ]"
  21.     echo
  22. }
  23.  
  24. export LC_COLLATE=C
  25.  
  26. ARG=${1#--}
  27.  
  28. [ -f /sys/power/state ] || exit 1
  29.  
  30. case "$ARG" in
  31.     suspend)
  32.         grep -q mem /sys/power/state || exit 1
  33.         ;;
  34.     hibernate)
  35.         [ -f /sys/power/disk ] || exit 1
  36.         grep -q disk /sys/power/state || exit 1
  37.         ;;
  38.     suspend-hybrid)
  39.         grep -q mem /sys/power/state || exit 1
  40.         grep -q disk /sys/power/state || exit 1
  41.         [ -x /usr/sbin/s2both -a -c /dev/snapshot ] || exit 1
  42.         ;;
  43.     help)
  44.         help_options
  45.         ;;
  46.     *)
  47.         help_options 1>&2
  48.         exit 1
  49.         ;;
  50. esac
  51.  
  52. exit 0
  53.