summaryrefslogtreecommitdiff
path: root/pm/HOWTO.hooks
diff options
context:
space:
mode:
authorVictor Lowther <victor.lowther@gmail.com>2008-02-05 16:09:04 -0600
committerVictor Lowther <victor.lowther@gmail.com>2008-02-07 17:26:50 -0600
commit558c2fbfb3157a0d18d66dd8b6b34a2c24c61164 (patch)
treef7a7d8007c38c6d2b501d4898e6587da63eeda8c /pm/HOWTO.hooks
parent8df496aeffe3a7114fa01912d7605693c5bc64b9 (diff)
Simplify hook implementation.
modified: pm/HOWTO.hooks modified: pm/functions.in modified: pm/sleep.d/Makefile.am deleted: pm/sleep.d/zzz * Merge the functionality of find_hooks and run_hooks. This results in a new run_hooks function which is much simpler than the old one and is much more resistant to breaking due to odd filenames. * Actually implements the functionality mentioned in README where you can create a nonexecutable file in /etc/pm/(sleep|power).d that will prevent the copy in /usr/lib/pm-utils/(sleep|power).d from running. * Undoes the "nonzero exit code means do not run on resume" and auto-reverse pseudofeatures I added in the POSIX series. If anyone likes them, they can be added back at the cost of either passing a function to run_hooks or maintaining a global variable. * Merges the functionality that was in zzz back into pm_main. Although zzz was a slightly funny name, upon further reflection it was a bad idea and makes it harder to implement some partitioning of functionality that will be needed if/when the hooks are split into their own project. * Updates the documentation to reflect these changes.
Diffstat (limited to 'pm/HOWTO.hooks')
-rw-r--r--pm/HOWTO.hooks16
1 files changed, 2 insertions, 14 deletions
diff --git a/pm/HOWTO.hooks b/pm/HOWTO.hooks
index 482af72..43fe40d 100644
--- a/pm/HOWTO.hooks
+++ b/pm/HOWTO.hooks
@@ -26,20 +26,8 @@ All hooks are run in lexical sort order according to the C locale.
SLEEP.D SPECIFIC NOTES
For any given sleep/wakeup cycle, the hooks in sleep.d are run twice:
-Once in C lexical sort order before the system goes to sleep, and
-Once in reverse C lexical sort order when the system wakes up.
-
-If a hook does not need to be run when waking up, it SHOULD return a non-zero
-exit code -- this will signal the hook-running infrastructure to skip that
-hook when waking up.
-
-Similarly, if your hook only needs to run on system with certain specific
-configurations (such as the (0|9)5led hooks, which are IBM specific),
-or relies on certain specific commands that are not guaranteed to be present
-(such as the 10NetworkManager hook, which relies on D-Bus and Network Manager
-both being present), you SHOULD test for those conditions first and you SHOULD
-return a non-zero exit code if your hook is not applicable to the system it
-is running on.
+* Once in C lexical sort order before the system goes to sleep, and
+* Once in reverse C lexical sort order when the system wakes up.
CONVENIENCE FUNCTIONS