SDCARD-RAW-TOOLS: Check dependencies on external tools

This commit is contained in:
Daniel Ammann authored and Priouzeau Christophe committed 2020-02-03 14:41:03 +01:00
1 parent f3b13cfc0a
commit 81af72efee
1 file changed
+11 -4
@@ -14,10 +14,6 @@
# CREATED: 11/22/2017 15:03
# REVISION: ---
#===============================================================================
#TODO: Pre-requisite tools
# sgdisk
# du
# dd
unset FLASHLAYOUT_data
unset FLASHLAYOUT_filename
@@ -754,6 +750,11 @@ function print_warning() {
fi
}
function check_if_command_exists() {
command -v $1 >/dev/null 2>&1 \
|| { echo "Cannot continue. Please install $1 first."; exit 1; }
}
function usage() {
echo ""
echo "Help:"
@@ -771,6 +772,12 @@ then
echo ""
usage
else
# Pre-requisite tools
for i in sgdisk du dd;
do
check_if_command_exists $i
done
FLASHLAYOUT_filename=$1
FLASHLAYOUT_filename_path=$(dirname $FLASHLAYOUT_filename)
FLASHLAYOUT_filename_name=$(basename $FLASHLAYOUT_filename)