From 46ae757d7f90ea817f3087f9e350253b1cfa1a69 Mon Sep 17 00:00:00 2001
From: "Roberto A. Foglietta" <roberto.foglietta@gmail.com>
Date: Sat, 24 Dec 2022 11:01:08 +0100
Subject: [PATCH v2] scripts/ci_build.sh installs required commands

CI build requires some commands in order to operate properly and some of these
are checked to be in the executable path but nothing more. This fix the issue
installing them at the beginning of the script.

v2: typos fixed

Signed-off-by: Roberto A. Foglietta <roberto.foglietta@gmail.com>
---
 scripts/ci_build.sh | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)

diff --git a/scripts/ci_build.sh b/scripts/ci_build.sh
index fa7208c..e897942 100755
--- a/scripts/ci_build.sh
+++ b/scripts/ci_build.sh
@@ -14,10 +14,18 @@ export PATH=$PATH:/sbin
 # Go to Isar root
 cd "$(dirname "$0")/.."
 
+for i in virtualenv umoci skopeo reprepro quilt; do
+	if ! command -v $i > /dev/null; then
+	    if [ "$updated" == "1" ]; then
+                sudo apt-get update -qq
+	    fi
+	    sudo apt install -y $i
+	    updated=1
+	fi
+done
+
 # install avocado in virtualenv in case it is not there already
 if ! command -v avocado > /dev/null; then
-    sudo apt-get update -qq
-    sudo apt-get install -y virtualenv
     rm -rf /tmp/avocado_venv
     virtualenv --python python3 /tmp/avocado_venv
     source /tmp/avocado_venv/bin/activate
-- 
2.34.1

