From e5e9b0d9284d8ee61320b40d095530f445931bb3 Mon Sep 17 00:00:00 2001 From: Geoff Bourne Date: Sun, 10 Oct 2021 09:33:17 -0500 Subject: [PATCH] Using image helper to download MODS #1031 --- Dockerfile | 2 +- start-deployFabric | 4 ++-- start-setupModpack | 23 +++++------------------ 3 files changed, 8 insertions(+), 21 deletions(-) diff --git a/Dockerfile b/Dockerfile index f2a58c12..f513ee51 100644 --- a/Dockerfile +++ b/Dockerfile @@ -60,7 +60,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.4.0 +ARG MC_HELPER_VERSION=1.5.2 RUN curl -fsSL https://github.com/itzg/mc-image-helper/releases/download/v${MC_HELPER_VERSION}/mc-image-helper-${MC_HELPER_VERSION}.tgz \ | tar -C /usr/share -zxf - \ && ln -s /usr/share/mc-image-helper-${MC_HELPER_VERSION}/bin/mc-image-helper /usr/bin diff --git a/start-deployFabric b/start-deployFabric index 97fa7be0..5fce8d46 100755 --- a/start-deployFabric +++ b/start-deployFabric @@ -58,7 +58,7 @@ if [[ ! -e ${SERVER} ]]; then exit 10 fi - mv fabric-server-launch.jar ${SERVER} + mv fabric-server-launch.jar "${SERVER}" fi -exec ${SCRIPTS:-/}start-setupWorld $@ +exec ${SCRIPTS:-/}start-setupWorld "$@" diff --git a/start-setupModpack b/start-setupModpack index 92cb9811..56bea8ed 100755 --- a/start-setupModpack +++ b/start-setupModpack @@ -2,6 +2,7 @@ set -e -o pipefail +# shellcheck source=start-utils . ${SCRIPTS:-/}start-utils if isDebugging; then set -x @@ -71,25 +72,11 @@ if [[ "$MODS" ]]; then for i in ${MODS//,/ } do - if isURL $i; then + if isURL "$i"; then log "Downloading mod/plugin $i ..." - if isValidFileURL jar "$i"; then - if ! curl -fsSL -o "${out_dir}/$(getFilenameFromUrl "${i}")" "${i}"; then - log "ERROR: failed to download from $i into $out_dir" - exit 2 - fi - else - effective_url=$(resolveEffectiveUrl "$i") - if isValidFileURL jar "${effective_url}"; then - out_file=$(getFilenameFromUrl "${effective_url}") - if ! curl -fsSL -o "${out_dir}/$out_file" "${effective_url}"; then - log "ERROR: failed to download from $i into $out_dir" - exit 2 - fi - else - log "ERROR: $effective_url resolved from $i is not a valid jar URL" - exit 2 - fi + if ! get -o "${out_dir}" "$i"; then + log "ERROR: failed to download from $i into $out_dir" + exit 2 fi elif [[ -f "$i" && "$i" =~ .*\.jar ]]; then log "Copying plugin located at $i ..."