[Pm-utils] function source_configs?

Peter Jones pjones at redhat.com
Mon Oct 30 07:34:55 PST 2006


On Mon, 2006-10-30 at 10:15 +0100, Stefan Seyfried wrote:

> > +       cfgs="/etc/pm/config.d/*[^~]"
> > +       for cfg in $cfgs ; do
> > +               [ -x $cfg ] || continue
> 
> until now, config files did not need the eXecutable bit set, so this needs to
> be documented (or [ -r $cfg ] ||...).

Documentation would be the way; I want the -x convention, same as in
e.g. /etc/profile.d , to make it easy for a user turn hooks off without
losing them completely.

> 
> > +               while read LINE ; do
> > +                       case "$GLOBAL_CONFIG_VARIABLES " in
> 
> Here we'll need to do     case " $GLOBAL_CONFIG_VARIABLES "...
>
> > +                               *" ${LINE%=*} "*) continue ;;
> 
> ... otherwise this will not match for the first GLOBAL_CONFIG-variable.

Er, no... We _don't_ test if it's empty when appending, nor use the
${FOO:+${FOO} } trick.  So the initial setup is:

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 SUSPEND_MODULES

Which means the initial progression is:

""
" HIBERNATE_RESUME_POST_VIDEO"
" HIBERNATE_RESUME_POST_VIDEO SUSPEND_MODULES"

etc.  So *" HIBERNATE_RESUME_POST_VIDEO *" will match
"$GLOBAL_CONFIG_VARIABLES ".

> Other than that, fine with me (if it works, i did not test it :-))

It works on my box ;)

-- 
  Peter



More information about the Pm-utils mailing list