[Pm-utils] POSIXification of pm-utils

Till Maas opensource at till.name
Sun Jan 13 00:58:12 PST 2008


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.

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


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

Regards,
Till
-------------- 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/ef784ccd/attachment.pgp 


More information about the Pm-utils mailing list