MonetCarriere / Project-AWS

1 stars 0 forks source link

check before apt-update #17

Closed DevinBeu closed 7 hours ago

DevinBeu commented 2 weeks ago

Have a conditional check to see if apt update command is needed.

MonetCarriere commented 1 week 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.

stephenlauck commented 1 week ago

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
jlotto8 commented 1 week ago

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 :)

stephenlauck commented 1 week ago

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.