mirror of
https://github.com/itzg/docker-minecraft-server
synced 2024-12-13 22:02:28 +00:00
Fixed CF_SERVER_MOD to handle spaces in the given filename
Updated USE_MODPACK_START_SCRIPT=false to support forge provided by pack For #608
This commit is contained in:
parent
2322dffd49
commit
48ccdf128f
1 changed files with 23 additions and 19 deletions
|
@ -3,6 +3,7 @@
|
||||||
set -e
|
set -e
|
||||||
|
|
||||||
. ${SCRIPTS:-/}start-utils
|
. ${SCRIPTS:-/}start-utils
|
||||||
|
isDebugging && set -x
|
||||||
|
|
||||||
export FTB_BASE_DIR=/data/FeedTheBeast
|
export FTB_BASE_DIR=/data/FeedTheBeast
|
||||||
legacyJavaFixerUrl=http://ftb.cursecdn.com/FTB2/maven/net/minecraftforge/lex/legacyjavafixer/1.0/legacyjavafixer-1.0.jar
|
legacyJavaFixerUrl=http://ftb.cursecdn.com/FTB2/maven/net/minecraftforge/lex/legacyjavafixer/1.0/legacyjavafixer-1.0.jar
|
||||||
|
@ -14,7 +15,7 @@ log "Looking for Feed-The-Beast / CurseForge server modpack."
|
||||||
requireVar FTB_SERVER_MOD
|
requireVar FTB_SERVER_MOD
|
||||||
|
|
||||||
if ! isTrue ${USE_MODPACK_START_SCRIPT:-true}; then
|
if ! isTrue ${USE_MODPACK_START_SCRIPT:-true}; then
|
||||||
if ! [ -f ${FTB_SERVER_MOD} ]; then
|
if ! [ -f "${FTB_SERVER_MOD}" ]; then
|
||||||
log "ERROR unable to find requested modpack file ${FTB_SERVER_MOD}"
|
log "ERROR unable to find requested modpack file ${FTB_SERVER_MOD}"
|
||||||
exit 2
|
exit 2
|
||||||
fi
|
fi
|
||||||
|
@ -37,22 +38,25 @@ if ! isTrue ${USE_MODPACK_START_SCRIPT:-true}; then
|
||||||
if $needsInstall; then
|
if $needsInstall; then
|
||||||
log "Unpacking FTB server modpack ${FTB_SERVER_MOD} ..."
|
log "Unpacking FTB server modpack ${FTB_SERVER_MOD} ..."
|
||||||
mkdir -p ${FTB_BASE_DIR}
|
mkdir -p ${FTB_BASE_DIR}
|
||||||
unzip -o ${FTB_SERVER_MOD} -d ${FTB_BASE_DIR} | awk '{printf "."} END {print ""}'
|
unzip -o "${FTB_SERVER_MOD}" -d ${FTB_BASE_DIR} | awk '{printf "."} END {print ""}'
|
||||||
|
|
||||||
forgeInstallerJar=$(find ${FTB_BASE_DIR} -name "forge*installer.jar")
|
serverJar=$(find ${FTB_BASE_DIR} -path "*/libraries/*" -prune -type f -o -not -name "forge*installer.jar" -name "forge*.jar")
|
||||||
if [[ -z "${forgeInstallerJar}" ]]; then
|
if [[ -z "$serverJar" ]]; then
|
||||||
log "ERROR Unable to find forge installer in modpack."
|
forgeInstallerJar=$(find ${FTB_BASE_DIR} -name "forge*installer.jar")
|
||||||
log " Make sure you downloaded the server files."
|
if [[ -z "${forgeInstallerJar}" ]]; then
|
||||||
exit 2
|
log "ERROR Unable to find forge installer in modpack."
|
||||||
|
log " Make sure you downloaded the server files."
|
||||||
|
exit 2
|
||||||
|
fi
|
||||||
|
|
||||||
|
log "Installing forge server"
|
||||||
|
(cd $(dirname "${forgeInstallerJar}"); java -jar $(basename "${forgeInstallerJar}") --installServer) | awk '{printf "."} END {print ""}'
|
||||||
fi
|
fi
|
||||||
|
|
||||||
log "Installing forge server"
|
|
||||||
(cd $(dirname "${forgeInstallerJar}"); java -jar $(basename ${forgeInstallerJar}) --installServer) | awk '{printf "."} END {print ""}'
|
|
||||||
|
|
||||||
echo "${FTB_SERVER_MOD}" > $installMarker
|
echo "${FTB_SERVER_MOD}" > $installMarker
|
||||||
fi
|
fi
|
||||||
|
|
||||||
export SERVER=$(find ${FTB_BASE_DIR} -not -name "forge*installer.jar" -name "forge*.jar")
|
export SERVER=$(find ${FTB_BASE_DIR} -path "*/libraries/*" -prune -type f -o -not -name "forge*installer.jar" -name "forge*.jar")
|
||||||
if [[ -z "${SERVER}" || ! -f "${SERVER}" ]]; then
|
if [[ -z "${SERVER}" || ! -f "${SERVER}" ]]; then
|
||||||
log "ERROR unable to locate installed forge server jar"
|
log "ERROR unable to locate installed forge server jar"
|
||||||
isDebugging && find ${FTB_BASE_DIR} -name "forge*.jar"
|
isDebugging && find ${FTB_BASE_DIR} -name "forge*.jar"
|
||||||
|
@ -89,7 +93,7 @@ fi
|
||||||
# this allows saving just the world separate from the rest of the data directory
|
# this allows saving just the world separate from the rest of the data directory
|
||||||
if [[ $startScriptCount = 0 ]]; then
|
if [[ $startScriptCount = 0 ]]; then
|
||||||
srv_modpack=${FTB_SERVER_MOD}
|
srv_modpack=${FTB_SERVER_MOD}
|
||||||
if isURL ${srv_modpack}; then
|
if isURL "${srv_modpack}"; then
|
||||||
case $srv_modpack in
|
case $srv_modpack in
|
||||||
https://www.feed-the-beast.com/*/download|https://www.curseforge.com/minecraft/modpacks/*/download/*/file)
|
https://www.feed-the-beast.com/*/download|https://www.curseforge.com/minecraft/modpacks/*/download/*/file)
|
||||||
;;
|
;;
|
||||||
|
@ -107,19 +111,19 @@ if [[ $startScriptCount = 0 ]]; then
|
||||||
fi
|
fi
|
||||||
srv_modpack=$downloaded
|
srv_modpack=$downloaded
|
||||||
fi
|
fi
|
||||||
if [[ ${srv_modpack:0:5} == "data/" ]]; then
|
if [[ "${srv_modpack:0:5}" == "data/" ]]; then
|
||||||
# Prepend with "/"
|
# Prepend with "/"
|
||||||
srv_modpack=/${srv_modpack}
|
srv_modpack="/${srv_modpack}"
|
||||||
fi
|
fi
|
||||||
if [[ ! ${srv_modpack:0:1} == "/" ]]; then
|
if [[ ! "${srv_modpack:0:1}" == "/" ]]; then
|
||||||
# If not an absolute path, assume file is in "/data"
|
# If not an absolute path, assume file is in "/data"
|
||||||
srv_modpack=/data/${srv_modpack}
|
srv_modpack=/data/${srv_modpack}
|
||||||
fi
|
fi
|
||||||
if [[ ! -f ${srv_modpack} ]]; then
|
if [[ ! -f "${srv_modpack}" ]]; then
|
||||||
log "FTB server modpack ${srv_modpack} not found."
|
log "FTB server modpack ${srv_modpack} not found."
|
||||||
exit 2
|
exit 2
|
||||||
fi
|
fi
|
||||||
if [[ ! ${srv_modpack: -4} == ".zip" ]]; then
|
if [[ ! "${srv_modpack: -4}" == ".zip" ]]; then
|
||||||
log "FTB server modpack ${srv_modpack} is not a zip archive."
|
log "FTB server modpack ${srv_modpack} is not a zip archive."
|
||||||
log "Please set FTB_SERVER_MOD to a file with a .zip extension."
|
log "Please set FTB_SERVER_MOD to a file with a .zip extension."
|
||||||
exit 2
|
exit 2
|
||||||
|
@ -127,7 +131,7 @@ if [[ $startScriptCount = 0 ]]; then
|
||||||
|
|
||||||
log "Unpacking FTB server modpack ${srv_modpack} ..."
|
log "Unpacking FTB server modpack ${srv_modpack} ..."
|
||||||
mkdir -p ${FTB_BASE_DIR}
|
mkdir -p ${FTB_BASE_DIR}
|
||||||
unzip -o ${srv_modpack} -d ${FTB_BASE_DIR} | awk '{printf "."} END {print ""}'
|
unzip -o "${srv_modpack}" -d ${FTB_BASE_DIR} | awk '{printf "."} END {print ""}'
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ $(find ${FTB_BASE_DIR} $entryScriptExpr | wc -l) = 0 ]]; then
|
if [[ $(find ${FTB_BASE_DIR} $entryScriptExpr | wc -l) = 0 ]]; then
|
||||||
|
@ -165,7 +169,7 @@ export FTB_SERVER_START=$(find "${FTB_BASE_DIR}" $entryScriptExpr)
|
||||||
|
|
||||||
export FTB_DIR=$(dirname "${FTB_SERVER_START}")
|
export FTB_DIR=$(dirname "${FTB_SERVER_START}")
|
||||||
chmod a+x "${FTB_SERVER_START}"
|
chmod a+x "${FTB_SERVER_START}"
|
||||||
grep fml.queryResult=confirm ${FTB_SERVER_START} > /dev/null || \
|
grep fml.queryResult=confirm "${FTB_SERVER_START}" > /dev/null || \
|
||||||
sed -i 's/-jar/-Dfml.queryResult=confirm -jar/' "${FTB_SERVER_START}"
|
sed -i 's/-jar/-Dfml.queryResult=confirm -jar/' "${FTB_SERVER_START}"
|
||||||
sed -i 's/.*read.*Restart now/#\0/' "${FTB_SERVER_START}"
|
sed -i 's/.*read.*Restart now/#\0/' "${FTB_SERVER_START}"
|
||||||
legacyJavaFixerPath="${FTB_DIR}/mods/legacyjavafixer.jar"
|
legacyJavaFixerPath="${FTB_DIR}/mods/legacyjavafixer.jar"
|
||||||
|
|
Loading…
Reference in a new issue