aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHarm Weites <harm@weites.com>2015-06-14 19:46:10 +0200
committerMartin André <martin.andre@kvhasia.com>2015-06-25 11:21:09 +0900
commit24577bdeac6c598a8f4d549623af20da37624789 (patch)
tree29161d70f4ae3abe2a59b64d45656ec521844fb3
parent999a51b6f3fed5d75550335e8711da5dc8ea5e48 (diff)
downloadkolla-24577bdeac6c598a8f4d549623af20da37624789.tar.gz
kolla-24577bdeac6c598a8f4d549623af20da37624789.zip
Check if tools/genenv binary dependencies are met.
The check is using the bash-native 'type' instead of which, because which is not always available on all environments. Current implementation only checks for the availability of openssl but this can be easily expanded. Change-Id: I97e8f52ea664ef80901deae9dea8acc93b6e1ca4 Closes-Bug: #1463101
-rwxr-xr-xtools/genenv20
1 files changed, 20 insertions, 0 deletions
diff --git a/tools/genenv b/tools/genenv
index 63b4189ae..eec306bbd 100755
--- a/tools/genenv
+++ b/tools/genenv
@@ -6,6 +6,26 @@
#
# It also creates a suitable 'openrc' for use with the installed system.
+function check_binarydependencies {
+ local binaries="openssl"
+ local missingbinaries=""
+ local space=""
+
+ for bin in $binaries; do
+ if [[ ! $(type -t $bin) ]]; then
+ missingbinaries+=${space}$bin
+ space=" "
+ fi
+ done
+
+ if [ -n "$missingbinaries" ]; then
+ echo Missing dependencies: $missingbinaries
+ exit 1
+ fi
+}
+
+check_binarydependencies
+
# Move to top level directory
REAL_PATH=$(python -c "import os,sys;print os.path.realpath('$0')")
cd "$(dirname "$REAL_PATH")/.."