I am reading RPM packages from a CSV file and want to install them one after the other. If there is a "yes" or "ja" at the end of the line, the package is to be installed. Otherwise it should be skipped. The packages have already been downloaded and saved in the folder /var/tmp/updcache
.
On RHEL 7, this works wonderfully.
On RHEL 8, after installing the first package, the entire /var/tmp/updcache
folder is emptied. So the installation attempt of the second package in the CSV file fails because it is no longer there. Likewise all other packages in the CSV.
What is the best way to prevent this? Is there an option for dnf
that prevents the deletion?
Here is the script ...
while IFS= read -r line; do
linecount=$(( $linecount+1 ))
if [[ "$line" == *yes ]] || [[ "$line" == *ja ]]; then
package="$(echo "$line" | sed 's/[;].*$//')"
echo $package >> ./InstallationLog_$curdate.log
dnf install -y -q /var/tmp/updcache/$package &>> ./InstallationLog_$curdate.log
log="$(rpm -qa | grep -c $packageStat)"
elif [[ "$line" == *no ]] || [[ "$line" == *nein ]]; then
package="$(echo "$line" | sed 's/[;].*$//')"
echo "Installation of $package was skipped!"
fi
done <$install_list