diff options
Diffstat (limited to 'src/pm-action.in')
-rw-r--r-- | src/pm-action.in | 38 |
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 $? |