Using image helper to download MODS

#1031
This commit is contained in:
Geoff Bourne 2021-10-10 09:33:17 -05:00
parent 2e37c16b2c
commit e5e9b0d928
3 changed files with 8 additions and 21 deletions

View file

@ -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

View file

@ -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 "$@"

View file

@ -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 ..."