Only update apt repo if needed

Previously, the code would run apt-get update at every package
install. This memoizes when apt-get update has been run so we don't
need to run it as frequently