1
0
mirror of https://github.com/avatao-content/test-tutorial-framework synced 2024-11-14 21:37:17 +00:00

Fix try_build_baseimage in tfw.sh

This commit is contained in:
Kristóf Tóth 2019-11-12 13:31:56 +01:00
parent 6e5b5cd901
commit ef73b4a2b8
2 changed files with 11 additions and 13 deletions

View File

@ -8,11 +8,6 @@ libhack_dir="$(dirname "$(readlink -f "${BASH_SOURCE[0]}")")"
source "${libhack_dir}/common.sh" source "${libhack_dir}/common.sh"
baseimage::build_if_exists() {
[[ ! -d "${BASEIMAGE_PATH}" ]] && return ||:
baseimage::build
}
baseimage::build() { baseimage::build() {
baseimage::assert_exists baseimage::assert_exists
pushd "${BASEIMAGE_PATH}" pushd "${BASEIMAGE_PATH}"
@ -26,12 +21,16 @@ baseimage::build() {
} }
baseimage::assert_exists() { baseimage::assert_exists() {
if [[ ! -d "${BASEIMAGE_PATH}" ]]; then if ! baseimage::check_exists; then
printf "Cannot find baseimage at ${BASEIMAGE_PATH}!\n" printf "Cannot find baseimage at ${BASEIMAGE_PATH}!\n"
exit 1 exit 1
fi fi
} }
baseimage::check_exists() {
[[ -d "${BASEIMAGE_PATH}" ]]
}
baseimage::release() { baseimage::release() {
baseimage::assert_exists baseimage::assert_exists
pushd "${BASEIMAGE_PATH}" pushd "${BASEIMAGE_PATH}"

View File

@ -21,18 +21,17 @@ source "${SCRIPT_DIR}/libhack/challenge.sh"
source "${SCRIPT_DIR}/libhack/frontend.sh" source "${SCRIPT_DIR}/libhack/frontend.sh"
try_build_baseimage() {
if baseimage::check_exists; then
build_baseimage
fi
}
build_baseimage() { build_baseimage() {
frontend_version="$(frontend::latest_tag)" frontend_version="$(frontend::latest_tag)"
baseimage::build baseimage::build
} }
try_build_baseimage() {
frontend_version="$(frontend::latest_tag)"
baseimage::build_if_exists
}
case ${1:-} in case ${1:-} in
start) start)
try_build_baseimage try_build_baseimage