[Pm-utils] POSIXification of pm-utils

Till Maas opensource at till.name
Sun Jan 13 10:36:46 PST 2008

On Sun January 13 2008, Victor Lowther wrote:
> On Jan 13, 2008 2:58 AM, Till Maas <opensource at till.name> wrote:

> > I just noticed this: Here a big change in beheaviour is, that now
> > pm-powersave also evaluates /etc/pm/config.d.
> Yeah, I caught that mistake and fixed it.  The stuff in
> /etc/pm/config.d gets sourced only if you call source_config now.

This breaks at least this hook:

Because now it needs to run source_config() first, otherwise $SUSPEND_MODULES 
is empty. This may be a even bigger change in beheaviour, because every 
user-written hook may be written with the idea in mind 
that . /usr/lib/pm-utils/functions will source the config files, too. But 
imho this is a better beheaviour, than the old one. Maybe source_config() 
should be renamed to source_sleep_config() or similiar, to keep the namespace 
free in case there should be a source_power_config() sometimes. Or maybe it 
should be even called init_sleep_config(), because to make it really clean, 
all the stuff outside of function definitions, i.e.

        4 export PATH=/sbin:/usr/sbin:/bin:/usr/bin:/usr/lib/pm-utils/bin
        6 # Default values go here.  It is important to _not_ initialize some
        7 # variables here.  They are:
        8 #
        9 # PM_CMDLINE
       10 # RESUME_MODULES
       11 #
       12 set -a
       14 INHIBIT=/var/run/pm-utils.inhibit
       15 PM_LOGFILE=${PM_LOGFILE:=/var/log/pm-suspend.log}
       16 SUSPEND_MODULES=""
       17 TEMPORARY_CPUFREQ_GOVERNOR="userspace"
       18 LOCKDIR="/.suspended"
       20 [ -f /usr/lib/pm-utils/defaults ] && . /usr/lib/pm-utils/defaults
       21 set +a

should only be run within the source_config() / init_sleep_config() to avoid 
unwanted side effects. The function then needs to be called before pm_main() 
in pm-action and not within pm_main() btw.

And the export LC_COLLATE from pm-action (line 54) should probably also go 
into init_sleep_config() or be set locally in the funtions that use sort. 
Maybe this expression is also the reason why sort worked unreliable for you.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 827 bytes
Desc: This is a digitally signed message part.
Url : http://lists.freedesktop.org/archives/pm-utils/attachments/20080113/21607da3/attachment.pgp 

More information about the Pm-utils mailing list