diff options
author | Victor Lowther <victor.lowther@gmail.com> | 2008-03-01 19:10:44 -0600 |
---|---|---|
committer | Victor Lowther <victor.lowther@gmail.com> | 2008-03-01 19:10:44 -0600 |
commit | 053da7a5efd23b23527d073c0e63785211c4c954 (patch) | |
tree | c40d1508c742dba8b73d168d8a9c652302bd892d /src/pm-action.in | |
parent | 6d877fe5e1439496b20365e6877916ab3c7446f2 (diff) | |
parent | 25b94082bc1588f5c9a2dc4be857531c774b8b2b (diff) |
Merge branch 'vlowther-video-merge' into vlowther-hook-option-processing
Diffstat (limited to 'src/pm-action.in')
-rw-r--r-- | src/pm-action.in | 19 |
1 files changed, 18 insertions, 1 deletions
diff --git a/src/pm-action.in b/src/pm-action.in index fe8ed6a..82aa295 100644 --- a/src/pm-action.in +++ b/src/pm-action.in @@ -62,4 +62,21 @@ case "$ACTION" in exit 1 ;; esac -pm_main "${ACTION}" "${REVERSE}" +"check_$ACTION" || { echo "System does not support $ACTION sleep."; exit 1; } +take_suspend_lock || exit 1 + +# make sure we release the lock no matter how we exit +trap remove_suspend_lock 0 +init_logfile "${PM_LOGFILE}" + +# Make sure we are not inhibited before we start. +rm -f "${INHIBIT}" + +# run the sleep hooks +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"; } + +# run the sleep hooks in reverse with the wakeup action +run_hooks sleep "$REVERSE" reverse |