tags:

views:

104

answers:

2

I have a rpm package which is already installed in the system. I want to replace the old package with the new package with a different package name. The "rpm -Uvh [package name]" should be enough to replace the old package with the new one.

After doing some research in the net I found that "Obsoletes" is used to obsolete an old package and replace it with a new package with a different name. I have used "Obsoletes" in my rpm spec file but When I am trying to upgrade from the old package the %preun of the old package gets called with $1 = 0 which I expected to be $1 = 1.

Please correct me if I am going wrong anywhere. Is there are any better solution for this problem?

Thanks

+1  A: 

My understanding of your problem is that the old package does something in its %preun script that you would like it to not do (like deleting a user account or something like that), right?

One way to work around this could be to create an intermediate dummy rpm version N+1 of the old package which contains no files, upgrade to that and then update to your final new package.

hlovdal
Yes you are correct, but I can not distribute the dummy package to the users. The %preun scriptlet is responsible here for stopping the daemon and removing the entries from "chkconfig". Is there are any other way I can upgrade to new package with a different package name and the %preun scriptlet of the old package does not execute or execute with $1 = 1.
Supratik
+1  A: 

Is there are any better solution for this problem?

rpm -e --nopreun <old-package> && rpm -i <new-package>

you can selectively enable and disable specific scripts with --no<scriptname>, or you can disable all scripts with --noscripts.

make sure you check the various scripts associated with the new package; you may have to disable some of them as well.

-steve

p.s. this would probably be a question better posted on ServerFault. :)

hakamadare