Added support for upgrading with USE_MODPACK_START_SCRIPT=false

This commit is contained in:
Geoff Bourne 2020-07-19 18:10:16 -05:00
parent 06cffd9e15
commit 8b6ee91ec1

View File

@ -19,19 +19,38 @@ if ! isTrue ${USE_MODPACK_START_SCRIPT:-true}; then
exit 2 exit 2
fi fi
log "Unpacking FTB server modpack ${FTB_SERVER_MOD} ..." needsInstall=true
mkdir -p ${FTB_BASE_DIR} installMarker=/data/.curseforge-installed
unzip -o ${FTB_SERVER_MOD} -d ${FTB_BASE_DIR} | awk '{printf "."} END {print ""}' if [ -f $installMarker ]; then
if [ "$(cat $installMarker)" != "${FTB_SERVER_MOD}" ]; then
log "Upgrading modpack"
forgeInstallerJar=$(find ${FTB_BASE_DIR} -name "forge*installer.jar") serverJar=$(find ${FTB_BASE_DIR} -not -name "forge*installer.jar" -name "forge*.jar")
if [[ -z "${forgeInstallerJar}" ]]; then if [[ "${serverJar}" ]]; then
log "ERROR Unable to find forge installer in modpack." rm -rf $(dirname "${serverJar}")/{mods,*.jar,libraries,resources,scripts}
log " Make sure you downloaded the server files." fi
exit 2 else
needsInstall=false
fi
fi fi
log "Installing forge server" if $needsInstall; then
(cd $(dirname "${forgeInstallerJar}"); java -jar $(basename ${forgeInstallerJar}) --installServer) | awk '{printf "."} END {print ""}' log "Unpacking FTB server modpack ${FTB_SERVER_MOD} ..."
mkdir -p ${FTB_BASE_DIR}
unzip -o ${FTB_SERVER_MOD} -d ${FTB_BASE_DIR} | awk '{printf "."} END {print ""}'
forgeInstallerJar=$(find ${FTB_BASE_DIR} -name "forge*installer.jar")
if [[ -z "${forgeInstallerJar}" ]]; then
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 ""}'
echo "${FTB_SERVER_MOD}" > $installMarker
fi
export SERVER=$(find ${FTB_BASE_DIR} -not -name "forge*installer.jar" -name "forge*.jar") export SERVER=$(find ${FTB_BASE_DIR} -not -name "forge*installer.jar" -name "forge*.jar")
if [[ -z "${SERVER}" || ! -f "${SERVER}" ]]; then if [[ -z "${SERVER}" || ! -f "${SERVER}" ]]; then