summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVictor Lowther <victor.lowther@gmail.com>2008-03-01 18:50:27 -0600
committerVictor Lowther <victor.lowther@gmail.com>2008-03-01 18:50:27 -0600
commit4ccda76bcc288f5505abc97caffb913d35e71c26 (patch)
treed939293e7683a35aeb9faa32408d49eaa2e4fc08
parente5c47367b743af80155176d69c1f4e7ca69843c6 (diff)
Add comments in pm-action detailing the steps we are taking.
-rw-r--r--src/pm-action.in10
1 files changed, 9 insertions, 1 deletions
diff --git a/src/pm-action.in b/src/pm-action.in
index 7090b57..e87b7f8 100644
--- a/src/pm-action.in
+++ b/src/pm-action.in
@@ -101,12 +101,20 @@ esac
export PM_CMDLINE="$@"
"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