update create-image.sh to fail early

This commit is contained in:
Pratham Patel 2023-07-29 14:25:27 +05:30
parent e23550a13f
commit dbec569339
No known key found for this signature in database

View File

@ -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