rpmbuild and upgrades

Markku Kolkka markkuk at tuubi.net
Thu Aug 25 10:53:11 UTC 2005


Mike McGrath kirjoitti viestissään (lähetysaika keskiviikko, 24. 
elokuuta 2005 19:25):
> I'm having difficulty with building an RPM file to upgrade. 
> The issue comes when I need to add and delete a user.  In the
> spec file I have it creating the user in %pre and removing the
> user in %postun.  I'm using useradd and userdel to create and
> delete the user.  When I build and install the RPM everything
> works as expected, same goes when I remove it.  But when I do
> an rpm -U for an upgrade for some reason when all is said and
> done the user does not exist.  Anyone know what's going on?

In an upgrade, the new package is installed first and %pre is 
executed. Then the old package gets removed and %postun is 
executed. You end up with the user deleted.

You should check the numercal argument given to %pre and %postun 
scripts to distinguish between install/delete and upgrade. See:
 
http://fedora.redhat.com/participate/developers-guide/ch-rpm-building.html#s1-rpm-spec-file

-- 
 Markku Kolkka
 markku.kolkka at iki.fi




More information about the fedora-list mailing list