From dbec5693394051182d55aa3c6117646957e02c0e Mon Sep 17 00:00:00 2001 From: Pratham Patel Date: Sat, 29 Jul 2023 14:25:27 +0530 Subject: [PATCH] update create-image.sh to fail early --- create-image.sh | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/create-image.sh b/create-image.sh index c4a1119..80ecaf2 100755 --- a/create-image.sh +++ b/create-image.sh @@ -8,7 +8,17 @@ IMAGE_NAME="${APPLIANCE_NAME}-$(TZ='UTC' date +%Y.%m.%d-%H%M%S).raw" COMPRESSED_IMAGE_NAME="${IMAGE_NAME}.zst" if [[ ${EUID} -ne 0 ]]; then - >&2 echo "ERROR: Please run this script as root" + >&2 echo "$0: error: Please run this script as root" + exit 1 +fi + +if ! command -v appliance-creator > /dev/null; then + >&2 echo "$0: error: unable to find command 'appliance-creator'" + exit 1 +fi + +if ! command -v shasum > /dev/null; then + >&2 echo "$0: error: unable to find command 'shasum'" exit 1 fi