From 8128866c863deb81ddc22dd6a4789efdf51b7373 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Krist=C3=B3f=20T=C3=B3th?= Date: Mon, 18 Jun 2018 14:53:10 +0200 Subject: [PATCH] Fix certain ifs in hack stuff --- hack/libhack/baseimage.sh | 7 ++++--- hack/libhack/challenge.sh | 6 ++++-- hack/tfw.sh | 8 ++++++-- 3 files changed, 14 insertions(+), 7 deletions(-) diff --git a/hack/libhack/baseimage.sh b/hack/libhack/baseimage.sh index 7ee4d9b..9f9b2e2 100644 --- a/hack/libhack/baseimage.sh +++ b/hack/libhack/baseimage.sh @@ -22,7 +22,9 @@ baseimage::build() { } baseimage::build_if_exists() { - [[ -d "$BASEIMAGE_PATH" ]] && baseimage::build_as_latest || : + if [[ -d "$BASEIMAGE_PATH" ]]; then + baseimage::build_as_latest + fi } baseimage::tag_as_latest() { @@ -36,8 +38,7 @@ baseimage::release() { local tag tag="$(releasename)" read -p "Tag and push new TFW version \"${tag}\"? [y/N]" -r && echo - if [[ $REPLY =~ ^(y|Y|yes|Yes|YES)$ ]] - then + if [[ $REPLY =~ ^(y|Y|yes|Yes|YES)$ ]]; then prompt_for_tag_description # This command sets $description tag="${tag}" description="${description}" force_push_tag fi diff --git a/hack/libhack/challenge.sh b/hack/libhack/challenge.sh index 799532c..d756e3c 100644 --- a/hack/libhack/challenge.sh +++ b/hack/libhack/challenge.sh @@ -36,8 +36,10 @@ challenge::run() { local mount_baseimage local mount_challenge local mount_volumes - if [ "${HOTRELOAD:-0}" == "1" ]; then - [ -d "${BASEIMAGE_PATH}" ] && mount_baseimage="-v ${BASEIMAGE_PATH}/lib/tfw:/usr/local/lib/tfw" + if [[ "${HOTRELOAD:-0}" == "1" ]]; then + if [[ -d "${BASEIMAGE_PATH}" ]]; then + mount_baseimage="-v ${BASEIMAGE_PATH}/lib/tfw:/usr/local/lib/tfw" + fi mount_challenge="-v ${CHALLENGE_PATH}/solvable/src:/srv/.tfw" mount_volumes="${mount_baseimage:-} ${mount_challenge}" fi diff --git a/hack/tfw.sh b/hack/tfw.sh index 825c8b9..9198b8a 100755 --- a/hack/tfw.sh +++ b/hack/tfw.sh @@ -60,10 +60,14 @@ case ${1:-} in challenge::build_with_frontend ;; releasetfw) - [[ -d "$BASEIMAGE_PATH" ]] && baseimage::release || : + if [[ -d "$BASEIMAGE_PATH" ]]; then + baseimage::release + fi ;; builddocs) - [[ -d "$BASEIMAGE_PATH" ]] && baseimage::builddocs || : + if [[ -d "$BASEIMAGE_PATH" ]]; then + baseimage::builddocs + fi ;; *) echo "Usage: tfw.sh [COMMAND]"