From 86733af89d67a0d117cd7e3e32c8e4887abc8ee4 Mon Sep 17 00:00:00 2001 From: Scott Koranda Date: Wed, 12 Apr 2023 08:06:21 -0500 Subject: [PATCH] container require modern bash and getopt --- container/build.sh | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/container/build.sh b/container/build.sh index a3889036..094acccc 100755 --- a/container/build.sh +++ b/container/build.sh @@ -517,6 +517,19 @@ function main() { local repository local suffix + # Require bash version 4 or higher. + if [[ ! "${BASH_VERSINFO:-0}" -ge 4 ]]; then + err "ERROR: Bash version must be 4 or greater" + exit 1 + fi + + # Require getopt version 2.32 or greater. + getopt_version=$(/usr/bin/getopt --version | cut -d' ' -f4 | cut -c1-4 | tr -d .) + if [[ ! "${getopt_version:-0}" -ge 232 ]]; then + err "ERROR: getopt version must be 2.32 or greater" + exit 1 + fi + declare -a docker_build_flags=() gnu_getopt_out=$(/usr/bin/getopt \