summaryrefslogtreecommitdiff
path: root/src/pm-action.in
diff options
context:
space:
mode:
authorVictor Lowther <victor.lowther@gmail.com>2008-02-13 20:52:34 -0600
committerVictor Lowther <victor.lowther@gmail.com>2008-02-13 20:52:34 -0600
commit4d455cec32aefbd9bbc89587fb5676e280e76914 (patch)
tree858f2f7f9933af51a8e1b2813ccec3a7262b787f /src/pm-action.in
parent30ce87e6e801060653b450f5452619eb47f63082 (diff)
parent03a59b39d415366cb7068886f103db8fa6ef6aac (diff)
Merge branch 'master' into vlowther-move-pm-main
Conflicts: pm/functions.in src/pm-action.in
Diffstat (limited to 'src/pm-action.in')
-rw-r--r--src/pm-action.in38
1 files changed, 9 insertions, 29 deletions
diff --git a/src/pm-action.in b/src/pm-action.in
index b1a8bf6..894b50b 100644
--- a/src/pm-action.in
+++ b/src/pm-action.in
@@ -87,36 +87,14 @@ done
export PM_FUNCTIONS="@PM-UTILS-LIBDIR@/functions"
. "${PM_FUNCTIONS}"
-[ -f /sys/power/state ] || exit 1
-
-
-ACTION=${0##*pm-}
+ACTION="$(echo ${0##*pm-} |tr - _)"
case "$ACTION" in
- suspend)
- if ! pm-is-supported --"$ACTION" ; then
- echo "Error: kernel cannot suspend to ram." 1>&2
- exit 1
- fi
- REVERSE=resume
- ;;
- hibernate)
- if ! pm-is-supported --"$ACTION" ; then
- echo "Error: kernel cannot suspend to disk." 1>&2
- exit 1
- fi
- REVERSE=thaw
- ;;
- suspend-hybrid)
- if ! pm-is-supported --"$ACTION" ; then
- echo "Error: hybrid suspend is not supported." 1>&2
- exit
- fi
- REVERSE=resume
- ;;
- *)
- exit 1
- ;;
+ suspend) REVERSE=resume ;;
+ hibernate) REVERSE=thaw ;;
+ suspend_hybrid) REVERSE=resume ;;
+ *) echo "Don't know how to ${ACTION}."
+ exit 1 ;;
esac
export PM_CMDLINE="$@"
@@ -125,6 +103,8 @@ take_suspend_lock || exit 1
trap remove_suspend_lock 0
init_logfile "${PM_LOGFILE}"
rm -f "${INHIBIT}"
-run_hooks sleep "$(echo $ACTION | tr - _)" reverse "$REVERSE"
+run_hooks sleep $ACTION
+"do_$ACTION"
+reverse "$REVERSE"
exit $?