Re: Get the command in the rpm spec

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

 



Like Jos said, typically you shouldn't check or deal with this, and you definitely don't have to stop someone using -i if the package already exists, because RPM will do that for you.

If you are doing other login that cares if its an install vs an upgrade there is a table showing you how $1 works here:

https://fedoraproject.org/wiki/Packaging:ScriptletSnippets#Syntax

-greg



On Wed, Nov 20, 2013 at 2:48 AM, Jos Vos <jos@xxxxxx> wrote:
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@xxxxxx>
--    X/OS Experts in Open Systems BV   |   Phone: +31 20 6938364
--    Amsterdam, The Netherlands        |     Fax: +31 20 6948204
_______________________________________________
Rpm-list mailing list
Rpm-list@xxxxxxxxxxxxx
http://lists.rpm.org/mailman/listinfo/rpm-list

_______________________________________________
Rpm-list mailing list
Rpm-list@xxxxxxxxxxxxx
http://lists.rpm.org/mailman/listinfo/rpm-list

[Index of Archives]     [RPM Ecosystem]     [Linux Kernel]     [Red Hat Install]     [PAM]     [Red Hat Watch]     [Red Hat Development]     [Red Hat]     [Gimp]     [Yosemite News]     [IETF Discussion]

  Powered by Linux