On Fri, Oct 06, 2006 at 01:35:37PM +0200, Stefan Seyfried wrote:
> Hi,
> 
> this is needed to make the function source_configs do anything remotely
> useful at all:

> Should it just prevent the overwriting of the GLOBAL_CONFIG_VARIABLES by
> other config files?

If so, this should achieve that goal:

--- functions   2006-10-05 17:38:10.000000000 +0200
+++ functions.new       2006-10-06 14:49:45.000000000 +0200
 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
+       for cfg in $(ls -1 /etc/pm/config.d/*[^~] 2>/dev/null) ; do
+               while read LINE; do
+                       SKIP=false
+                       for v in $GLOBAL_CONFIG_VARIABLES ; do
+                               case "$LINE" in
+                                       $v=*)   SKIP=true ;;
+                               esac
+                       done
+                       $SKIP && continue
+                       eval $LINE
+               done < $cfg
        done
 }


-- 
Stefan Seyfried                  \ "I didn't want to write for pay. I
QA / R&D Team Mobile Devices      \ wanted to be paid for what I write."
SUSE LINUX Products GmbH, Nürnberg \                    -- Leonard Cohen
_______________________________________________
Pm-utils mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/pm-utils

Reply via email to