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,6 +19,22 @@ if ! isTrue ${USE_MODPACK_START_SCRIPT:-true}; then
exit 2
fi
needsInstall=true
installMarker=/data/.curseforge-installed
if [ -f $installMarker ]; then
if [ "$(cat $installMarker)" != "${FTB_SERVER_MOD}" ]; then
log "Upgrading modpack"
serverJar=$(find ${FTB_BASE_DIR} -not -name "forge*installer.jar" -name "forge*.jar")
if [[ "${serverJar}" ]]; then
rm -rf $(dirname "${serverJar}")/{mods,*.jar,libraries,resources,scripts}
fi
else
needsInstall=false
fi
fi
if $needsInstall; then
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 ""}'
@ -33,6 +49,9 @@ if ! isTrue ${USE_MODPACK_START_SCRIPT:-true}; then
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")
if [[ -z "${SERVER}" || ! -f "${SERVER}" ]]; then
log "ERROR unable to locate installed forge server jar"