[Pm-utils] function source_configs?

Stefan Seyfried seife at suse.de
Tue Nov 28 12:47:14 PST 2006


On Mon, Oct 30, 2006 at 10:34:55AM -0500, Peter Jones wrote:

> > Other than that, fine with me (if it works, i did not test it :-))
> 
> It works on my box ;)

Ping. This is not yet committed to CVS (yes, it works for me, too :-)

Index: pm/functions
===================================================================
RCS file: /cvs/pm-utils/pm-utils/pm/functions,v
retrieving revision 1.30
diff -u -p -r1.30 functions
--- pm/functions	14 Nov 2006 16:01:30 -0000	1.30
+++ pm/functions	20 Nov 2006 17:55:43 -0000
@@ -31,16 +31,15 @@ add_global SUSPEND_MODULES
 
 source_configs()
 {
-	for cfg in $(ls -1 /etc/pm/config.d/* 2>/dev/null) ; do
-		[[ "$cfg" =~ ".*~$" ]] && continue
-		STR=". $cfg"
-		for v in $GLOBAL_CONFIG_VARIABLES ; do
-			STR="$STR ; echo x_$v=\"\$(eval echo \$$v)\""
-		done
-		eval $(bash -c "$STR")
-		for v in $GLOBAL_CONFIG_VARIABLES ; do
-			eval $v="$(eval echo $(eval echo \$$v) \$x_$v)"
-		done
+	cfgs="/etc/pm/config.d/*[^~]"
+	for cfg in $cfgs ; do
+		[ -x $cfg ] || continue
+		while read LINE ; do
+			case "$GLOBAL_CONFIG_VARIABLES " in
+				*" ${LINE%=*} "*) continue ;;
+				*) eval $LINE ;;
+			esac
+		done < $cfg
 	done
 }
 
-- 
Stefan Seyfried
QA / R&D Team Mobile Devices        |              "Any ideas, John?"
SUSE LINUX Products GmbH, Nürnberg  | "Well, surrounding them's out." 


More information about the Pm-utils mailing list