diff options
author | Victor Lowther <victor.lowther@gmail.com> | 2008-03-19 19:48:31 -0500 |
---|---|---|
committer | Victor Lowther <victor.lowther@gmail.com> | 2008-03-19 19:48:31 -0500 |
commit | 53743fa7e2f1248fcaf1e6fe62a8390dcfadffcf (patch) | |
tree | e1ecf605587b56bc0ff9489042c1a2b9259af2c2 /src | |
parent | 5292f700d84d50e40d6690d415ba5f97b39979d4 (diff) |
Rewrite fix for suspend_hybrid in a more elegant fashion
We add a new variable $METHOD in pm-action. It holds the sleep method
we were asked to invoke. $ACTION is chosen baed on the value of METHOD.
Diffstat (limited to 'src')
-rw-r--r-- | src/pm-action.in | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/src/pm-action.in b/src/pm-action.in index c9069ab..b11ef22 100644 --- a/src/pm-action.in +++ b/src/pm-action.in @@ -55,17 +55,17 @@ do shift done -ACTION="$(echo ${0##*pm-} |tr - _)" +METHOD="$(echo ${0##*pm-} |tr - _)" -case "$ACTION" in - suspend) REVERSE=resume ;; - hibernate) REVERSE=thaw ;; - suspend_hybrid) REVERSE=resume ;; - *) echo "Don't know how to ${ACTION}." +"check_$METHOD" || { echo "System does not support $METHOD sleep."; exit 1; } + +case "$METHOD" in + suspend*) ACTION=suspend; REVERSE=resume ;; + hibernate) ACTION=hibernate; REVERSE=thaw ;; + *) echo "Don't know how to ${METHOD}." exit 1 ;; esac -"check_$ACTION" || { echo "System does not support $ACTION sleep."; exit 1; } init_logfile "${PM_LOGFILE}" log "Initial commandline parameters: $PM_CMDLINE" load_hook_blacklist @@ -78,7 +78,7 @@ rm -f "${INHIBIT}" run_hooks sleep "$ACTION" # Sleep only if we know how and if a hook did not inhibit us. -command_exists "do_$ACTION" && [ ! -e "$INHIBIT" ] && { sync; "do_$ACTION"; } +command_exists "do_$METHOD" && [ ! -e "$INHIBIT" ] && { sync; "do_$METHOD"; } # run the sleep hooks in reverse with the wakeup action run_hooks sleep "$REVERSE" reverse |