LinuxQuestions.org
Did you know LQ has a Linux Hardware Compatibility List?
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices

Reply
 
Search this Thread
Old 11-28-2007, 04:26 AM   #1
R.Hicks
LQ Newbie
 
Registered: Nov 2007
Distribution: RHEL3AS/ES & RHEL4AS/ES
Posts: 10

Rep: Reputation: 1
RPM Package Development


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 can't 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 can't enforce 2 steps [e.g. -e --noscripts followed by a -i).

However I understand that rpm... can't run rpm inside of itself due to an inability to lock the rpmdb. I'm smashing my head against the proverbial brick wall here, so any help would be much appreciated.

Last edited by R.Hicks; 11-28-2007 at 04:28 AM. Reason: further information
 
Old 11-28-2007, 11:42 AM   #2
bigrigdriver
LQ Addict
 
Registered: Jul 2002
Location: East Centra Illinois, USA
Distribution: Debian Squeeze
Posts: 5,783

Rep: Reputation: 311Reputation: 311Reputation: 311Reputation: 311
The -noscripts option isn't intended for normal install/upgrade/uninstall operations. It's intended for developers.

Perhaps 'rpm -U --replacepkgs <packagename>' is what you need.
 
Old 11-29-2007, 03:53 AM   #3
R.Hicks
LQ Newbie
 
Registered: Nov 2007
Distribution: RHEL3AS/ES & RHEL4AS/ES
Posts: 10

Original Poster
Rep: Reputation: 1
I am a developer

The problem is my package has to upgrade a previous package. Previous package however behaves incorrectly when upgrading.

For example:

Package-1.0 creates /tmp/file.ext on install.

In the %preun scriptlet the only code in it is basically

"rm -f /tmp/file.ext"

Package-2.0 during install checks if /tmp/file.ext exists. If so exits cleanly saying "oi oi! this file already exists, i've got nothing to do!"

If you run rpm -U package-2.0 it effectively does the following.

- install package-2.0 ("oi oi! this file already exists, i've nothing to do!")
- uninstall package-1.0 ("rm -f /tmp/file.ext")

Which means when you do "ls /tmp/ | grep -c file.ext" you get "0" as an output as the file doesnt exist.

Yet rpm -qa | grep package results in "package-2.0".

See what I mean?

I have a work around involving deleting the transaction lock database for RPM in the %post install scriptlet of package-2.0, then running rpm -e --noscripts package-1.0 during the package-2.0 %post scriptlet in the package-2.0 rpm.

It's messy... and a cludge, but if anyone else can come up with a better idea, please let me know.
 
Old 02-11-2008, 01:01 PM   #4
clawsoon
LQ Newbie
 
Registered: Feb 2008
Posts: 1

Rep: Reputation: 0
I just went through the same thing myself. The standard way to deal with this is:

%preun

if [ $1 = 0 ]
then
....do uninstall stuff....
fi


That works because 'preun' is passed the number of versions of the package that are installed as its first argument ($1). If that number is 0 - no copies of the package are installed - then your uninstall stuff gets run.
 
Old 02-12-2008, 03:48 AM   #5
R.Hicks
LQ Newbie
 
Registered: Nov 2007
Distribution: RHEL3AS/ES & RHEL4AS/ES
Posts: 10

Original Poster
Rep: Reputation: 1
Quote:
Originally Posted by clawsoon View Post
I just went through the same thing myself. The standard way to deal with this is:

%preun

if [ $1 = 0 ]
then
....do uninstall stuff....
fi


That works because 'preun' is passed the number of versions of the package that are installed as its first argument ($1). If that number is 0 - no copies of the package are installed - then your uninstall stuff gets run.
Almost... except that doesnt work in this case unfortunately I cannot alter the current contents of Package-1.0, so placing the if condition in the %preun scriptlet is not possible.
 
  


Reply

Tags
development, install, package, packaging, rpm, upgrade


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
GTK2 Development Package marco.uk Slackware 4 04-27-2006 02:03 AM
development package victorxg Linux - Newbie 1 11-10-2004 03:09 PM
Mozilla Development package? AudioMechanic Linux - General 2 05-18-2004 10:12 PM
COMPLETE development package Milkman00 Linux - Software 1 03-26-2004 11:23 AM
can reinstall the rpm package without delete the rpm package eye Red Hat 1 10-20-2003 07:53 AM


All times are GMT -5. The time now is 05:20 AM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration