← Back to team overview

checkbox-dev team mailing list archive

[PATCH 2/3] support/install-deb-dependencies: batch install deb packages instead of one-by-one. Small speedup.

 

---
 support/install-deb-dependencies | 16 ++++++++++------
 1 file changed, 10 insertions(+), 6 deletions(-)

diff --git a/support/install-deb-dependencies b/support/install-deb-dependencies
index 1bdac15..bb09277 100755
--- a/support/install-deb-dependencies
+++ b/support/install-deb-dependencies
@@ -35,13 +35,17 @@ debian_pkg_list="$(find "$CHECKBOX_TOP" -path '*/requirements/deb-*.txt' -exec c
 
 # Check each one and install if required
 echo "I: checking if the following Debian packages are installed:" $debian_pkg_list
+dpkgs_to_install_list=""
 for debian_pkg in $debian_pkg_list; do
     if [ "$(dpkg-query -s $debian_pkg 2>/dev/null | grep '^Status:')" != "Status: install ok installed" ]; then
-        echo "I: package $debian_pkg is missing, installing"
-        if [ $(id -u) != 0 ]; then
-            sudo apt-get install --quiet --quiet --yes $debian_pkg
-        else
-            apt-get install --quiet --quiet --yes $debian_pkg
-        fi
+        echo "I: package $debian_pkg is missing, queueing for install"
+        dpkgs_to_install_list="$dpkgs_to_install_list $debian_pkg"
     fi
 done
+if [ -n "$dpkgs_to_install_list" ]; then
+    if [ $(id -u) != 0 ]; then
+        sudo apt-get install --quiet --quiet --yes $dpkgs_to_install_list
+    else
+        apt-get install --quiet --quiet --yes $dpkgs_to_install_list
+    fi
+fi
-- 
1.8.1.2



References