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
This commit is contained in:
Harm Weites 2015-06-14 19:46:10 +02:00 committed by Martin André
parent 999a51b6f3
commit 24577bdeac

View File

@ -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")/.."