Tekforums

Chat => Entertainment & Technology => Topic started by: M3ta7h3ad on November 28, 2007, 11:00:34 AM

Title: RPM Packaging query
Post by: M3ta7h3ad on November 28, 2007, 11:00:34 AM
Having to create an RPM package in work that is required to "upgrade" the previous package.

Problem being that the UPGRADE must run the uninstall of the previous package with --noscripts as the option.

rpm -Uvh --noscripts packagename-version.rpm results in only the install scripts of the new package being disabled, not the otherway around.

As far as I can see there is no option with the RPM package manager to do this, however this cannot be a new problem.

Anyone know quite how to solve this?

Manually it would be the following:

rpm -e --noscripts package-1.0

rpm -i package-2.0.rpm

I cant do it manually on the production system however, and it is required to work with the -U option.

Easiest way of doing it in my head would be in the %pre scriptlet of package-2.0 having something that did

rpm -e --noscripts package-1.0

and forcing a -i option on the install of package-2.0 (I can either enforce, -U or -i but cant enforce 2 steps [e.g. -e --noscripts followed by a -i).

However I understand that rpm... cant run rpm inside of itself due to an inability to lock the rpmdb.
Title: RPM Packaging query
Post by: M3ta7h3ad on November 28, 2007, 18:18:04 PM
I managed this.

The way I did it...

rm -f /var/lib/rpm/__db*

which removes the rpm database and thus the lock. you can then do...

rpm -e --noscripts ${packagename}

and then you must do a...

rpm --rebuilddb straight after or rpm just results in sh*tloads of errors. :)

Its dirty... and horrible, and has a potential for a massive f**kup, but its good. :)