mirror of
https://github.com/itzg/docker-minecraft-server.git
synced 2026-11-05 08:19:23 +00:00
Use mc-image-helper for Purpur (#2215)
This commit is contained in:
1 parent
89fb4e7f51
commit
83fa659b4d
2 files changed
+31
-35
No files matched your search
+1
-1
@@ -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}} \
|
--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.30.1
|
ARG MC_HELPER_VERSION=1.31.0
|
||||||
ARG MC_HELPER_BASE_URL=https://github.com/itzg/mc-image-helper/releases/download/${MC_HELPER_VERSION}
|
ARG MC_HELPER_BASE_URL=https://github.com/itzg/mc-image-helper/releases/download/${MC_HELPER_VERSION}
|
||||||
# used for cache busting local copy of mc-image-helper
|
# used for cache busting local copy of mc-image-helper
|
||||||
ARG MC_HELPER_REV=1
|
ARG MC_HELPER_REV=1
|
||||||
|
|||||||
+30
-34
@@ -2,51 +2,47 @@
|
|||||||
set -euo pipefail
|
set -euo pipefail
|
||||||
IFS=$'\n\t'
|
IFS=$'\n\t'
|
||||||
|
|
||||||
|
: "${PURPUR_BUILD:=LATEST}"
|
||||||
: "${PURPUR_DOWNLOAD_URL:=}"
|
: "${PURPUR_DOWNLOAD_URL:=}"
|
||||||
|
|
||||||
# shellcheck source=start-utils
|
# shellcheck source=start-utils
|
||||||
. "${SCRIPTS:-/}start-utils"
|
. "${SCRIPTS:-/}start-utils"
|
||||||
isDebugging && set -x
|
isDebugging && set -x
|
||||||
|
|
||||||
|
resultsFile=/data/.purpur.env
|
||||||
|
|
||||||
if [[ $PURPUR_DOWNLOAD_URL ]]; then
|
if [[ $PURPUR_DOWNLOAD_URL ]]; then
|
||||||
export SERVER=$(getFilenameFromUrl "${PURPUR_DOWNLOAD_URL}")
|
if ! mc-image-helper install-purpur \
|
||||||
|
--output-directory=/data \
|
||||||
if [ -f "$SERVER" ]; then
|
--results-file="$resultsFile" \
|
||||||
zarg=(-z "$SERVER")
|
--url="$PURPUR_DOWNLOAD_URL}"; then
|
||||||
fi
|
log "ERROR: failed to download from custom Purpur URL"
|
||||||
|
|
||||||
echo "Preparing custom Purpur jar from $PURPUR_DOWNLOAD_URL"
|
|
||||||
|
|
||||||
curl -fsSL -o "$SERVER" "${zarg[@]}" "${PURPUR_DOWNLOAD_URL}"
|
|
||||||
else
|
|
||||||
: "${VANILLA_VERSION:?}"
|
|
||||||
: "${PURPUR_BUILD:=LATEST}"
|
|
||||||
: "${FORCE_REDOWNLOAD:=false}"
|
|
||||||
|
|
||||||
if [[ ${PURPUR_BUILD} == LATEST ]]; then
|
|
||||||
if ! PURPUR_BUILD=$(get --json-path=".builds.latest" "https://api.purpurmc.org/v2/purpur/${VANILLA_VERSION}"); then
|
|
||||||
log "ERROR: Failed to locate a Purpur build for ${VANILLA_VERSION}."
|
|
||||||
log " Please check if a download is available at https://purpur.pl3x.net/downloads/"
|
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
|
||||||
fi
|
fi
|
||||||
|
# grab SERVER and export it
|
||||||
|
set -a
|
||||||
|
# shellcheck disable=SC1090
|
||||||
|
source "${resultsFile}"
|
||||||
|
set +a
|
||||||
|
|
||||||
export SERVER="purpur-${VANILLA_VERSION}-${PURPUR_BUILD}.jar"
|
else
|
||||||
|
args=(
|
||||||
log "Removing old Purpur versions ..."
|
--output-directory=/data
|
||||||
shopt -s nullglob
|
--results-file="$resultsFile"
|
||||||
for f in purpur-*.jar; do
|
--version="$VERSION"
|
||||||
[[ $f != "$SERVER" ]] && rm "$f"
|
)
|
||||||
done
|
if [[ $PURPUR_BUILD ]]; then
|
||||||
|
args+=(--build="$PURPUR_BUILD")
|
||||||
if [ ! -f "$SERVER" ] || isTrue "$FORCE_REDOWNLOAD"; then
|
|
||||||
downloadUrl="https://api.purpurmc.org/v2/purpur/${VANILLA_VERSION}/${PURPUR_BUILD}/download"
|
|
||||||
log "Downloading Purpur from $downloadUrl ..."
|
|
||||||
if ! get -o "$SERVER" "$downloadUrl"; then
|
|
||||||
log "ERROR: failed to download from $downloadUrl (status=$?)"
|
|
||||||
exit 3
|
|
||||||
fi
|
|
||||||
fi
|
fi
|
||||||
|
if ! mc-image-helper install-purpur "${args[@]}"; then
|
||||||
|
log "ERROR: failed to download Purpur"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
# grab SERVER and export it
|
||||||
|
set -a
|
||||||
|
# shellcheck disable=SC1090
|
||||||
|
source "${resultsFile}"
|
||||||
|
set +a
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Normalize on Spigot for later operations
|
# Normalize on Spigot for later operations
|
||||||
|
|||||||
Reference in new issue
Block a user