From 8ef7c2183e2bfa6c085d900aa7ae0e440d38291b Mon Sep 17 00:00:00 2001 From: Geoff Bourne Date: Sat, 26 Feb 2022 21:18:53 -0600 Subject: [PATCH] Restored error handling when missing vanilla version --- Dockerfile | 2 +- scripts/start-deployForge | 6 +++--- scripts/start-deployVanilla | 16 +++++++--------- 3 files changed, 11 insertions(+), 13 deletions(-) diff --git a/Dockerfile b/Dockerfile index 61a9a26e446..8d1fd7c5ca8 100644 --- a/Dockerfile +++ b/Dockerfile @@ -46,7 +46,7 @@ RUN easy-add --var os=${TARGETOS} --var arch=${TARGETARCH}${TARGETVARIANT} \ --var version=0.1.1 --var app=maven-metadata-release --file {{.app}} \ --from https://github.com/itzg/{{.app}}/releases/download/{{.version}}/{{.app}}_{{.version}}_{{.os}}_{{.arch}}.tar.gz -ARG MC_HELPER_VERSION=1.16.6 +ARG MC_HELPER_VERSION=1.16.8 ARG MC_HELPER_BASE_URL=https://github.com/itzg/mc-image-helper/releases/download/v${MC_HELPER_VERSION} RUN curl -fsSL ${MC_HELPER_BASE_URL}/mc-image-helper-${MC_HELPER_VERSION}.tgz \ | tar -C /usr/share -zxf - \ diff --git a/scripts/start-deployForge b/scripts/start-deployForge index c989ac219de..de044b3edd0 100755 --- a/scripts/start-deployForge +++ b/scripts/start-deployForge @@ -99,7 +99,7 @@ resolve_versions() { log "Checking Forge version information." case $FORGEVERSION in LATEST) - if ! FORGE_VERSION=$(get --json-path ".promos['$VANILLA_VERSION-latest']" "$promosUrl"); then + if ! FORGE_VERSION=$(get --json-path ".promos['$VANILLA_VERSION-latest']" --json-value-when-missing "" "$promosUrl"); then log "ERROR: Version $VANILLA_VERSION is not supported by Forge" log " Refer to http://files.minecraftforge.net/ for supported versions" exit 2 @@ -107,8 +107,8 @@ resolve_versions() { ;; RECOMMENDED) - if ! FORGE_VERSION=$(get -s --json-path ".promos['$VANILLA_VERSION-recommended']" "$promosUrl"); then - if ! FORGE_VERSION=$(get --json-path ".promos['$VANILLA_VERSION-latest']" "$promosUrl"); then + if ! FORGE_VERSION=$(get -s --json-path ".promos['$VANILLA_VERSION-recommended']" --json-value-when-missing "" "$promosUrl"); then + if ! FORGE_VERSION=$(get --json-path ".promos['$VANILLA_VERSION-latest']" --json-value-when-missing "" "$promosUrl"); then log "ERROR: Version $VANILLA_VERSION is not supported by Forge" log " Refer to http://files.minecraftforge.net/ for supported versions" exit 2 diff --git a/scripts/start-deployVanilla b/scripts/start-deployVanilla index fd2474bccbd..bd33947ae88 100755 --- a/scripts/start-deployVanilla +++ b/scripts/start-deployVanilla @@ -8,27 +8,25 @@ set -o pipefail export SERVER="minecraft_server.${VANILLA_VERSION// /_}.jar" if [ ! -e "$SERVER" ] || [ -n "$FORCE_REDOWNLOAD" ]; then - log "Downloading $SERVER ..." + log "Locating download for $SERVER ..." debug "Finding version manifest for $VANILLA_VERSION" versionManifestUrl=$(get 'https://launchermeta.mojang.com/mc/game/version_manifest.json' | jq --arg VANILLA_VERSION "$VANILLA_VERSION" --raw-output '[.versions[]|select(.id == $VANILLA_VERSION)][0].url') result=$? if [ $result != 0 ]; then - log "ERROR failed to obtain version manifest URL ($result)" + log "ERROR: failed to obtain version manifest URL ($result)" exit 1 fi if [ "$versionManifestUrl" = "null" ]; then - log "ERROR couldn't find a matching manifest entry for $VANILLA_VERSION" + log "ERROR: couldn't find a matching manifest entry for $VANILLA_VERSION" exit 1 fi debug "Found version manifest at $versionManifestUrl" - serverDownloadUrl=$(get --json-path '$.downloads.server.url' "${versionManifestUrl}") - result=$? - if [ $result != 0 ]; then - log "ERROR failed to obtain version manifest from $versionManifestUrl ($result)" + if ! serverDownloadUrl=$(get --json-path '$.downloads.server.url' "${versionManifestUrl}"); then + log "ERROR: failed to obtain version manifest from $versionManifestUrl ($result)" exit 1 elif [ "$serverDownloadUrl" = "null" ]; then - log "ERROR version $VANILLA_VERSION does not provide a server download" + log "ERROR: there is not a server download for version $VANILLA_VERSION" exit 1 fi @@ -36,7 +34,7 @@ if [ ! -e "$SERVER" ] || [ -n "$FORCE_REDOWNLOAD" ]; then get -o "$SERVER" "$serverDownloadUrl" result=$? if [ $result != 0 ]; then - log "ERROR failed to download server from $serverDownloadUrl ($result)" + log "ERROR: failed to download server from $serverDownloadUrl ($result)" exit 1 fi fi