Added error handling of FTB installer download

For #645
This commit is contained in:
Geoff Bourne 2020-11-25 21:36:22 -06:00
parent b7bcd252d3
commit f97b3bf82e

View File

@ -1,7 +1,5 @@
#!/bin/bash #!/bin/bash
ftbInstallMarker=".ftb-installed"
. ${SCRIPTS:-/}start-utils . ${SCRIPTS:-/}start-utils
isDebugging && set -x isDebugging && set -x
set -e set -e
@ -26,14 +24,26 @@ elif ! [[ ${FTB_MODPACK_VERSION_ID} =~ [0-9]+ ]]; then
exit 1 exit 1
fi fi
if ! [ -f "${ftbInstallMarker}" ] || [ $(cat "${ftbInstallMarker}") != "${FTB_MODPACK_ID}=${FTB_MODPACK_VERSION_ID}" ]; then
ftbInstaller=/data/ftb-installer ftbInstaller=/data/ftb-installer
if ! [[ -f "${ftbInstaller}" ]]; then
log "Downloading FTB installer" curlArgs=()
curl -fsSL https://api.modpacks.ch/public/modpack/1/1/server/linux -o "${ftbInstaller}" if [ -f "${ftbInstaller}" ]; then
chmod +x "${ftbInstaller}" curlArgs+=(-z "${ftbInstaller}")
fi
if isDebugging; then
curlArgs+=(-v)
fi fi
log "Downloading FTB installer"
curl -fsSL "${curlArgs[@]}" https://api.modpacks.ch/public/modpack/1/1/server/linux -o "${ftbInstaller}"
if [ $? != 0 ]; then
log "ERROR failed to download FTB installer"
rm -f "${ftbInstaller}"
exit 1
fi
chmod +x "${ftbInstaller}"
if ! [ -f "${ftbInstallMarker}" ] || [ $(cat "${ftbInstallMarker}") != "${FTB_MODPACK_ID}=${FTB_MODPACK_VERSION_ID}" ]; then
rm -rf forge*jar mods config libraries defaultconfigs changelogs rm -rf forge*jar mods config libraries defaultconfigs changelogs
log "Installing modpack ID ${FTB_MODPACK_ID}, version ID ${FTB_MODPACK_VERSION_ID}" log "Installing modpack ID ${FTB_MODPACK_ID}, version ID ${FTB_MODPACK_VERSION_ID}"