From ef73b4a2b8371032104b9bc0711a111882776646 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Krist=C3=B3f=20T=C3=B3th?= Date: Tue, 12 Nov 2019 13:31:56 +0100 Subject: [PATCH] Fix try_build_baseimage in tfw.sh --- hack/libhack/baseimage.sh | 11 +++++------ hack/tfw.sh | 13 ++++++------- 2 files changed, 11 insertions(+), 13 deletions(-) diff --git a/hack/libhack/baseimage.sh b/hack/libhack/baseimage.sh index 742d665..d4deb26 100644 --- a/hack/libhack/baseimage.sh +++ b/hack/libhack/baseimage.sh @@ -8,11 +8,6 @@ libhack_dir="$(dirname "$(readlink -f "${BASH_SOURCE[0]}")")" source "${libhack_dir}/common.sh" -baseimage::build_if_exists() { - [[ ! -d "${BASEIMAGE_PATH}" ]] && return ||: - baseimage::build -} - baseimage::build() { baseimage::assert_exists pushd "${BASEIMAGE_PATH}" @@ -26,12 +21,16 @@ baseimage::build() { } baseimage::assert_exists() { - if [[ ! -d "${BASEIMAGE_PATH}" ]]; then + if ! baseimage::check_exists; then printf "Cannot find baseimage at ${BASEIMAGE_PATH}!\n" exit 1 fi } +baseimage::check_exists() { + [[ -d "${BASEIMAGE_PATH}" ]] +} + baseimage::release() { baseimage::assert_exists pushd "${BASEIMAGE_PATH}" diff --git a/hack/tfw.sh b/hack/tfw.sh index 1368847..c090870 100755 --- a/hack/tfw.sh +++ b/hack/tfw.sh @@ -21,18 +21,17 @@ source "${SCRIPT_DIR}/libhack/challenge.sh" source "${SCRIPT_DIR}/libhack/frontend.sh" +try_build_baseimage() { + if baseimage::check_exists; then + build_baseimage + fi +} + build_baseimage() { frontend_version="$(frontend::latest_tag)" baseimage::build } - -try_build_baseimage() { - frontend_version="$(frontend::latest_tag)" - baseimage::build_if_exists -} - - case ${1:-} in start) try_build_baseimage