[Pm-utils] POSIXification of pm-utils

Victor Lowther victor.lowther at gmail.com
Sun Jan 13 11:17:04 PST 2008


On Jan 13, 2008 12:36 PM, Till Maas <opensource at till.name> wrote:
> 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:
> http://hg.fnordovax.org/pm-utils/file/73184527be5d/pm/sleep.d/50modules
>
> 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.
>
> http://hg.fnordovax.org/pm-utils/file/73184527be5d/pm/functions
>         4 export PATH=/sbin:/usr/sbin:/bin:/usr/bin:/usr/lib/pm-utils/bin
>         5
>         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
>        13 HIBERNATE_RESUME_POST_VIDEO=no
>        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"
>        19
>        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.

Good points -- I was not thinking of the hooks when I made that
change.  Another option would be to have suspend_config (or whatever
it ends up betting renamed to) automatically export any environment
variables that are set during the config.

For now, though, I have gone ahead and reverted the suspend_config
changes for now -- I would like to get some sort of consensus for any
wider-reaching changes

> 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.

Moved to LC_COLLATE to the functions file.

> Regards,
> Till

-- 
Victor Lowther
Ubuntu Certified Professional


More information about the Pm-utils mailing list