When installing rpm packages from local file directory it runs fine the first time
sudo yum install packages/* -y --disablerepo=*
When the same thing is run the second time as part of automated scripts, it throws an error (exit code 1)
packages/package.rpm: does not update installed package.
Error: Nothing to do
I can run yum update (exit code 0)
sudo yum update packages/* -y --disablerepo=*
...
No packages marked for update
The problem with this is that update will skip the packages that are not installed.
I don't want to ignore exit code if there are any real problems here, and just want to do install-or-update
. Is there a rpm -i
equivalent that would achieve that? Please take note that this is done on a group of rpm packages that might at any point include additional ones.
I guess one option would be to iterate over them in a shell script and check if they are installed or not, but then again dependency resolution might become rather painful and it does sound like re-inventing a bike.
UPDATE:
rpm --install
will throw exit code depending on the number of failed packages.
https://www.redhat.com/archives/rpm-list/2005-July/msg00071.html
rpm --freshen
will ignore any rpms that are not installed previously while giving no output at all.