Get the command in the rpm spec
Jos Vos
jos at xos.nl
Wed Nov 20 08:48:54 UTC 2013
On Fri, Nov 15, 2013 at 04:27:27AM -0500, Zheng, Wendy wrote:
> I'm a newbie in RPM. I'm working on making a RPM package which only
> one instance is allowed to install on users machine. Then I need to check
> whether there is other version of the software installed on the machine
> before installation (I'm writing some scripts in %pre section). Then
> I use the $1 variable to check for it. But I notice that no matter the
> user is running "rpm -i" command or "rpm -U", $1 will always return 2
> (if there is already one instance installed on the machine). But in
> fact I only need to stop the user when he's running "rpm -i", because
> "rpm -U" will remove the old versions after install.
> Then my question is, how can I know which command ("rpm -i" or
> "rpm -U") the user is using in the rpm spec? Or do you have any other
> suggestion?
You don't need to check this (and you shoudn't). Normally, only one
instance of a package is allowed. There can be exceptions: see the
descriptions of "installonlypkgs" and "installonly_limit" in the
yum.conf manual page.
--
-- Jos Vos <jos at xos.nl>
-- X/OS Experts in Open Systems BV | Phone: +31 20 6938364
-- Amsterdam, The Netherlands | Fax: +31 20 6948204
More information about the Rpm-list
mailing list