[Pm-utils] [PATCH 6/6] Impliment module autoloading.
Victor Lowther
victor.lowther at gmail.com
Wed Sep 17 20:23:06 PDT 2008
We can now autodetect the proper sleep methods, and the sleep modules
are stackable.
---
pm/pm-functions.in | 15 +++++++++------
1 files changed, 9 insertions(+), 6 deletions(-)
diff --git a/pm/pm-functions.in b/pm/pm-functions.in
index 3690cc9..dfbbc9f 100644
--- a/pm/pm-functions.in
+++ b/pm/pm-functions.in
@@ -240,13 +240,16 @@ check_suspend() { [ -n "$SUSPEND_MODULE" ]; }
check_hibernate() { [ -n "$HIBERNATE_MODULE" ]; }
check_suspend_hybrid() { [ -n "$SUSPEND_HYBRID_MODULE" ]; }
-SLEEP_FUNCTIONS="${PM_UTILS_LIBDIR}/module.d/${SLEEP_MODULE}"
-[ -f "${SLEEP_FUNCTIONS}" ] || {
- echo "Requested sleep module $SLEEP_MODULE not available."
- exit 1
-}
+# allow autodetection of sleep methods
+if [ "$SLEEP_MODULE" = "auto" ]; then
+ SLEEP_MODULE="tuxonice uswsusp"
+fi
-. "${SLEEP_FUNCTIONS}"
+for mod in $SLEEP_MODULE; do
+ mod="${PM_UTILS_LIBDIR}/module.d/${mod}"
+ [ -f "$mod" ] || continue
+ . "$mod"
+done
# always fall back to kernel methods if nothing else was declared
--
1.5.6.5
More information about the Pm-utils
mailing list