mc: properly generate server script when FTB/CF has spaces in path

For #342
This commit is contained in:
Geoff Bourne 2019-07-01 18:19:50 -05:00
parent b679edbd62
commit ede30188b0

View File

@ -76,20 +76,21 @@ 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
export FTB_BASE_DIR=$(dirname "${forgeJar}")
echo "No entry script found, so building one for ${forgeJar}"
cat > ${FTB_BASE_DIR}/ServerStart.sh <<EOF
cat > "${FTB_BASE_DIR}/ServerStart.sh" <<EOF
#!/bin/sh
. ./settings-local.sh
java \${JAVA_PARAMETERS} -Xmx\${MAX_RAM} -jar ${forgeJar} nogui
java \${JAVA_PARAMETERS} -Xmx\${MAX_RAM} -jar $(basename "${forgeJar}") nogui
EOF
chmod +x ${FTB_BASE_DIR}/ServerStart.sh
chmod +x "${FTB_BASE_DIR}/ServerStart.sh"
else
echo "Please make sure you are using the server version of the FTB modpack!"
exit 2
fi
fi
scriptCount=$(find ${FTB_BASE_DIR} $entryScriptExpr | wc -l)
scriptCount=$(find "${FTB_BASE_DIR}" $entryScriptExpr | wc -l)
if [[ $scriptCount = 0 ]]; then
echo "Please make sure you are using the server version of the FTB modpack!"
exit 2
@ -100,7 +101,7 @@ elif [[ $scriptCount > 1 ]]; then
exit 2
fi
export FTB_SERVER_START=$(find ${FTB_BASE_DIR} $entryScriptExpr)
export FTB_SERVER_START=$(find "${FTB_BASE_DIR}" $entryScriptExpr)
export FTB_DIR=$(dirname "${FTB_SERVER_START}")
chmod a+x "${FTB_SERVER_START}"