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}} \ --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 --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 \ 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 - \ | tar -C /usr/share -zxf - \
&& ln -s /usr/share/mc-image-helper-${MC_HELPER_VERSION}/bin/mc-image-helper /usr/bin && 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 exit 10
fi fi
mv fabric-server-launch.jar ${SERVER} mv fabric-server-launch.jar "${SERVER}"
fi fi
exec ${SCRIPTS:-/}start-setupWorld $@ exec ${SCRIPTS:-/}start-setupWorld "$@"

View file

@ -2,6 +2,7 @@
set -e -o pipefail set -e -o pipefail
# shellcheck source=start-utils
. ${SCRIPTS:-/}start-utils . ${SCRIPTS:-/}start-utils
if isDebugging; then if isDebugging; then
set -x set -x
@ -71,25 +72,11 @@ if [[ "$MODS" ]]; then
for i in ${MODS//,/ } for i in ${MODS//,/ }
do do
if isURL $i; then if isURL "$i"; then
log "Downloading mod/plugin $i ..." log "Downloading mod/plugin $i ..."
if isValidFileURL jar "$i"; then if ! get -o "${out_dir}" "$i"; then
if ! curl -fsSL -o "${out_dir}/$(getFilenameFromUrl "${i}")" "${i}"; then log "ERROR: failed to download from $i into $out_dir"
log "ERROR: failed to download from $i into $out_dir" exit 2
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
fi fi
elif [[ -f "$i" && "$i" =~ .*\.jar ]]; then elif [[ -f "$i" && "$i" =~ .*\.jar ]]; then
log "Copying plugin located at $i ..." log "Copying plugin located at $i ..."