From 98cec98dd9228865691c520aa66478d7d040dbf0 Mon Sep 17 00:00:00 2001 From: Geoff Bourne Date: Sat, 8 Jun 2019 16:47:28 -0500 Subject: [PATCH] mc: allow for CurseForge modpacks with spaces in directory name Fixed #332 --- minecraft-server/start-deployFTB | 37 +++++++++++-------- .../start-finalSetup04ServerProperties | 6 +-- minecraft-server/start-minecraftFinalSetup | 16 ++++---- 3 files changed, 33 insertions(+), 26 deletions(-) diff --git a/minecraft-server/start-deployFTB b/minecraft-server/start-deployFTB index 9d3b3f2a..15e18e7f 100644 --- a/minecraft-server/start-deployFTB +++ b/minecraft-server/start-deployFTB @@ -72,10 +72,10 @@ if [[ $startScriptCount = 0 ]]; then unzip -o ${srv_modpack} -d ${FTB_BASE_DIR} | awk '{printf "."} END {print ""}' fi -if [[ $(find ${FTB_BASE_DIR} $entryScriptExpr |wc -l) = 0 ]]; then +if [[ $(find ${FTB_BASE_DIR} $entryScriptExpr | wc -l) = 0 ]]; then forgeJar=$(find ${FTB_BASE_DIR} -name 'forge*.jar' -a -not -name 'forge*installer') - if [[ $forgeJar ]]; then + if [[ "$forgeJar" ]]; then echo "No entry script found, so building one for ${forgeJar}" cat > ${FTB_BASE_DIR}/ServerStart.sh < 1 ]]; then + echo "Ambigous startup scripts in FTB modpack!" + echo "found:" + find ${FTB_BASE_DIR} $entryScriptExpr + exit 2 fi -export FTB_DIR=$(dirname ${FTB_SERVER_START}) -chmod a+x ${FTB_SERVER_START} -sed -i 's/-jar/-Dfml.queryResult=confirm -jar/' ${FTB_SERVER_START} -sed -i 's/.*read.*Restart now/#\0/' ${FTB_SERVER_START} -legacyJavaFixerPath=${FTB_DIR}/mods/legacyjavafixer.jar +export FTB_SERVER_START=$(find ${FTB_BASE_DIR} $entryScriptExpr) -if isTrue ${FTB_LEGACYJAVAFIXER} && [ ! -e ${legacyJavaFixerPath} ]; then +export FTB_DIR=$(dirname "${FTB_SERVER_START}") +chmod a+x "${FTB_SERVER_START}" +sed -i 's/-jar/-Dfml.queryResult=confirm -jar/' "${FTB_SERVER_START}" +sed -i 's/.*read.*Restart now/#\0/' "${FTB_SERVER_START}" +legacyJavaFixerPath="${FTB_DIR}/mods/legacyjavafixer.jar" + +if isTrue ${FTB_LEGACYJAVAFIXER} && [ ! -e "${legacyJavaFixerPath}" ]; then echo "Installing legacy java fixer to ${legacyJavaFixerPath}" - curl -sSL -o ${legacyJavaFixerPath} ${legacyJavaFixerUrl} + curl -sSL -o "${legacyJavaFixerPath}" ${legacyJavaFixerUrl} fi -if [ -e ${FTB_DIR}/FTBInstall.sh ]; then - pushd ${FTB_DIR} +if [ -e "${FTB_DIR}/FTBInstall.sh" ]; then + pushd "${FTB_DIR}" sh FTBInstall.sh popd -elif [ -e ${FTB_DIR}/Install.sh ]; then - pushd ${FTB_DIR} +elif [ -e "${FTB_DIR}/Install.sh" ]; then + pushd "${FTB_DIR}" sh Install.sh popd fi diff --git a/minecraft-server/start-finalSetup04ServerProperties b/minecraft-server/start-finalSetup04ServerProperties index a3161fbd..0f2e7580 100644 --- a/minecraft-server/start-finalSetup04ServerProperties +++ b/minecraft-server/start-finalSetup04ServerProperties @@ -11,7 +11,7 @@ function setServerProp { var=${var,,} ;; esac echo "Setting ${prop} to '${var}' in ${SERVER_PROPERTIES}" - sed -i "/^${prop}\s*=/ c ${prop}=${var}" $SERVER_PROPERTIES + sed -i "/^${prop}\s*=/ c ${prop}=${var}" "$SERVER_PROPERTIES" else echo "Skip setting ${prop}" fi @@ -126,9 +126,9 @@ if [[ ${TYPE} == "FEED-THE-BEAST" ]]; then echo "detected FTB, changing properties path to ${SERVER_PROPERTIES}" fi -if [ ! -e $SERVER_PROPERTIES ]; then +if [ ! -e "$SERVER_PROPERTIES" ]; then echo "Creating server.properties in ${SERVER_PROPERTIES}" - cp /tmp/server.properties $SERVER_PROPERTIES + cp /tmp/server.properties "$SERVER_PROPERTIES" customizeServerProps elif [ -n "${OVERRIDE_SERVER_PROPERTIES}" ]; then case ${OVERRIDE_SERVER_PROPERTIES^^} in diff --git a/minecraft-server/start-minecraftFinalSetup b/minecraft-server/start-minecraftFinalSetup index 5def0b4b..0b4b1f40 100644 --- a/minecraft-server/start-minecraftFinalSetup +++ b/minecraft-server/start-minecraftFinalSetup @@ -87,33 +87,33 @@ fi mcServerRunnerArgs="--stop-duration 60s" if [[ ${TYPE} == "FEED-THE-BEAST" ]]; then - if [ ! -e ${FTB_DIR}/ops.json -a -e /data/ops.txt ]; then + if [ ! -e "${FTB_DIR}/ops.json" -a -e /data/ops.txt ]; then cp -f /data/ops.txt ${FTB_DIR}/ fi - if [ ! -e ${FTB_DIR}/whitelist.json -a -e /data/white-list.txt ]; then + if [ ! -e "${FTB_DIR}/whitelist.json" -a -e /data/white-list.txt ]; then cp -f /data/white-list.txt ${FTB_DIR}/ fi - cp -f /data/eula.txt ${FTB_DIR}/ + cp -f /data/eula.txt "${FTB_DIR}/" - cat > ${FTB_DIR}/settings-local.sh < "${FTB_DIR}/settings-local.sh" <