[Pm-utils] [PATCH 2/2] Added support for passing default parameters.

Victor Lowther victor.lowther at gmail.com
Tue Mar 11 18:23:38 PDT 2008


We add them in the  "$PM_UTILS_ETCDIR/parameters" file, and they are
simply appended to the PM_CMDLINE env variable.

This implementation is very simplistic, but it Works For Me (tm) in the only
use I have for it, which is to add "--quirk-none" to the list of parameters.

---
 pm/pm-functions.in |   13 +++++++++++++
 1 files changed, 13 insertions(+), 0 deletions(-)

diff --git a/pm/pm-functions.in b/pm/pm-functions.in
index bdea9c9..197c002 100644
--- a/pm/pm-functions.in
+++ b/pm/pm-functions.in
@@ -63,6 +63,19 @@ mkdir -p "$STORAGEDIR"
 	done
 }
 
+[ -f "$PM_UTILS_ETCDIR/parameters" ] && {
+	# loop through the parameters file, and add each line in it to the
+	# end of PM_CMDLINE.
+	# Comments begin with hashmarks and run to the end of the line.
+	# Because we are modifying an env var, the while read loop cannot
+	# run in a pipe.
+	while read parameter; do
+		parameter="$(echo $parameter |sed 's,#.*$,,g')"
+		[ -z "$parameter" ] && continue
+		PM_CMDLINE="${PM_CMDLINE} $parameter"
+	done < "$PM_UTILS_ETCDIR/parameters"
+}
+
 take_suspend_lock()
 {
 	VT=$(fgconsole)
-- 
1.5.4.3



More information about the Pm-utils mailing list