Question regarding upgrading packages from a new developer

Tim Mooney mooney at
Tue Oct 12 19:39:46 UTC 2010

In regard to: Question regarding upgrading packages from a new developer,...:

> I'm new to building rpm based packages and have some questions regarding
> best practices and management of a repository.
> I built a base rpm. It installs correctly without issue. The uninstall
> section removes a specific directory root, say something like
> [/usr/share/myproject] where I put some general data for use.
> Here's where I'm getting confused and can find little information when
> googling:
> * I then built an upgrade version which contained all the same
> configuration files and upgraded programs. When running 'rpm -U' it
> proceeds to delete the [/usr/share/myproject] directory because of the
> uninstall executing AFTER the update.
> Here's where I'm confused.
> First: I'm surprised the unistall is executed at all on an upgrade...but
> I can imagine the reasons for it. I've seen the documentation so...I can
> live with it I guess.
> Second: I would think the originating package would be uninstalled
> before the new package or update. Why would it be done after?

Because if you do it before, you risk removing something (like a shared
library, or shared config, or whatever) that would break something that's
running.  If you do it the other way (put the new version in place, then
remove any old bits) you don't have this trouble.

> So how can I manage this properly? Can anyone provide further reading or
> documentation on this topic?

You want to read up on the various scripts.  Although the free book
"Maximum RPM" is out of date in many areas, it's still accurate regarding
what you have to do to handle upgrades.  Basically, you count how many
versions of the package are available and only do your removal if that
number is 0.  It's all explained pretty well in "Maximum RPM".

Tim Mooney                                  mooney at
Enterprise Computing & Infrastructure       701-231-1076 (Voice)
Room 242-J6, IACC Building                  701-231-8541 (Fax)
North Dakota State University, Fargo, ND 58105-5164

More information about the Rpm-list mailing list