setup: Add blank file check to check_command

This way we can better gaurd against empty files as seen
in the previous commits message.

Signed-off-by: Manuel Mendez <mmendez@equinix.com>
This commit is contained in:
Manuel Mendez 2021-04-28 20:12:51 +00:00
parent 549e540671
commit ffbb92909b

View File

@ -427,13 +427,15 @@ command_exists() (
)
check_command() (
if command_exists "$1"; then
echo "$BLANK Found prerequisite: $1"
return 0
else
echo "$ERR Prerequisite command not installed: $1"
if ! command_exists "$1"; then
echo "$ERR Prerequisite executable command not found: $1"
return 1
fi
if ! [[ -s "$(which "$1")" ]]; then
echo "$ERR Prerequisite command is an empty file: $1"
fi
echo "$BLANK Found prerequisite: $1"
return 0
)
check_prerequisites() (