Add contitional update package repositories to install_package()

This helps us ensure that we update the repositories only the first time
we need to install packages

Rebased and incorporated into install_package()

Change-Id: Id987aa7742f5d6807bc97eb6784cf18557c919d2
This commit is contained in:
Vincent Untz 2012-06-12 11:30:43 +02:00 committed by Dean Troyer
parent 3ceb380012
commit c0482e6efc
2 changed files with 5 additions and 2 deletions

View File

@ -536,7 +536,11 @@ function install_package() {
if [[ -z "$os_PACKAGE" ]]; then if [[ -z "$os_PACKAGE" ]]; then
GetOSVersion GetOSVersion
fi fi
if [[ "$os_PACKAGE" = "deb" ]]; then if [[ "$os_PACKAGE" = "deb" ]]; then
[[ "$NO_UPDATE_REPOS" = "True" ]] || apt_get update
NO_UPDATE_REPOS=True
apt_get install "$@" apt_get install "$@"
else else
yum_install "$@" yum_install "$@"

View File

@ -183,7 +183,7 @@ if [[ $EUID -eq 0 ]]; then
# Give the non-root user the ability to run as **root** via ``sudo`` # Give the non-root user the ability to run as **root** via ``sudo``
if [[ "$os_PACKAGE" = "deb" ]]; then if [[ "$os_PACKAGE" = "deb" ]]; then
dpkg -l sudo || apt_get update && install_package sudo dpkg -l sudo || install_package sudo
else else
rpm -qa | grep sudo || install_package sudo rpm -qa | grep sudo || install_package sudo
fi fi
@ -654,7 +654,6 @@ set -o xtrace
# Install package requirements # Install package requirements
if [[ "$os_PACKAGE" = "deb" ]]; then if [[ "$os_PACKAGE" = "deb" ]]; then
apt_get update
install_package $(get_packages $FILES/apts) install_package $(get_packages $FILES/apts)
else else
install_package $(get_packages $FILES/rpms) install_package $(get_packages $FILES/rpms)