On Sun, 16 Feb 2003, Tibor Pittich wrote:

> On 16. feb 2003 16:58, Oden Eriksson wrote:
>
> > > but i see another problem in your spec with:
> > > %_postun_userdel vocp
> > > because i played with this macro lately i found, that this can't be
> > > done, because helper script needed three parameters, otherwise fails:
> > >
> > > /usr/share/rpm-helper/del-user
> > > if [ $# != 3 ]; then
> > >     echo "usage: $0 <pkg name> <num installed> <user name>" 1>&2
> > >     exit 1
> > > fi
> > >
> > > pkg=$1                          # name of the package
> > > num=$2                          # number of packages installed
> > > name=$3                         # name of the user
> >
> > Aha, thank you. But it looks like this in most of the Mandrake spec files I
> > have seen..., well very well, it's fixed now
>
> yes, you are right, many of spec files use this macro wrong.
>

[bgmilne@bgmilne SPECS]$ rpm --eval %_postun_userdel
/usr/share/rpm-helper/del-user %{name} $1 %{1}

So, rpm supplies the first two (%name, $1 which is rpm's number of
packages currently installed supplied to all pre/post scripts) arguments
to the script and the macro only needs one argument, the 3rd argument to the
script.

The real problem is that /usr/share/rpm-helper/del-user does not actually
run anything:

if [ $# != 3 ]; then
    echo "usage: $0 <pkg name> <num installed> <user name>" 1>&2
    exit 1
fi

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

# del-user ends here

Whereas it should at least have
[ $num -eq 0 ] && userdel $name
(or something more verbose that logs this also ...)

Buchan

-- 
|----------------Registered Linux User #182071-----------------|
Buchan Milne                Mechanical Engineer, Network Manager
Cellphone * Work            +27 82 472 2231 * +27 21 8828820x121
Stellenbosch Automotive Engineering         http://www.cae.co.za
GPG Key                   http://ranger.dnsalias.com/bgmilne.asc
1024D/60D204A7 2919 E232 5610 A038 87B1 72D6 AC92 BA50 60D2 04A7


Reply via email to