Old 30-06-2005   #1
NeroLinux Moderator
 
Join Date: Jun 2004
Posts: 468
RPM package updates

As some of you already noticed, when updating the RPM package (using rpm -U), the shortcuts in the Gnome and KDE menus are lost. This is not coming out of NeroLINUX but more from a RPM problem... and does not affect the Debian package
I explain: When you update, the post-installation script that creates the shortcuts is executed. Afterwards, the pre-uninstallation script of the old package is then executed, and removed the fresh-created menu shortcuts... that's why they are no more available.

So for RPM packages, you should uninstall them completly (rpm -e) and install the new one after. This will not affect your configuration file.
mathf is offline   Reply With Quote
Old 20-07-2005   #2
MyCE Senior Member
 
Join Date: Nov 2004
Posts: 453
Re: RPM package updates

I've got experience with this RPM upgrade oddity. If anyone from Nero is reading this, you need to wrap all your %pre, %post, %preun, and %postun sections of your RPM .spec file to check the $1 variable to see if an upgrade is happening.

Example:
%pre
if [ $1 = 1 ]; then
# perform any pre-install stuff here
fi

%post
if [ $1 = 1 ]; then
# perform any post-install stuff here
fi

%preun
if [ $1 = 0 ]; then
# perform any pre-uninstall stuff here
fi

%postun
if [ $1 = 0 ]; then
# perform any post-uninstall stuff here
fi
__________________

NEC ND-2100AD@2510A Fw 2.0A-bt
NEC ND-6750A Fw 2.42-bt
NEC AD-7170A Fw 1.05-bt
NEC AD-7170S Fw 1.03-bt
NEC AD-7201S Fw 1.09-bt
NEC AD-7201S Fw 1.03-bt
NEC AD-7590A Fw 1.05-bt
Plextor Premium TLA#0005 Fw 1.07
Panasonic UJ-225S Q113
tqhoang is offline   Reply With Quote
Old 20-07-2005   #3
NeroLinux Moderator
 
Join Date: Jun 2004
Posts: 468
Re: RPM package updates

Exactly! This is the fix that has been added to version 2.0.0.2. But with all previous version, you will still have to uninstall/reinstall to keep desktop shortcuts.
mathf is offline   Reply With Quote
Old 25-07-2005   #4
New on Forum
 
Join Date: Jul 2005
Posts: 1
Re: RPM package updates

Quote:
Originally Posted by mathf
As some of you already noticed, when updating the RPM package (using rpm -U), the shortcuts in the Gnome and KDE menus are lost. This is not coming out of NeroLINUX but more from a RPM problem... and does not affect the Debian package
No, it is not an RPM problem, it's yours and it is very easy to fix. Please let me explain and then fix it because NeroLINUX is at the moment packaged wrong, sorry.
Quote:
Originally Posted by mathf
As some of you already noticed, when updating the RPM package (using rpm -U), the shortcuts in the Gnome and KDE menus are lost. This is not coming out of NeroLINUX but more from a RPM problem... and does not affect the Debian package
I explain: When you update, the post-installation script that creates the shortcuts is executed. Afterwards, the pre-uninstallation script of the old package is then executed, and removed the fresh-created menu shortcuts... that's why they are no more available.
This is a matter of reading the RPM documentation. There is a solution and a workaround which works without reading any documentation.

First, the workaround. Simply append the version string to the names of the generated files. So, create nero-2.0.0.2.png and nero-2.0.0.2.desktop instead of just nero.png and nero.desktop. This way, RPM will create nero-2.0.0.2.png and nero-2.0.0.2.desktop and afterwards remove nero-2.0.0.1.png and 2.0.0.1.desktop.

And now the real solution. Every %pre, %post, %preun and %postun script in an RPM is passed exactly one command-line parameter. This parameter ist, as for every shell script, available as the environment variable $1. The parameter contains the number of instances of the package they belong to that will be present after the current action has finished.

In detail. If a package is installed, the number of instances that are present is 1. Therefore, %pre and %post are passed the parameter "1" at first install; %preun and %postun are not executed at all. If a package is updated, the number of instances for %pre and %post is 2, one that whose installation happens right now and that will be erased immediately after.

But for %preun and %postun, the parameter is "1" because these are executed after the old package was already removed. Therefore, during an upgrade %pre and %post are passed the parameter "2" and %preun and %postun are passed the parameter "1".

If a package is removed, %pre and %post are not executed at all. %preun and %postun are executed after the removal of the last remainung package. Therefore, both are passed the parameter "0" during removal.

This is all you need to know. Simply introduce a check into your scripts so that it looks like this:
Code:
%pre (if used)
if [ $1 = 1 ] ; then
   bla bla bla
fi

%post
if [ $1 = 1 ] ; then
   bla bla bla
fi

%preun (if used)
if [ $1 = 0 ] ; then
   bla bla bla
fi


%postun
if [ $1 = 0 ] ; then
   bla bla bla
fi
This way, your %pre and %post scripts are only executed at first install and not during upgrades. %preun and %postun are only executed at removal and not during upgrades, either. In other words, nothing is done during upgrades. Of course, you can leave the check out for %pre and %post if you prefer that the menu entries are regenerated even when upgrading. The only important thing is that you include the check in %preun and %postun.

More information about these things is described at IBM developerworks:

http://www.ibm.com/developerworks/library/l-rpm3.html

Please fix this bug, it's yours. It's a well-known fact that RPM has a very bad reputation, but a large part of the problems are very easy to fix and actually depend on developer's willingness to read the documentation carefully.

EDIT: Please forgive me. I asked you to read more carefully, but myself I didn't even read the thread and the fact that the problem was already solved - sorry. I'm very ashamed.
SuSEuser is offline   Reply With Quote
Old 02-08-2005   #5
MyCE Member
 
Join Date: Mar 2005
Location: Mt.Prospect, ILLINOIS
Posts: 106
Re: RPM package updates

No need for shame! From a NON-Developer-persepctive (myself) this was VERY helpful in understanding a little more on how the update process works, as I have always been a little mystified by RPM. I have had VERY little trouble with rpm and don't know WHY it has such a bad reputation since it's worked well for me...obviously because the developers "did it right" and all of it worked correctly. Cool.

Anyway, thanks for your post!
Bobmeister is offline   Reply With Quote
Reply


Thread Tools

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 On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
What are the benefits of a 10k rpm hdd?? gregtherotterius Solid State Drives (SSD), Hard Drives (HDD) and NAS 7 17-08-2006 05:41
Maxtor 15K RPM SCSI HDD vs. WD 10K RPM SATA HDD Kenshin Solid State Drives (SSD), Hard Drives (HDD) and NAS 74 28-07-2005 21:00
Older version of Nero rpm still available? bdh Nero & InCD 4 28-07-2005 00:51
RPM SETUP for Case Fan paaji Newbie Forum 3 16-02-2005 19:49
A program to display my HDD's RPM ? Tyreksionibus General Software 1 11-10-2004 23:29


All times are GMT +2. The time now is 07:39.
Top