Skip to content

Instantly share code, notes, and snippets.

@sysarcher
Last active April 23, 2016 11:00
Show Gist options
  • Save sysarcher/c3424bde1821a58a1088367b8508ad84 to your computer and use it in GitHub Desktop.
Save sysarcher/c3424bde1821a58a1088367b8508ad84 to your computer and use it in GitHub Desktop.
What I run on a fresh install
function getLastAptGetUpdate()
{
local -r aptDate="$(stat -c %Y '/var/cache/apt')"
local -r nowDate="$(date +'%s')"
echo $((nowDate - aptDate))
}
# Default To 24 hours
updateInterval="$((24 * 60 * 60))"
lastAptGetUpdate="$(getLastAptGetUpdate)"
if [[ "${lastAptGetUpdate}" -gt "${updateInterval}" ]]
then
sudo apt-get update
else
#lastUpdate="$(date -u -d @"${lastAptGetUpdate}" +'%-Hh %-Mm %-Ss')"
echo "Skip apt-get update because it was run within
last ${updateInterval} seconds"
fi
sudo apt-get install -y curl
sudo apt-get install -y python-dev python-pip
sudo pip install ansible
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment