From a1e4657e62d9fff68aa2de453ca33066e089c8ed Mon Sep 17 00:00:00 2001 From: Geoff Bourne Date: Sat, 10 Sep 2022 14:39:44 -0500 Subject: [PATCH] Fixed bug causing isTrue to fail (#1727) --- scripts/start-finalExec | 15 +++++++++------ scripts/start-utils | 6 ++---- 2 files changed, 11 insertions(+), 10 deletions(-) diff --git a/scripts/start-finalExec b/scripts/start-finalExec index d45a8cd..2917cd8 100755 --- a/scripts/start-finalExec +++ b/scripts/start-finalExec @@ -1,5 +1,8 @@ #!/bin/bash +: "${DEBUG_EXEC:=false}" +: "${SETUP_ONLY:=false}" + # shellcheck source=start-utils . "${SCRIPTS:-/}start-utils" isDebugging && set -x @@ -234,7 +237,7 @@ if [[ ${TYPE} == "CURSEFORGE" && "${SERVER}" ]]; then cd "${FTB_DIR}" || (log "ERROR: can't go into ${FTB_DIR}"; exit 1) log "Starting CurseForge server in ${FTB_DIR}..." - if isTrue ${DEBUG_EXEC}; then + if isTrue "${DEBUG_EXEC}"; then set -x fi exec mc-server-runner ${bootstrapArgs} "${mcServerRunnerArgs[@]}" java $JVM_XX_OPTS $JVM_OPTS $expandedDOpts -jar "$(basename "${SERVER}")" "$@" $EXTRA_ARGS @@ -259,15 +262,15 @@ EOF finalArgs="${FTB_SERVER_START}" - if isTrue "${SETUP_ONLY:=false}"; then + if isTrue "${SETUP_ONLY}"; then echo "SETUP_ONLY: ${finalArgs}" exit fi - if isTrue ${DEBUG_EXEC}; then + if isTrue "${DEBUG_EXEC}"; then set -x fi - if isTrue ${EXEC_DIRECTLY:-false}; then + if isTrue "${EXEC_DIRECTLY:-false}"; then "${finalArgs[@]}" else exec mc-server-runner "${mcServerRunnerArgs[@]}" "${finalArgs[@]}" @@ -275,7 +278,7 @@ EOF elif [[ $SERVER =~ run.sh ]]; then log "Using Forge supplied run.sh script..." echo $JVM_XX_OPTS $JVM_OPTS $expandedDOpts > user_jvm_args.txt - if isTrue ${SETUP_ONLY:=false}; then + if isTrue ${SETUP_ONLY}; then echo "SETUP_ONLY: bash ${SERVER}" exit fi @@ -296,7 +299,7 @@ else "$@" $EXTRA_ARGS ) - if isTrue ${SETUP_ONLY:=false}; then + if isTrue ${SETUP_ONLY}; then echo "SETUP_ONLY: java ${finalArgs[*]}" exit fi diff --git a/scripts/start-utils b/scripts/start-utils index 91e3edf..4eed636 100755 --- a/scripts/start-utils +++ b/scripts/start-utils @@ -63,8 +63,7 @@ function getFilenameFromUrl() { } function isTrue() { - local arg="${1?}" - case ${arg,,} in + case "${1,,}" in true | on | 1) return 0 ;; @@ -75,8 +74,7 @@ function isTrue() { } function isFalse() { - local arg="${1?}" - case ${arg,,} in + case "${1,,}" in false | off | 0) return 0 ;;