%preun is passed with value 0 to $1 during upgrade
Question
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
Solution
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. :)
OTHER TIPS
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.