From 41d955b195ef5cd1272522c5f4d7c2dedf0987a2 Mon Sep 17 00:00:00 2001 From: Kyle Isom Date: Wed, 12 Apr 2023 20:18:09 -0700 Subject: [PATCH] packer: update call to main --- packer/build-image.sh | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/packer/build-image.sh b/packer/build-image.sh index 9c34523..cb23f18 100755 --- a/packer/build-image.sh +++ b/packer/build-image.sh @@ -2,6 +2,14 @@ set -euxo pipefail +if [[ "${BASH_SOURCE[0]}" = "${0}" ]] +then + set -euxo pipefail + RUN_MAIN=yes +else + RUN_MAIN=no +fi + IMAGE_TYPE="${1:-ubuntu}" PACKER_BUILD_FILE="${2:-}" SKIP_LOCAL_CACHE="${SKIP_LOCAL_CACHE:-no}" @@ -86,7 +94,7 @@ main () { build_image } -if [ "$0" = "-bash" ] +if [[ "${RUN_MAIN}" = "yes" ]] then main fi