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

Re: Upgrading a package (Do I use $1?)



-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Thanks, Jeff, that's about what I thought.  We need, however, to determine if 
we're installing or upgrading, so:

if [$1 = 0]; then
	# Erase
fi

if [$1 = 1]; then
	# New Install
fi

if[$1 > 1]; then
	#upgrade
fi

Right?

Thanks
Mike.

On Tuesday 29 January 2002 10:11 am, you wrote:
> 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

- -- 
*********************************
* Mike Baranski                 *
* Security Managment Consulting *
* 919-788-9200 Phone            *
* 919-510-0037 Fax              *
* mike@secmgmt.com              *
*********************************

GPG Key located on:
http://www.keyserver.net/en/
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.6 (GNU/Linux)
Comment: For info see http://www.gnupg.org

iD8DBQE8Vr36n0XmoxBj3PwRAgONAKCEvGrWt9fecoHvNuBozY24mfbx5QCbBFiP
cNArMzO1LUKi4XoBCMyx2DA=
=FTIf
-----END PGP SIGNATURE-----





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