[Pm-utils] POSIXification of pm-utils

Victor Lowther victor.lowther at gmail.com
Sun Jan 13 08:49:35 PST 2008

On Jan 13, 2008 2:58 AM, Till Maas <opensource at till.name> wrote:
> On Sun January 13 2008, Till Maas wrote:
> > On Sun January 13 2008, Victor Lowther wrote:
> > > Major changes:
> > > * Renamed the hooks directory to sleep.d
> >
> > I like this
> 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.

> > http://hg.fnordovax.org/pm-utils/file/4ec061123d4f/src/pm/functions
> >        58     local bases=$(for f in $syshooks/*[!~] $phooks/*[!~];
> >        59             do echo ${f##*/} ; done |
> >        60             sed 's/\*\[\!\^\]//g' |sort -n | uniq)
> >
> > I guess the "^" should be a "~" in the sed regular expression. I do not
> > know, but is there no nicer solution to implement the bash "nullglob"
> > feature? Repeating the pathname-expansion pattern with a lot of backslashes
> > for sed.
> The only other solution I know would be something like
> for file in $(ls $syshooks/*[!~] $phooks/*[!~])
> do
>  echo ${f##*/}
> done | sort -n | uniq
> But this breaks when there are spaces in filenames.

Heh, the folks who hang out in #bash (myself included) have flamed
people nearly to death for parsing the output of ls in production
code. :)

> A change I wanted to suggest but forgot to do and that would at least simplify
> the sed regex in you solution would be to add a commond suffix to hooks (and
> config files), e.g. .hook and .conf. Then it would be
> for file in $syshooks/*.hook $phooks/*.hook
> This would be needed when files are added/removed by rpm and
> a .rpmsave/.rpmorig/.rpmnew file is created. Otherwise config files and hooks
> may be read/run several times.

A good suggestion, but it goes against the convention set by
/etc/rc?.d/*, and I would rather not go against that for now.  The zzz
thing is probably going too far already, but it has the excuse of
being funny.

> Btw. 90clock uses tabs and spaces for indentation, maybe you want to change it
> to use only tabs.

thanks.  Will fix that.

> Regards,
> Till

Victor Lowther
Ubuntu Certified Professional

More information about the Pm-utils mailing list