Fix certain ifs in hack stuff

This commit is contained in:
Kristóf Tóth 2018-06-18 14:53:10 +02:00
parent f37e07d955
commit 8128866c86
3 changed files with 14 additions and 7 deletions

View File

@ -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

View File

@ -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

View File

@ -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]"