summaryrefslogtreecommitdiffstats
path: root/build
diff options
context:
space:
mode:
authorBartek Grzybowski <b.grzybowski@partner.samsung.com>2019-07-02 10:15:36 +0200
committerBartek Grzybowski <b.grzybowski@partner.samsung.com>2019-07-05 08:13:34 +0200
commit60e2e9ae8a4ec58e4deeacdf86b8e817eaff1a83 (patch)
treea31081f94fe613582d398e6a30b2e50548db0124 /build
parentb00fda87df7db69d1cb74948e385694a51a6e016 (diff)
Verify dependencies for build_nexus_blob.sh are installed
Script now checks if utilized tools are installed on the system. Without that it would fail in the middle of the flow. Now it will fail fast at the beginning if a particular dependency is missing. It will also list those missing dependencies. Change-Id: I39bb6f5d1b9d3eec4a76e77a6af9470f3a3d5244 Issue-ID: OOM-1945 Signed-off-by: Bartek Grzybowski <b.grzybowski@partner.samsung.com>
Diffstat (limited to 'build')
-rwxr-xr-xbuild/build_nexus_blob.sh21
1 files changed, 19 insertions, 2 deletions
diff --git a/build/build_nexus_blob.sh b/build/build_nexus_blob.sh
index 5f4ed0ff..1e21a23a 100755
--- a/build/build_nexus_blob.sh
+++ b/build/build_nexus_blob.sh
@@ -20,7 +20,7 @@
### This script prepares Nexus repositories data blobs for ONAP
-## The script requires following dependencies are installed: nodejs, jq, docker, twine
+## The script requires following dependencies are installed: nodejs, jq, docker, twine, expect
## All required resources are expected in the upper directory created during
## download procedure as DATA_DIR or in the directory given as --input-directory
## All lists used must be in project data_lists directory or in the directory given
@@ -52,12 +52,15 @@ NEXUS_EMAIL=admin@example.org
# Setting paths
LOCAL_PATH="$(readlink -f $(dirname ${0}))"
-#Defaults
+# Defaults
DOCKER_LOAD="false"
DATA_DIR="$(realpath ${LOCAL_PATH}/../../resources)"
NEXUS_DATA_DIR="${DATA_DIR}/nexus_data"
LISTS_DIR="${LOCAL_PATH}/data_lists"
+# Required dependencies
+COMMANDS=(jq docker expect npm twine)
+
usage () {
echo " Example usage: build_nexus_blob.sh --input-directory </path/to/downloaded/files/dir> --output-directory
</path/to/output/dir> --resource-list-directory </path/to/dir/with/resource/list> [--load-docker-images]
@@ -76,6 +79,20 @@ load_docker_images () {
done
}
+# Verify all dependencies are available in PATH
+FAILED_COMMANDS=()
+for cmd in ${COMMANDS[*]};
+do
+ command -v $cmd >/dev/null 2>&1 || FAILED_COMMANDS+=($cmd)
+done
+if [ ${#FAILED_COMMANDS[*]} -gt 0 ];
+then
+ echo "Following commands where not found in PATH and are required:"
+ echo ${FAILED_COMMANDS[*]}
+ echo "Aborting."
+ exit 1
+fi
+
while [ "${1}" != "" ]; do
case ${1} in
-i | --input-directory ) shift