Java Mailing List Archive

http://www.redhatconfig.com/

Home » Mandriva Cooker »

Re: [Cooker] Re: [RPM] cooker main/release tcb-1.0.2-8mdv2009.0

Vincent Danen

2008-06-16

Replies: Find Java Web Hosting

Author LoginPost Reply
* [2008-06-16 15:42:32 +0200] Thierry Vignaud wrote:

>> >The %_preun_service macro is expanded during build time, and passed "nscd || :"
>> >as arguments:
>> >
>> >$ rpm --eval '%_preun_service nscd || : sdf3 sdf sdf sdf'
>> >/usr/share/rpm-helper/del-service %{name} $1 nscd
>>
>> dOh! Ok, well that explains that. Any ideas on how to work around
>> this? Throwing something like "true" on the next line seems... well...
>> tacky. There has to be a better way.
>
>What's wrong with an explicit true?
>Anyway this will be ok:
>
>rpm --eval '%{_preun_service nscd} :'
>/usr/share/rpm-helper/del-service %{name} $1 nscd
> :
>
>
>> I suppose I could expand it.. instead of using [[ -f ... ]] &&
>> %_preun... I could use an if/fi statement...

You needed to read the whole thread. =) There were rpm install errors
if the nscd initscript was not found, which is why there is this
workaround.

I suppose if the rpm-helper scripts actually checked for the existence
of initscripts before trying to execute them it might help. This isn't
really sufficient:

pkg=$1                 # name of the package
num=$2                 # number of packages installed
srv=$3                 # name of the service

if [ $num = 0 ]; then
  /sbin/service $srv stop > /dev/null 2>/dev/null || :
  /sbin/chkconfig --del $srv
fi


It should probably be something like:

pkg=$1                 # name of the package
num=$2                 # number of packages installed
srv=$3                 # name of the service

if [ $num = 0 ]; then
  if [ -f /etc/rc.d/init.d/${srv} ]; then
     /sbin/service $srv stop > /dev/null 2>/dev/null || :
     /sbin/chkconfig --del $srv
  fi
fi


It's usually a good idea to check for the existence of something before
you try to execute it, which our helper scripts do not do.

If they were made proper, this kind of workaround wouldn't be required.
FWIW, the "stop" is fine, but there is no similar "|| :" or redirection
for the chkconfig call (so either it should have the same, or we should
actually test for existence before calling these programs).

--
Vincent Danen @ http://linsec.ca/
©2008 redhatconfig.com - Jax Systems, LLC, U.S.A.