0

How would I check to see if a package has not been installed, in the .ebextensions folder of an Elastic Beanstalk setup? What I want to do is similar to this command, but I only want to run the command if the package does not exist, rather than if it exists.

commands:
    install_package:
        test: rpm -qa | grep -c example_package
        command: yum install -y example_package.rpm

So in pseudocode, this is what I am after:

commands:
    install_package:
        test: not(rpm -qa | grep -c example_package)
        command: yum install -y example_package.rpm

Update: I have gotten this to work without the test parameter, using a double pipe in the command itself instead, but it isn't as neat as I'd like; I'd rather use the test parameter instead to make it more explicit:

commands:
    install_package:
        command: rpm -qa | grep -c example_package || { yum install -y example_package.rpm; }
kloddant
  • 1,026
  • 12
  • 19
  • Can you explain what is wrong with the current command? What errors do you get? – Marcin Sep 13 '21 at 23:56
  • The current command checks if the package has been installed before running. It works fine, but I want to check to see if the package is *not* installed. So I want to do the opposite of what the current test is. – kloddant Sep 14 '21 at 13:43

0 Answers0