From c0482e6efcc34515b9383e6a0de1e03b75d6ce62 Mon Sep 17 00:00:00 2001 From: Vincent Untz Date: Tue, 12 Jun 2012 11:30:43 +0200 Subject: [PATCH] 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 --- functions | 4 ++++ stack.sh | 3 +-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/functions b/functions index c109eaead8..8ed99604c6 100644 --- a/functions +++ b/functions @@ -536,7 +536,11 @@ function install_package() { if [[ -z "$os_PACKAGE" ]]; then GetOSVersion fi + if [[ "$os_PACKAGE" = "deb" ]]; then + [[ "$NO_UPDATE_REPOS" = "True" ]] || apt_get update + NO_UPDATE_REPOS=True + apt_get install "$@" else yum_install "$@" diff --git a/stack.sh b/stack.sh index 80ea271d08..90d8c62e48 100755 --- a/stack.sh +++ b/stack.sh @@ -183,7 +183,7 @@ if [[ $EUID -eq 0 ]]; then # Give the non-root user the ability to run as **root** via ``sudo`` if [[ "$os_PACKAGE" = "deb" ]]; then - dpkg -l sudo || apt_get update && install_package sudo + dpkg -l sudo || install_package sudo else rpm -qa | grep sudo || install_package sudo fi @@ -654,7 +654,6 @@ set -o xtrace # Install package requirements if [[ "$os_PACKAGE" = "deb" ]]; then - apt_get update install_package $(get_packages $FILES/apts) else install_package $(get_packages $FILES/rpms)