Browse code

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

Vincent Untz authored on 2012/06/12 18:30:43
Showing 2 changed files
... ...
@@ -536,7 +536,11 @@ function install_package() {
536 536
     if [[ -z "$os_PACKAGE" ]]; then
537 537
         GetOSVersion
538 538
     fi
539
+
539 540
     if [[ "$os_PACKAGE" = "deb" ]]; then
541
+        [[ "$NO_UPDATE_REPOS" = "True" ]] || apt_get update
542
+        NO_UPDATE_REPOS=True
543
+
540 544
         apt_get install "$@"
541 545
     else
542 546
         yum_install "$@"
... ...
@@ -183,7 +183,7 @@ if [[ $EUID -eq 0 ]]; then
183 183
 
184 184
     # Give the non-root user the ability to run as **root** via ``sudo``
185 185
     if [[ "$os_PACKAGE" = "deb" ]]; then
186
-        dpkg -l sudo || apt_get update && install_package sudo
186
+        dpkg -l sudo || install_package sudo
187 187
     else
188 188
         rpm -qa | grep sudo || install_package sudo
189 189
     fi
... ...
@@ -654,7 +654,6 @@ set -o xtrace
654 654
 
655 655
 # Install package requirements
656 656
 if [[ "$os_PACKAGE" = "deb" ]]; then
657
-    apt_get update
658 657
     install_package $(get_packages $FILES/apts)
659 658
 else
660 659
     install_package $(get_packages $FILES/rpms)