[Pm-utils] [patch] fix sourcing of the config files in /etc/pm/config.d/

Stefan Seyfried seife at suse.de
Thu Mar 15 15:31:10 PDT 2007


Hi,

The GLOBAL_CONFIG_VARIABLES stuff was IIUC there to "protect" the
variables that were set in /etc/pm/config from being overwritten in
the config files in /etc/pm/config.d/*
Now that /etc/pm/config has moved to /usr/lib/pm-utils, it should no
longer be edited and we actually need /etc/pm/config.d/* to override
these variables.

Additionally, /etc/pm/config.d/* did not work at all, since the variables
set in these config files were never exported.

This patch fixes this, and gets rid of the now unnecessarily complex
GLOBAL_CONFIG_VARIABLES stuff.

IMHO this is an important fix, since you cannot configure anything
without it.

Index: pm/functions
===================================================================
RCS file: /cvs/pm-utils/pm-utils/pm/functions,v
retrieving revision 1.41
diff -u -p -r1.41 functions
--- pm/functions	15 Mar 2007 00:42:56 -0000	1.41
+++ pm/functions	15 Mar 2007 22:24:03 -0000
@@ -16,32 +16,23 @@ TEMPORARY_CPUFREQ_GOVERNOR="userspace"
 
 [ -f /usr/lib/pm-utils/defaults ] && . /usr/lib/pm-utils/defaults
 
-GLOBAL_CONFIG_VARIABLES=""
-add_global() {
-	export $1
-	GLOBAL_CONFIG_VARIABLES="$GLOBAL_CONFIG_VARIABLES $1"
-}
-
 # export them all here
-add_global HIBERNATE_RESUME_POST_VIDEO
-add_global INHIBIT
-add_global PM_LOGFILE
-add_global PM_CMDLINE
-add_global RESUME_MODULES
-add_global SUSPEND_MODULES
-add_global TEMPORARY_CPUFREQ_GOVERNOR
+export HIBERNATE_RESUME_POST_VIDEO
+export INHIBIT
+export PM_LOGFILE
+export PM_CMDLINE
+export RESUME_MODULES
+export SUSPEND_MODULES
+export TEMPORARY_CPUFREQ_GOVERNOR
 
 source_configs()
 {
 	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
+		set -a
+		. $cfg
+		set +a
 	done
 }
 
-- 
Stefan Seyfried

"Any ideas, John?"
"Well, surrounding them's out." 


More information about the Pm-utils mailing list