f



RPM %post and %preun

In an RPM spec file %post gets run after the install of the
binary package is complete.  %preun gets run before the uninstall
procedes.  I have a package which creates a file with %post and
deletes it with %preun.  Whenever I upgrade the package, the
newer package creates the file first.  Then the older package
deletes it.  I would think that the older package being
uninstalled would delete it first, followed by the new package
creating it.  But, it doesn't work this way.

Help?  Thanks....

-- 
Unless otherwise noted, the statements herein reflect my personal
opinions and not those of any organization with which I may be affiliated.
0
nobody3134 (44)
8/21/2003 7:34:50 PM
comp.os.linux.misc 33585 articles. 0 followers. amosa69 (78) is leader. Post Follow

6 Replies
645 Views

Similar Articles

[PageSpeed] 6

Kevin wrote:

> In an RPM spec file %post gets run after the install of the
> binary package is complete.  %preun gets run before the uninstall
> procedes.  I have a package which creates a file with %post and
> deletes it with %preun.  Whenever I upgrade the package, the
> newer package creates the file first.  Then the older package
> deletes it.  I would think that the older package being
> uninstalled would delete it first, followed by the new package
> creating it.  But, it doesn't work this way.

the install happens first, then the uninstall.

http://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=4225

-- 
------------------------------------------------------------------
  Andrew Schultz                    | The views expressed might
  ajschult@eos.ncsu.edu             | not represent those of NCSU.
  http://www4.ncsu.edu/~ajschult/   | They are however, correct.

0
ajschult (13)
8/21/2003 10:08:17 PM
Kevin wrote:
> In an RPM spec file %post gets run after the install of the
> binary package is complete.  %preun gets run before the uninstall
> procedes.  I have a package which creates a file with %post and
> deletes it with %preun.  Whenever I upgrade the package, the
> newer package creates the file first.  Then the older package
> deletes it.  I would think that the older package being
> uninstalled would delete it first, followed by the new package
> creating it.  But, it doesn't work this way.
> 
> Help?  Thanks....
> 

Andrew is right 'install new, deinstall old'

But you can use the variable $1 to see whether it's a
- first install
- update
- full remove

$1 gives you the number of instance already installed
or was it the number of instance installed after having
executed the rpm command?

Anyway, my CVS host is down and I can't checkout any spec file
for an example.

You can try to play around with

%pre

echo "pre: $1"

%post

echo "post: $1"

%preun

echo "preun: $1"

%postun

echo "postun: $1"

and see what happens.

Toni

0
8/22/2003 12:48:01 PM
Andrew Schultz wrote:
> 
> Kevin wrote:
> 
> > In an RPM spec file %post gets run after the install of the
> > binary package is complete.  %preun gets run before the uninstall
> > procedes.  I have a package which creates a file with %post and
> > deletes it with %preun.  Whenever I upgrade the package, the
> > newer package creates the file first.  Then the older package
> > deletes it.  I would think that the older package being
> > uninstalled would delete it first, followed by the new package
> > creating it.  But, it doesn't work this way.
> 
> the install happens first, then the uninstall.
> 
> http://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=4225
> 
> --

Does anyone understand the logic behind this paradigm (install then uninstall)? Everyone I talk to thinks it's backward. 

/dan
0
ganek (9)
9/4/2003 2:19:04 PM
In article <3F5749D8.E2148DF9@attbi.com>, Daniel Ganek wrote:
> Andrew Schultz wrote:
>> 
>> Kevin wrote:
>> 
>> > In an RPM spec file %post gets run after the install of the
>> > binary package is complete.  %preun gets run before the uninstall
>> > procedes.  I have a package which creates a file with %post and
>> > deletes it with %preun.  Whenever I upgrade the package, the
>> > newer package creates the file first.  Then the older package
>> > deletes it.  I would think that the older package being
>> > uninstalled would delete it first, followed by the new package
>> > creating it.  But, it doesn't work this way.
>> 
>> the install happens first, then the uninstall.
>> 
>> http://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=4225
>> 
> Does anyone understand the logic behind this paradigm (install then 
> uninstall)? Everyone I talk to thinks it's backward. 

Perhaps the idea is that if the install fails, the previous version is still 
available.

-- 
Dave Brown  Austin, TX
0
dhbrown (307)
9/4/2003 4:32:53 PM
On Thu, 04 Sep 2003 16:32:53 GMT,
    Dave Brown <dhbrown@hobbes.dhbrown.net> wrote:


>In article <3F5749D8.E2148DF9@attbi.com>, Daniel Ganek wrote:
>> Andrew Schultz wrote:
>>> 
>>> Kevin wrote:
>>> 
>>> > In an RPM spec file %post gets run after the install of the
>>> > binary package is complete.  %preun gets run before the uninstall
>>> > procedes.  I have a package which creates a file with %post and
>>> > deletes it with %preun.  Whenever I upgrade the package, the
>>> > newer package creates the file first.  Then the older package
>>> > deletes it.  I would think that the older package being
>>> > uninstalled would delete it first, followed by the new package
>>> > creating it.  But, it doesn't work this way.
>>> 
>>> the install happens first, then the uninstall.
>>> 
>>> http://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=4225
>>> 
>> Does anyone understand the logic behind this paradigm (install then 
>> uninstall)? Everyone I talk to thinks it's backward. 
>
>Perhaps the idea is that if the install fails, the previous version is still 
>available.
>

That is too late if the old files have already been replaced by the new ones.
And I do expect that the new files from the package are put in place before
running the %post script.  


Villy
0
vek (278)
9/5/2003 7:57:27 AM
In article <slrnblggf7.8cb.vek@station02.ohout.pharmapartners.nl>, 
Villy Kruse wrote:
> On Thu, 04 Sep 2003 16:32:53 GMT,
>     Dave Brown <dhbrown@hobbes.dhbrown.net> wrote:
> 
>>In article <3F5749D8.E2148DF9@attbi.com>, Daniel Ganek wrote:
>>> Andrew Schultz wrote:
>>>> the install happens first, then the uninstall.
>>>> 
>>> Does anyone understand the logic behind this paradigm (install then 
>>> uninstall)? Everyone I talk to thinks it's backward. 
>>
>>Perhaps the idea is that if the install fails, the previous version is still 
>>available.
>>
> 
> That is too late if the old files have already been replaced by the new ones.
> And I do expect that the new files from the package are put in place before
> running the %post script.  

Too late? Well, that would depend on when the install-fail occurred.  But
consider that if files were already replaced, then it would seem like the
uninstall of the previous version would remove the replacement files.

-- 
Dave Brown  Austin, TX
0
dhbrown (307)
9/5/2003 9:29:38 PM
Reply: