diff options
author | Victor Lowther <victor.lowther@gmail.com> | 2008-03-01 19:06:48 -0600 |
---|---|---|
committer | Victor Lowther <victor.lowther@gmail.com> | 2008-03-01 19:06:48 -0600 |
commit | 25b94082bc1588f5c9a2dc4be857531c774b8b2b (patch) | |
tree | bfb56f05eb88727c8a250ef310cf1d71b8191be5 /src | |
parent | 8330c3a6c14ba33563ddcf76fe53288a4f1cb9ab (diff) | |
parent | 4ccda76bcc288f5505abc97caffb913d35e71c26 (diff) |
Merge branch 'master' into vlowther-video-merge
Diffstat (limited to 'src')
-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 3fe476b..f76f9ae 100644 --- a/src/pm-action.in +++ b/src/pm-action.in @@ -90,4 +90,21 @@ esac export PM_CMDLINE="$@" -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 |