Switch Quilt and Purpur to image helper (#2229)

This commit is contained in:
Geoff Bourne 2023-06-17 13:00:22 -05:00 committed by GitHub
parent 55fb21cdd7
commit 87e2f2b177
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
30 changed files with 128 additions and 134 deletions

View File

@ -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.31.0 ARG MC_HELPER_VERSION=1.32.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

View File

@ -55,14 +55,14 @@ docker run -it --rm -v ${PWD}:/scripts -e SCRIPTS=/scripts/ --entrypoint bash mc
From within the container you can run individual scripts via the attached `/scripts/` path; however, be sure to set any environment variables expected by the scripts by either `export`ing them manually: From within the container you can run individual scripts via the attached `/scripts/` path; however, be sure to set any environment variables expected by the scripts by either `export`ing them manually:
```shell script ```shell script
export VANILLA_VERSION=1.12.2 export VERSION=1.12.2
/scripts/start-magma /scripts/start-magma
``` ```
...or pre-pending script execution: ...or pre-pending script execution:
```shell script ```shell script
VANILLA_VERSION=1.12.2 /scripts/start-magma VERSION=1.12.2 /scripts/start-magma
``` ```
> NOTE: You may want to temporarily add an `exit` statement near the end of your script to isolate execution to just the script you're developing. > NOTE: You may want to temporarily add an `exit` statement near the end of your script to isolate execution to just the script you're developing.

View File

@ -7,7 +7,7 @@ services:
- "25565:25565" - "25565:25565"
environment: environment:
EULA: "true" EULA: "true"
TYPE: AUTO_CURSEFORGE MOD_PLATFORM: AUTO_CURSEFORGE
# allocate from https://console.curseforge.com/ and set in .env file # allocate from https://console.curseforge.com/ and set in .env file
CF_API_KEY: ${CF_API_KEY} CF_API_KEY: ${CF_API_KEY}
CF_PAGE_URL: https://www.curseforge.com/minecraft/modpacks/all-the-mods-8 CF_PAGE_URL: https://www.curseforge.com/minecraft/modpacks/all-the-mods-8

View File

@ -9,7 +9,7 @@ services:
- "25565:25565" - "25565:25565"
environment: environment:
EULA: "TRUE" EULA: "TRUE"
TYPE: MODRINTH MOD_PLATFORM: MODRINTH
MODRINTH_PROJECT: https://modrinth.com/modpack/cobblemon-fabric/version/1.3.2 MODRINTH_PROJECT: https://modrinth.com/modpack/cobblemon-fabric/version/1.3.2
# or for auto-upgrading to latest # or for auto-upgrading to latest
# MODRINTH_PROJECT: https://modrinth.com/modpack/cobblemon-fabric # MODRINTH_PROJECT: https://modrinth.com/modpack/cobblemon-fabric
@ -18,7 +18,6 @@ services:
# MODRINTH_VERSION: nvrqJg44 # MODRINTH_VERSION: nvrqJg44
# MODRINTH_VERSION: 1.3.2 # MODRINTH_VERSION: 1.3.2
# MODRINTH_VERSION: "Cobblemon [Fabric] 1.3.2" # MODRINTH_VERSION: "Cobblemon [Fabric] 1.3.2"
SETUP_ONLY: "true"
volumes: volumes:
# attach the relative directory 'data' to the container's /data path # attach the relative directory 'data' to the container's /data path
- ./data:/data - ./data:/data

View File

@ -2,7 +2,7 @@ version: "3"
services: services:
mc: mc:
image: ${IMAGE_TO_TEST:-itzg/minecraft-server} image: itzg/minecraft-server
environment: environment:
EULA: "true" EULA: "true"
TYPE: PAPER TYPE: PAPER

View File

@ -7,7 +7,7 @@ services:
- "25565:25565" - "25565:25565"
environment: environment:
EULA: "true" EULA: "true"
TYPE: AUTO_CURSEFORGE MOD_PLATFORM: AUTO_CURSEFORGE
# CF_API_KEY=... must be set in .env file or as environment variable # CF_API_KEY=... must be set in .env file or as environment variable
CF_API_KEY: ${CF_API_KEY} CF_API_KEY: ${CF_API_KEY}
CF_SLUG: one-block-modded CF_SLUG: one-block-modded

View File

@ -7,7 +7,7 @@ services:
- "25565:25565" - "25565:25565"
environment: environment:
EULA: "true" EULA: "true"
TYPE: AUTO_CURSEFORGE MOD_PLATFORM: AUTO_CURSEFORGE
CF_API_KEY: # allocate from https://console.curseforge.com/ CF_API_KEY: # allocate from https://console.curseforge.com/
CF_SLUG: the-pixelmon-modpack CF_SLUG: the-pixelmon-modpack
CF_FILENAME_MATCHER: "9.1.2" CF_FILENAME_MATCHER: "9.1.2"

View File

@ -7,7 +7,7 @@ services:
- "25565:25565" - "25565:25565"
environment: environment:
EULA: "true" EULA: "true"
TYPE: AUTO_CURSEFORGE MOD_PLATFORM: AUTO_CURSEFORGE
CF_API_KEY: # allocate from https://console.curseforge.com/ CF_API_KEY: # allocate from https://console.curseforge.com/
CF_FORCE_SYNCHRONIZE: "true" CF_FORCE_SYNCHRONIZE: "true"
CF_PAGE_URL: https://www.curseforge.com/minecraft/modpacks/valhelsia-5/files/4429560 CF_PAGE_URL: https://www.curseforge.com/minecraft/modpacks/valhelsia-5/files/4429560

View File

@ -7,7 +7,7 @@ services:
- "25565:25565" - "25565:25565"
environment: environment:
EULA: "true" EULA: "true"
TYPE: AUTO_CURSEFORGE MOD_PLATFORM: AUTO_CURSEFORGE
CF_API_KEY: # allocate from https://console.curseforge.com/ CF_API_KEY: # allocate from https://console.curseforge.com/
CF_SLUG: vault-hunters-1-18-2 CF_SLUG: vault-hunters-1-18-2
CF_FILENAME_MATCHER: "Update-10.0.0" CF_FILENAME_MATCHER: "Update-10.0.0"

Binary file not shown.

Before

Width:  |  Height:  |  Size: 0 B

After

Width:  |  Height:  |  Size: 68 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 0 B

After

Width:  |  Height:  |  Size: 93 KiB

View File

@ -105,31 +105,6 @@ function fixJavaPath() {
fi fi
} }
function resolveVersion() {
VERSIONS_JSON=https://launchermeta.mojang.com/mc/game/version_manifest.json
case "X$VERSION" in
X|XLATEST|Xlatest)
if ! VANILLA_VERSION=$(get --json-path '$.latest.release' "$VERSIONS_JSON"); then
log "ERROR: version lookup failed: $VANILLA_VERSION"
exit 1
fi
;;
XSNAPSHOT|Xsnapshot)
if ! VANILLA_VERSION=$(get --json-path '$.latest.snapshot' "$VERSIONS_JSON"); then
log "ERROR: version lookup failed: $VANILLA_VERSION"
exit 1
fi
;;
*)
VANILLA_VERSION=$VERSION
;;
esac
export VANILLA_VERSION
MAJOR_VANILLA_VERSION=$(get_major_version "$VANILLA_VERSION")
export MAJOR_VANILLA_VERSION
log "Resolved version given ${VERSION} into ${VANILLA_VERSION} and major version ${MAJOR_VANILLA_VERSION}"
}
if ! fixJavaPath; then if ! fixJavaPath; then
log "ERROR: could not locate path that contains java" log "ERROR: could not locate path that contains java"
@ -187,8 +162,6 @@ if [[ $MOD_PLATFORM ]]; then
esac esac
fi fi
resolveVersion
log "Resolving type given ${TYPE}" log "Resolving type given ${TYPE}"
case "${TYPE^^}" in case "${TYPE^^}" in
*BUKKIT|SPIGOT) *BUKKIT|SPIGOT)
@ -204,7 +177,6 @@ case "${TYPE^^}" in
;; ;;
FORGE) FORGE)
evaluateJavaCompatibilityForForge
exec "${SCRIPTS:-/}start-deployForge" "$@" exec "${SCRIPTS:-/}start-deployForge" "$@"
;; ;;
@ -261,12 +233,6 @@ case "${TYPE^^}" in
;; ;;
CRUCIBLE) CRUCIBLE)
log "**********************************************************************"
log "WARNING: The image tag itzg/minecraft-server:java8 is recommended"
log " since some mods require Java 8"
log " Exception traces reporting ClassCastException: class jdk.internal.loader.ClassLoaders\$AppClassLoader"
log " can be fixed with java8"
log "**********************************************************************"
exec "${SCRIPTS:-/}start-deployCrucible" "$@" exec "${SCRIPTS:-/}start-deployCrucible" "$@"
;; ;;

View File

@ -66,13 +66,11 @@ if ! mc-image-helper install-curseforge "${args[@]}"; then
exit 1 exit 1
fi fi
# grab SERVER, FAMILY and export it # grab SERVER, TYPE, VERSION and export it
set -a set -a
# shellcheck disable=SC1090 # shellcheck disable=SC1090
source "${resultsFile}" source "${resultsFile}"
set +a set +a
# grab the version resolved from modpack resolveFamily
VANILLA_VERSION="$VERSION"
export VANILLA_VERSION
exec "${SCRIPTS:-/}start-setupWorld" "$@" exec "${SCRIPTS:-/}start-setupWorld" "$@"

View File

@ -1,6 +1,7 @@
#!/bin/bash #!/bin/bash
. ${SCRIPTS:-/}start-utils # shellcheck source=start-utils
. "${SCRIPTS:-/}start-utils"
isDebugging && set -x isDebugging && set -x
set -e set -e
@ -60,14 +61,14 @@ function downloadSpigot {
esac esac
if [[ ${VERSION^^} = LATEST ]]; then if [[ ${VERSION^^} = LATEST ]]; then
VANILLA_VERSION=$(restify https://getbukkit.org/download/spigot --attribute='property=og:title' | jq -r '.[0] | .attributes | select(.property == "og:title") | .content | split(" ") | .[-1]') VERSION=$(restify https://getbukkit.org/download/spigot --attribute='property=og:title' | jq -r '.[0] | .attributes | select(.property == "og:title") | .content | split(" ") | .[-1]')
fi fi
if [[ -z $downloadUrl ]]; then if [[ -z $downloadUrl ]]; then
if versionLessThan 1.16.5 || ([[ ${getbukkitFlavor} = "craftbukkit" ]] && [[ ${VANILLA_VERSION} = "1.16.5" ]]); then if versionLessThan 1.16.5 || ([[ ${getbukkitFlavor} = "craftbukkit" ]] && [[ ${VERSION} = "1.16.5" ]]); then
downloadUrl="https://cdn.getbukkit.org/${getbukkitFlavor}/${getbukkitFlavor}-${VANILLA_VERSION}.jar" downloadUrl="https://cdn.getbukkit.org/${getbukkitFlavor}/${getbukkitFlavor}-${VERSION}.jar"
else else
downloadUrl="https://download.getbukkit.org/${getbukkitFlavor}/${getbukkitFlavor}-${VANILLA_VERSION}.jar" downloadUrl="https://download.getbukkit.org/${getbukkitFlavor}/${getbukkitFlavor}-${VERSION}.jar"
fi fi
fi fi
@ -108,15 +109,16 @@ EOF
function setServerVar { function setServerVar {
case "$TYPE" in case "$TYPE" in
*BUKKIT|*bukkit) *BUKKIT|*bukkit)
export SERVER=craftbukkit_server-${VANILLA_VERSION}.jar export SERVER=craftbukkit_server-${VERSION}.jar
;; ;;
*) *)
export SERVER=spigot_server-${VANILLA_VERSION}.jar export SERVER=spigot_server-${VERSION}.jar
;; ;;
esac esac
} }
if isTrue "$BUILD_SPIGOT_FROM_SOURCE" || isTrue "$BUILD_FROM_SOURCE"; then if isTrue "$BUILD_SPIGOT_FROM_SOURCE" || isTrue "$BUILD_FROM_SOURCE"; then
resolveVersion
setServerVar setServerVar
if [ ! -f "$SERVER" ] || isTrue "$FORCE_REDOWNLOAD"; then if [ ! -f "$SERVER" ] || isTrue "$FORCE_REDOWNLOAD"; then
buildSpigotFromSource buildSpigotFromSource

View File

@ -6,7 +6,7 @@ set -o pipefail
set -e set -e
isDebugging && set -x isDebugging && set -x
requireVar VANILLA_VERSION resolveVersion
: "${CRUCIBLE_RELEASE:=latest}" : "${CRUCIBLE_RELEASE:=latest}"
crucibleReleasesUrl=https://api.github.com/repos/CrucibleMC/Crucible/releases crucibleReleasesUrl=https://api.github.com/repos/CrucibleMC/Crucible/releases
@ -16,14 +16,14 @@ else
crucibleReleaseUrl=${crucibleReleasesUrl}/tags/${CRUCIBLE_RELEASE} crucibleReleaseUrl=${crucibleReleasesUrl}/tags/${CRUCIBLE_RELEASE}
fi fi
if ! downloadUrl=$(get --json-path "$.assets[?(@.name =~ /Crucible-${VANILLA_VERSION}-.*\.jar/)].browser_download_url" \ if ! downloadUrl=$(get --json-path "$.assets[?(@.name =~ /Crucible-${VERSION}-.*\.jar/)].browser_download_url" \
--accept "application/vnd.github.v3+json" "$crucibleReleaseUrl"); then --accept "application/vnd.github.v3+json" "$crucibleReleaseUrl"); then
log "ERROR: failed to access ${CRUCIBLE_RELEASE} release of Crucible" log "ERROR: failed to access ${CRUCIBLE_RELEASE} release of Crucible"
exit 1 exit 1
fi fi
if [[ $downloadUrl = null ]]; then if [[ $downloadUrl = null ]]; then
log "ERROR: failed to locate Crucible jar for $VANILLA_VERSION from ${CRUCIBLE_RELEASE}" log "ERROR: failed to locate Crucible jar for $VERSION from ${CRUCIBLE_RELEASE}"
exit 1 exit 1
fi fi

View File

@ -19,9 +19,10 @@ if [[ $FABRIC_LAUNCHER ]]; then
if ! mc-image-helper install-fabric-loader \ if ! mc-image-helper install-fabric-loader \
--results-file=${resultsFile} \ --results-file=${resultsFile} \
--from-local-file="$FABRIC_LAUNCHER"; then --from-local-file="$FABRIC_LAUNCHER"; then
log "ERROR failed to install Fabric launcher from $FABRIC_LAUNCHER" log "ERROR failed to use provided Fabric launcher"
exit 1 exit 1
fi fi
# Custom fabric jar url # Custom fabric jar url
elif [[ $FABRIC_LAUNCHER_URL ]]; then elif [[ $FABRIC_LAUNCHER_URL ]]; then
if ! mc-image-helper install-fabric-loader \ if ! mc-image-helper install-fabric-loader \
@ -30,19 +31,21 @@ elif [[ $FABRIC_LAUNCHER_URL ]]; then
log "ERROR failed to install Fabric launcher from $FABRIC_LAUNCHER_URL" log "ERROR failed to install Fabric launcher from $FABRIC_LAUNCHER_URL"
exit 1 exit 1
fi fi
# Official fabric launcher # Official fabric launcher
else else
if ! mc-image-helper install-fabric-loader \ if ! mc-image-helper install-fabric-loader \
--results-file=${resultsFile} \ --results-file=${resultsFile} \
--minecraft-version="${VANILLA_VERSION}" \ --minecraft-version="${VERSION}" \
--installer-version="${FABRIC_LAUNCHER_VERSION}" \ --installer-version="${FABRIC_LAUNCHER_VERSION}" \
--loader-version="${FABRIC_LOADER_VERSION}"; then --loader-version="${FABRIC_LOADER_VERSION}"; then
log "ERROR failed to install Fabric launcher from $VANILLA_VERSION, $FABRIC_LAUNCHER_VERSION, $FABRIC_LOADER_VERSION" log "ERROR failed to install Fabric launcher given $VERSION, $FABRIC_LAUNCHER_VERSION, $FABRIC_LOADER_VERSION"
exit 1 exit 1
fi fi
fi fi
# grab SERVER and export it # grab SERVER, etc and export it
set -a set -a
# shellcheck disable=SC1090 # shellcheck disable=SC1090
source "${resultsFile}" source "${resultsFile}"

View File

@ -7,8 +7,6 @@
. "${SCRIPTS:-$(dirname "$0")}/start-utils" . "${SCRIPTS:-$(dirname "$0")}/start-utils"
isDebugging && set -x isDebugging && set -x
# NOTE: VERSION rather than VANILLA_VERSION is specified to allow for latest supported
# Forge version to be selected.
if [[ ${FORGE_INSTALLER} ]]; then if [[ ${FORGE_INSTALLER} ]]; then
if ! mc-image-helper install-forge \ if ! mc-image-helper install-forge \
--output-directory=/data \ --output-directory=/data \

View File

@ -4,10 +4,15 @@
. "${SCRIPTS:-/}start-utils" . "${SCRIPTS:-/}start-utils"
isDebugging && set -x isDebugging && set -x
: "${VANILLA_VERSION?}" resolveVersion
if ! downloadUrl=$(get --json-path '$.link' "https://api.magmafoundation.org/api/v2/${VANILLA_VERSION}/latest"); then if ! downloadUrl=$(get --json-path '$.link' "https://api.magmafoundation.org/api/v2/${VERSION}/latest"); then
log "ERROR failed to locate latest Magma download for ${VANILLA_VERSION}. Is that version supported?" log "ERROR failed to locate latest Magma download for ${VERSION}. Is that version supported?"
exit 1
fi
if [[ $downloadUrl == null ]]; then
log "ERROR Magma does not seem to be available for $VERSION"
exit 1 exit 1
fi fi

View File

@ -48,13 +48,11 @@ if ! mc-image-helper install-modrinth-modpack "${args[@]}"; then
exit 1 exit 1
fi fi
# grab SERVER, FAMILY and export it # grab SERVER, TYPE, VERSION and export it
set -a set -a
# shellcheck disable=SC1090 # shellcheck disable=SC1090
source "${resultsFile}" source "${resultsFile}"
set +a set +a
# grab the version resolved from modpack resolveFamily
VANILLA_VERSION="$VERSION"
export VANILLA_VERSION
exec "${SCRIPTS:-/}start-setupWorld" "$@" exec "${SCRIPTS:-/}start-setupWorld" "$@"

View File

@ -6,14 +6,14 @@ set -o pipefail
set -e set -e
isDebugging && set -x isDebugging && set -x
requireVar VANILLA_VERSION resolveVersion
: "${MOHIST_BUILD:=lastSuccessfulBuild}" : "${MOHIST_BUILD:=lastSuccessfulBuild}"
mohistJobs=https://ci.codemc.io/job/MohistMC/job/ mohistJobs=https://ci.codemc.io/job/MohistMC/job/
mohistJob=${mohistJobs}Mohist-${VANILLA_VERSION}/ mohistJob=${mohistJobs}Mohist-${VERSION}/
if ! get --exists "${mohistJob}"; then if ! get --exists "${mohistJob}"; then
log "ERROR: mohist builds do not exist for ${VANILLA_VERSION}" log "ERROR: mohist builds do not exist for ${VERSION}"
log " check https://ci.codemc.io/job/MohistMC/ for available versions" log " check https://ci.codemc.io/job/MohistMC/ for available versions"
log " and set VERSION accordingly" log " and set VERSION accordingly"
exit 1 exit 1
@ -25,7 +25,7 @@ buildRelPath=$(
baseName=$(basename "${buildRelPath}") baseName=$(basename "${buildRelPath}")
if [[ ${baseName} != *-server.jar* ]]; then if [[ ${baseName} != *-server.jar* ]]; then
log "ERROR: mohist build for ${VANILLA_VERSION} is not a valid server jar, found ${baseName}" log "ERROR: mohist build for ${VERSION} is not a valid server jar, found ${baseName}"
log " check https://ci.codemc.io/job/MohistMC/ for available versions" log " check https://ci.codemc.io/job/MohistMC/ for available versions"
log " and set VERSION accordingly" log " and set VERSION accordingly"
exit 1 exit 1

View File

@ -15,7 +15,8 @@ fi
: "${PUFFERFISH_BUILD:=lastSuccessfulBuild}" : "${PUFFERFISH_BUILD:=lastSuccessfulBuild}"
PUFFERFISH_BUILD_JSON=$(curl -X GET -s "https://ci.pufferfish.host/job/Pufferfish-${MAJOR_VANILLA_VERSION}/${PUFFERFISH_BUILD}/api/json") majorVersion=$(get_major_version "$VERSION")
PUFFERFISH_BUILD_JSON=$(curl -X GET -s "https://ci.pufferfish.host/job/Pufferfish-${majorVersion}/${PUFFERFISH_BUILD}/api/json")
# Example: "url": "https://ci.pufferfish.host/job/Pufferfish-1.18/50/", # Example: "url": "https://ci.pufferfish.host/job/Pufferfish-1.18/50/",
PUFFERFISH_BUILD_URL=$(jq -n "$PUFFERFISH_BUILD_JSON" | jq -jc '.url // empty' ) PUFFERFISH_BUILD_URL=$(jq -n "$PUFFERFISH_BUILD_JSON" | jq -jc '.url // empty' )
# Example: "fileName": "pufferfish-paperclip-1.18.2-R0.1-SNAPSHOT-reobf.jar", # Example: "fileName": "pufferfish-paperclip-1.18.2-R0.1-SNAPSHOT-reobf.jar",

View File

@ -4,8 +4,6 @@ set -eu
# shellcheck source=start-utils # shellcheck source=start-utils
. "${SCRIPTS:-/}start-utils" . "${SCRIPTS:-/}start-utils"
requireVar VANILLA_VERSION
export TYPE=QUILT
: "${QUILT_LAUNCHER:=}" : "${QUILT_LAUNCHER:=}"
: "${QUILT_LAUNCHER_URL:=}" : "${QUILT_LAUNCHER_URL:=}"
: "${QUILT_INSTALLER_URL:=}" : "${QUILT_INSTALLER_URL:=}"
@ -14,47 +12,50 @@ export TYPE=QUILT
isDebugging && set -x isDebugging && set -x
# Custom quilt jar resultsFile=/data/.quilt.env
if [[ $QUILT_LAUNCHER ]]; then if [[ $QUILT_LAUNCHER ]]; then
export SERVER=${QUILT_LAUNCHER} log "WARNING: use of QUILT_LAUNCHER is a deprecated feature."
# Custom quilt jar url SERVER="$QUILT_LAUNCHER"
export SERVER
resolveVersion
export FAMILY=FABRIC
exec "${SCRIPTS:-/}start-setupWorld" "$@"
elif [[ $QUILT_LAUNCHER_URL ]]; then elif [[ $QUILT_LAUNCHER_URL ]]; then
export SERVER=quilt-server-$(echo -n "$QUILT_LAUNCHER_URL" | mc-image-helper hash) log "ERROR: QUILT_LAUNCHER_URL is not longer supported. Pre-download and use QUILT_LAUNCHER."
# Official quilt installer exit 2
elif [[ $QUILT_INSTALLER_URL ]]; then
if ! mc-image-helper install-quilt \
--loader-version="$QUILT_LOADER_VERSION" \
--minecraft-version="$VERSION" \
--output-directory=/data \
--results-file="$resultsFile" \
--installer-url="$QUILT_INSTALLER_URL"; then
log "ERROR: failed to install Quilt given custom installer URL $QUILT_INSTALLER_URL"
exit 2
fi
else else
if [[ ${QUILT_INSTALLER_VERSION^^} = LATEST ]]; then if ! mc-image-helper install-quilt \
log "Checking Quilt Installer version information." --loader-version="$QUILT_LOADER_VERSION" \
QUILT_INSTALLER_VERSION=$(maven-metadata-release https://maven.quiltmc.org/repository/release/org/quiltmc/quilt-installer/maven-metadata.xml) --minecraft-version="$VERSION" \
--output-directory=/data \
--results-file="$resultsFile" \
--installer-version="$QUILT_INSTALLER_VERSION"; then
log "ERROR: failed to install Quilt given installer version $QUILT_INSTALLER_VERSION"
exit 2
fi fi
if [[ ${QUILT_LOADER_VERSION^^} = LATEST ]]; then
log "Checking Quilt Loader version information."
QUILT_LOADER_VERSION=$(maven-metadata-release https://maven.quiltmc.org/repository/release/org/quiltmc/quilt-loader/maven-metadata.xml)
fi
export INSTALLER=quilt-installer-${QUILT_INSTALLER_VERSION}.jar
export SERVER=quilt-server-${VANILLA_VERSION}-${QUILT_LOADER_VERSION}-launch.jar
export QUILT_INSTALLER_URL="https://maven.quiltmc.org/repository/release/org/quiltmc/quilt-installer/${QUILT_INSTALLER_VERSION}/quilt-installer-${QUILT_INSTALLER_VERSION}.jar"
fi fi
if [[ ! -e ${SERVER} && ! -z ${QUILT_INSTALLER_URL} ]]; then # grab SERVER, VERSION and export it
log "Downloading and installing $QUILT_INSTALLER_URL ..." set -a
if ! get -o "$INSTALLER" "$QUILT_INSTALLER_URL"; then # shellcheck disable=SC1090
log "Failed to download from given location $QUILT_INSTALLER_URL" source "${resultsFile}"
exit 2 set +a
fi
if ! java -jar ${INSTALLER} install server ${VANILLA_VERSION} ${QUILT_LOADER_VERSION} --install-dir=./ --download-server; then
log "Failed to install $INSTALLER"
exit 2
fi
if ! mv quilt-server-launch.jar ${SERVER}; then
log "Failed to rename $SERVER"
exit 2
fi
fi
if [[ ! -e ${SERVER} ]]; then
log "$SERVER does not exist, cannot launch server!"
exit 1
fi
export FAMILY=FABRIC export FAMILY=FABRIC
exec "${SCRIPTS:-/}start-setupWorld" "$@" exec "${SCRIPTS:-/}start-setupWorld" "$@"

View File

@ -1,5 +1,6 @@
#!/bin/bash #!/bin/bash
# shellcheck source=start-utils
. ${SCRIPTS:-/}start-utils . ${SCRIPTS:-/}start-utils
export TYPE=spongevanilla export TYPE=spongevanilla
@ -24,20 +25,20 @@ esac
if [ -z $SPONGEVERSION ]; then if [ -z $SPONGEVERSION ]; then
log "Choosing Version for Sponge" log "Choosing Version for Sponge"
if [ "$SPONGEBRANCH" == "stable" ]; then if [ "$SPONGEBRANCH" == "stable" ]; then
SPONGEVERSION=`curl -fsSL https://dl-api.spongepowered.org/v1/org.spongepowered/$TYPE | jq -r '.buildTypes.stable.latest.version'` SPONGEVERSION=$(curl -fsSL https://dl-api.spongepowered.org/v1/org.spongepowered/$TYPE | jq -r '.buildTypes.stable.latest.version')
else else
SPONGEVERSION=`curl -fsSL https://dl-api.spongepowered.org/v1/org.spongepowered/$TYPE | jq -r '.buildTypes.bleeding.latest.version'` SPONGEVERSION=$(curl -fsSL https://dl-api.spongepowered.org/v1/org.spongepowered/$TYPE | jq -r '.buildTypes.bleeding.latest.version')
fi fi
fi fi
VANILLA_VERSION="$SPONGEVERSION" VERSION="$SPONGEVERSION"
export VANILLA_VERSION export VERSION
export SERVER="spongevanilla-$SPONGEVERSION.jar" export SERVER="spongevanilla-$SPONGEVERSION.jar"
if [ ! -e $SERVER ] || [ -n "$FORCE_REDOWNLOAD" ]; then if [ ! -e "$SERVER" ] || [ -n "$FORCE_REDOWNLOAD" ]; then
log "Downloading $SERVER ..." log "Downloading $SERVER ..."
curl -sSL -o $SERVER https://repo.spongepowered.org/maven/org/spongepowered/$TYPE/$SPONGEVERSION/$SERVER curl -sSL -o "$SERVER" "https://repo.spongepowered.org/maven/org/spongepowered/$TYPE/$SPONGEVERSION/$SERVER"
fi fi
export FAMILY=SPONGE export FAMILY=SPONGE
exec ${SCRIPTS:-/}start-setupWorld "$@" exec "${SCRIPTS:-/}start-setupWorld" "$@"

View File

@ -5,18 +5,19 @@
isDebugging && set -x isDebugging && set -x
set -o pipefail set -o pipefail
export SERVER="minecraft_server.${VANILLA_VERSION// /_}.jar" resolveVersion
export SERVER="minecraft_server.${VERSION// /_}.jar"
if [ ! -e "$SERVER" ] || [ -n "$FORCE_REDOWNLOAD" ]; then if [ ! -e "$SERVER" ] || [ -n "$FORCE_REDOWNLOAD" ]; then
debug "Finding version manifest for $VANILLA_VERSION" debug "Finding version manifest for $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') versionManifestUrl=$(get 'https://launchermeta.mojang.com/mc/game/version_manifest.json' | jq --arg VERSION "$VERSION" --raw-output '[.versions[]|select(.id == $VERSION)][0].url')
result=$? result=$?
if [ $result != 0 ]; then if [ $result != 0 ]; then
log "ERROR: failed to obtain version manifest URL ($result)" log "ERROR: failed to obtain version manifest URL ($result)"
exit 1 exit 1
fi fi
if [ "$versionManifestUrl" = "null" ]; then 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 $VERSION"
exit 1 exit 1
fi fi
debug "Found version manifest at $versionManifestUrl" debug "Found version manifest at $versionManifestUrl"
@ -25,11 +26,11 @@ if [ ! -e "$SERVER" ] || [ -n "$FORCE_REDOWNLOAD" ]; then
log "ERROR: failed to obtain version manifest from $versionManifestUrl ($result)" log "ERROR: failed to obtain version manifest from $versionManifestUrl ($result)"
exit 1 exit 1
elif [ "$serverDownloadUrl" = "null" ]; then elif [ "$serverDownloadUrl" = "null" ]; then
log "ERROR: there is not a server download for version $VANILLA_VERSION" log "ERROR: there is not a server download for version $VERSION"
exit 1 exit 1
fi fi
log "Downloading $VANILLA_VERSION server..." log "Downloading $VERSION server..."
debug "Downloading server from $serverDownloadUrl" debug "Downloading server from $serverDownloadUrl"
get -o "$SERVER" "$serverDownloadUrl" get -o "$SERVER" "$serverDownloadUrl"
result=$? result=$?

View File

@ -57,7 +57,7 @@ updateReleaseNumber(){
} }
retrieveVersionTypeNumber(){ retrieveVersionTypeNumber(){
VERSION_NAME="Minecraft ${MAJOR_VANILLA_VERSION}" VERSION_NAME=$(get_major_version "$VERSION")
minecraft_types=$(curl -X GET -s \ minecraft_types=$(curl -X GET -s \
"${FORGEAPI_BASE_URL}/games/${MINECRAFT_GAME_ID}/version-types" \ "${FORGEAPI_BASE_URL}/games/${MINECRAFT_GAME_ID}/version-types" \
-H 'Accept: application/json' -H 'x-api-key: '${MODS_FORGEAPI_KEY}'') -H 'Accept: application/json' -H 'x-api-key: '${MODS_FORGEAPI_KEY}'')

View File

@ -289,7 +289,7 @@ function handleModrinthProjects() {
mc-image-helper modrinth \ mc-image-helper modrinth \
--output-directory=/data \ --output-directory=/data \
--projects="${MODRINTH_PROJECTS}" \ --projects="${MODRINTH_PROJECTS}" \
--game-version="${VANILLA_VERSION}" \ --game-version="${VERSION}" \
--loader="$loader" \ --loader="$loader" \
--download-optional-dependencies="$MODRINTH_DOWNLOAD_OPTIONAL_DEPENDENCIES" \ --download-optional-dependencies="$MODRINTH_DOWNLOAD_OPTIONAL_DEPENDENCIES" \
--allowed-version-type="$MODRINTH_ALLOWED_VERSION_TYPE" --allowed-version-type="$MODRINTH_ALLOWED_VERSION_TYPE"

View File

@ -163,7 +163,7 @@ function normalizeMemSize() {
function versionLessThan() { function versionLessThan() {
# Use if-else since strict mode might be enabled # Use if-else since strict mode might be enabled
if mc-image-helper compare-versions "${VANILLA_VERSION}" lt "${1?}"; then if mc-image-helper compare-versions "${VERSION}" lt "${1?}"; then
return 0 return 0
else else
return 1 return 1
@ -321,3 +321,27 @@ function usesPlugins() {
esac esac
return 1 return 1
} }
function resolveVersion() {
givenVersion="$VERSION"
# shellcheck disable=SC2153
if ! VERSION=$(mc-image-helper resolve-minecraft-version "$VERSION"); then
exit 2
fi
log "Resolved version given ${givenVersion} into ${VERSION}"
}
function resolveFamily() {
case "$TYPE" in
PAPER|SPIGOT|BUKKIT|CANYON|PUFFERFISH|PURPUR)
FAMILY=SIGOT
;;
FORGE)
FAMILY=FORGE
;;
FABRIC|QUILT)
FAMILY=FABRIC
;;
esac
export FAMILY
}

View File

@ -6,7 +6,7 @@ services:
environment: environment:
EULA: "true" EULA: "true"
SETUP_ONLY: "TRUE" SETUP_ONLY: "TRUE"
TYPE: AUTO_CURSEFORGE MOD_PLATFORM: AUTO_CURSEFORGE
CF_API_KEY: ${CF_API_KEY} CF_API_KEY: ${CF_API_KEY}
CF_SLUG: the-pixelmon-modpack CF_SLUG: the-pixelmon-modpack
CF_FILENAME_MATCHER: "9.1.2" CF_FILENAME_MATCHER: "9.1.2"

View File

@ -7,10 +7,7 @@ services:
EULA: "true" EULA: "true"
SETUP_ONLY: "true" SETUP_ONLY: "true"
TYPE: FABRIC TYPE: FABRIC
FABRIC_LAUNCHER: /servers/fake.jar
CUSTOM_SERVER: /servers/fake.jar
VERSION: 1.19.1 VERSION: 1.19.1
MODRINTH_PROJECTS: fabric-api,cloth-config MODRINTH_PROJECTS: fabric-api,cloth-config
volumes: volumes:
- ./data:/data - ./data:/data
- ./fake.jar:/servers/fake.jar