[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Re: Running section %preun after upgrading package



On 2003-08-19(Tue) 07:09:43 +0200, Petereit, Michael wrote:
> Hi Paul,
> 
> I just added '[ $1 != 0 ] && exit 0' after my %preun section to cover the
> non remove situation.

You might want to use [ $1 = 0 ] || exit 0 instead. In the rare case
that no any command follows (that can be a mistake),
'[ $1 != 0 ] && exit 0' will result in a non-zero exit status, since
$1 != 0 , and the "exit 0" part won't be executed.

Abel



> 
> Thank for your advice.
> 
> Michael
> 
> -----Original Message-----
> From: Paul Nasrat [mailto:pauln@truemesh.com]
> Sent: Tuesday, August 19, 2003 7:07 AM
> To: rpm-list@redhat.com
> Subject: Re: Running section %preun after upgrading package
> 
> 
> On Tue, Aug 19, 2003 at 06:52:40AM +0200, Petereit, Michael wrote:
> 
> > yes, it's an upgrade. But I can see the results of section %preun at the
> end
> > of the setup process.
> 
> > So, I'm a little bit confused why this happens after the installation
> > process finished...
> 
> http://www.rpm.org/max-rpm/ch-rpm-upgrade.html
> 
> <quote>
> If there was one RPM command that could win over friends, it would be
> RPM's upgrade command. After all, anyone who has ever tried to install a
> newer version of any software knows what a traumatic experience it can
> be. With RPM, though, this process is reduced to a single command: rpm
> -U. The rpm -U command (--upgrade is equivalent) performs two distinct
> operations:
> 
>    1.  Installs the desired package.
>    2.  Erases all older versions of the package, if any exist. 
> </quote>
> 
> > But is this behavior to uninstall the old one before installing the new
> one
> > the default bahavior ?
> 
> Essentially (although in the order described above).  RPM scriplets can
> workout whether it is in an upgrade or complete removal by checking the
> value of $1 passed to it.  I think the issue here is possibly that the
> preun script for your package isn't checking this (the argument
> represents the number of mypackage packages left on the system after the
> complete transaction, so for a removal it is 0, for an upgrade greater
> than 0 for postun/preun).
> 
> > I assumed rpm is capable of making upgrades without deleting the old one.
> 
> No this is not the case.  An upgrade implies taking an old version and
> replacing it with a new version.  It is possible to have multiple
> packages installed - the kernel is the prime example of this as you
> certainly don't want to remove a running kernel/modules whilst
> upgrading, but for this to work the packages must be designed to  
> 
> Paul
> 
> 
> _______________________________________________
> Rpm-list mailing list
> Rpm-list@redhat.com
> https://www.redhat.com/mailman/listinfo/rpm-list
> 
> 
> _______________________________________________
> Rpm-list mailing list
> Rpm-list@redhat.com
> https://www.redhat.com/mailman/listinfo/rpm-list

-- 
Abel Cheung
Linux counter #256983   | http://counter.li.org
GPG Key: (0xC67186FF)   | http://deaddog.org/gpg.asc
Key fingerprint: 671C C7AE EFB5 110C D6D1  41EE 4152 E1F1 C671 86FF

Attachment: pgp00003.pgp
Description: PGP signature


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index] []