errors creating users via rpm

Olaf Rempel razzor@xxxxxxxxxxxxx
Wed Oct 19 16:46:05 CEST 2005


On Wed, 19 Oct 2005 09:44:53 +0200
Christian Haugan Toldnes <christht@xxxxxxxxxxx> wrote:

> The only way I can think to do this in rpm would be to:
> 
> 1. add the group
> 2. if nscd is running: nscd -i group
> 3. add the user
> 4. if nscd is running: nscd -i passwd

(no check for running nscd):

%pre
getent group radvd >/dev/null || /usr/sbin/groupadd -g 262 radvd
nscd -i group
getent passwd radvd >/dev/null || /usr/sbin/useradd -d /var/run/radvd -g radvd -s /bin/false -u 262 -M radvd
nscd -i passwd

> And the same during package removal:
> 1. Remove the user
> 2. if nscd is running: nscd -i passwd
> 3. Remove the group
> 4. if nscd is running: nscd -i group

(no check for running nscd):

%postun
if [ "$1" = "0" ]; then
    getent passwd radvd >/dev/null && /usr/sbin/userdel radvd || :
    nscd -i passwd
    getent group radvd >/dev/null && /usr/sbin/groupdel radvd || :
    nscd -i group
fi

> Could you try my suggestion to see if it works?

$ rpm -i radvd-0.9-1or.i586.rpm
$ rpm -e radvd
groupdel: error removing group entry
groupdel: error removing shadow group ent

userdel seems to delete the user and the group?!

> However, that script should probably be part of rpm, or maybe even 
> written up as an RPM macro.. %adduser and %removeuser etc.
2 questions: how? and where? :)

Olaf



More information about the tsl-contrib-discuss mailing list