[Date Prev][Date Next] [Thread Prev][Thread Next]
[Thread Index]
[Date Index]
[Author Index]
Re: Upgrading a package (Do I use $1?)
- From: Jeff Johnson <jbj JBJ ORG>
- To: rpm-list redhat com
- Subject: Re: Upgrading a package (Do I use $1?)
- Date: Tue, 29 Jan 2002 10:11:34 -0500
On Tue, Jan 29, 2002 at 09:01:12AM -0500, Mike Baranski wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> Hi,
>
> I'm having some trouble upgrading a package. Installation works great, but
> then there are some scripts we want to run only when upgrading. Seems like I
> read that $1 was an argument that was passed to all of your scripts, and if
> it was 0 you were uninstalling, 1 you were doing a new install, and > 1 you
> were doing an upgrade. This does not appear to be the case, as sometimes it
> does and sometimes it doesen't work, depending, it seems, on the revision
> number. Does anyone have any suggestions?
Yes, $1 in a sciptlet can be used to diffentiate between upgrade and install
pathways. For example
%preun
if [ $1 = 0 ]; then
echo "this is an erase"
else
echo "this is an upgrade"
fi
What's probably tripping you up is that $1 is not a boolean, but rather
the number of instance of packages with the same name that will be installed
after the scriptlet is run. Check "rpm -qa | grep <pkgname> | wc".
73 de Jeff
--
Jeff Johnson ARS N3NPQ
jbj@jbj.org (jbj@redhat.com)
Chapel Hill, NC
[Date Prev][Date Next] [Thread Prev][Thread Next]
[Thread Index]
[Date Index]
[Author Index]
[]