Get the command in the rpm spec

Zheng, Wendy wendy.zheng at emc.com
Tue Nov 26 08:38:27 UTC 2013


Hi expertise,

I'm a newbie in RPM. I'm working on creating 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 to this solution?

Best Regards,
Wendy Zheng

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rpm.org/pipermail/rpm-list/attachments/20131126/2a56311c/attachment.html>


More information about the Rpm-list mailing list