When I run yum install <X> where <X> has already been installed, yum exits with a return status of 1 and prints "Error: Nothing to do".
Aside from checking for this string in the output (which seems like a very shaky thing to base my script on), is there some way I can test whether the package already exists? Clearly, yum knows whether or not it already exists, since it's throwing that error, but how can I access that knowledge?
To add to this, some of the packages are downloaded by way of URLs, not package names, so checking yum list installed doesn't work.
yumknows by querying the rpm database. for examplerpma full URL to the RPM you're interested in. Example which will give you the package name. One note would be that it useswgetinternally but seems to silently suppress errors.rpm -qa packageNameexcept it's printed in a way that makes it look likeyumoutput.