I am trying to improve a build script (bash or Makefile) to install some prerequisites if necessary.
I do have a long list of packages (10-15) and I do want to install them only if they are not installed.
As the build script may be run by non root I do want to run sudo yum install
only once and only if needed (at least one package is not installed).
My current implementation is clearly not optimal:
for PACKAGE in a b c ... ; do
yum list installed $PACKAGE >/dev/null 2>&1 || sudo yum install -q -y $PACKAGE ;
done
How can I do this?