Re: Get the command in the rpm spec

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

 



So... i think you need to step back and take a different approach.  RPM shouldn't be leaving the old version the the filesystem regardless of what you are doing.  Can you share your spec ?


On Tue, Nov 26, 2013 at 10:43 AM, Zheng, Wendy <wendy.zheng@xxxxxxx> wrote:
Hi all,

Really sorry that I didn't receive the previous response and resend the question again.

In this case, I'm maintaining a rpm package which installs the software with version number in its installation path. But now, the software owner doesn't want multiple versions be installed on the machine. Removing the version number in the installation path costs much effort, so I'm seeking for a solution to stop the user from using "rpm -i" command and suggest him to use "rpm -U" or "rpm -F" when he installs a new version to the machine with a older one installed.

Then I try to use the $1 in %pre to distinguish between install and upgrade. But I notice it doesn't work as the doc described because we allow multiple version of software install here. For example, software 1.0 is installed on the machine under path /opt/software-1.0. Now the user tries to install software 2.0. Because the software will be installed under path /opt/software-2.0, the use can install 2.0 with "rpm -i", "rpm -U" and "rpm -F" command. In this case, the value of $1 is 2 no matter which command is used. So in this case, I need to know the exact command the user is using instead of how many instances are installed on the system.

The description of $1 says that, when install, $1==1. This is true when only one version of software is allowed, because in this case, the second "rpm -i" command will fails to install because conflicts with previous version.

Best Regards,
Wendy
________________________________________
From: Zheng, Wendy
Sent: Tuesday, November 26, 2013 4:38 PM
To: rpm-list@xxxxxxxxxxxxx
Subject: Get the command in the rpm spec

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

_______________________________________________
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