Closed DevinBeu closed 7 hours ago
We need to determine if the apt update should be implemented at just the beginning, at the beginning AND the end, or at the beginning of every script.
it should be tied to actually installing a package like
if (apt-cache show terraform)
then
echo "terraform already in apt cache"
else
echo "updating apt cache"
sudo apt update
fi
So based on our current TFInstall script, apt update will be ran 3 times, for gpg, software properties, and gpg key and repositories? Sorry for beating this question to death- we're trying to master our understanding of the concept. p.s. I was nominated to respond :)
So based on our current TFInstall script, apt update will be ran 3 times, for gpg, software properties, and gpg key and repositories? Sorry for beating this question to death- we're trying to master our understanding of the concept. p.s. I was nominated to respond :)
It will only run once for one of the three, and then will be updated so the others will already be in the cache. So whatever check runs first will then run update and the rest of the apt-cache shows later in the script will be true, unless you add another source to apt.
Have a conditional check to see if apt update command is needed.