Improved handling of 'apt-get update' and 'apt-add-repository' so that they are only run once before the packages are installed