mirror of
https://github.com/itzg/docker-minecraft-server.git
synced 2026-10-07 04:47:12 +00:00
Support automatically downloading and upgrading CurseForge modpacks (#1889)
This commit is contained in:
1 parent
dd6cda1ae5
commit
48367b7c1f
8 files changed
+119
-28
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.23.1
|
ARG MC_HELPER_VERSION=1.24.1
|
||||||
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}
|
||||||
RUN curl -fsSL ${MC_HELPER_BASE_URL}/mc-image-helper-${MC_HELPER_VERSION}.tgz \
|
RUN curl -fsSL ${MC_HELPER_BASE_URL}/mc-image-helper-${MC_HELPER_VERSION}.tgz \
|
||||||
| tar -C /usr/share -zxf - \
|
| tar -C /usr/share -zxf - \
|
||||||
|
|||||||
@@ -610,6 +610,47 @@ docker run -d --name mc-ftb -e EULA=TRUE \
|
|||||||
|
|
||||||
## Running a server with a CurseForge modpack
|
## Running a server with a CurseForge modpack
|
||||||
|
|
||||||
|
### New approach
|
||||||
|
|
||||||
|
> **NOTE** This approach is in early access. Please include as many details as possible when reporting issues for this.
|
||||||
|
|
||||||
|
To manage a CurseForge modpack automatically with upgrade support, set `TYPE` to "AUTO_CURSEFORGE". The appropriate mod loader (Forge / Fabric) will also be automatically installed with the version declared by the modpack.
|
||||||
|
|
||||||
|
Use one of the following to specify the modpack to install:
|
||||||
|
|
||||||
|
Pass a page URL to the modpack or a specific file with `CF_PAGE_URL` such as the modpack page "https://www.curseforge.com/minecraft/modpacks/all-the-mods-8" or a specific file "https://www.curseforge.com/minecraft/modpacks/all-the-mods-8/files/4248390". For example:
|
||||||
|
|
||||||
|
```
|
||||||
|
-e TYPE=AUTO_CURSEFORGE -e CF_PAGE_URL=https://www.curseforge.com/minecraft/modpacks/all-the-mods-8
|
||||||
|
```
|
||||||
|
|
||||||
|
Instead of a URL, the modpack slug can be provided as `CF_SLUG`. The slug is the short identifier visible in the URL after "/modpacks/", such as
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
For example:
|
||||||
|
```
|
||||||
|
-e TYPE=AUTO_CURSEFORGE -e CF_SLUG=all-the-mods-8
|
||||||
|
```
|
||||||
|
|
||||||
|
With either the modpack page or slug approach, the latest file will be located and used. If a specific version is desired, set either `CF_FILE_ID` to the numerical file ID or use a matching substring with `CF_FILENAME_MATCHER`.
|
||||||
|
|
||||||
|
The file ID can be located in the URL like
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
The following two examples both refer to version 1.0.7 of ATM8:
|
||||||
|
|
||||||
|
```
|
||||||
|
-e TYPE=AUTO_CURSEFORGE -e CF_SLUG=all-the-mods-8 -e CF_FILE_ID=4248390
|
||||||
|
```
|
||||||
|
|
||||||
|
```
|
||||||
|
-e TYPE=AUTO_CURSEFORGE -e CF_SLUG=all-the-mods-8 -e CF_FILENAME_MATCHER=1.0.7
|
||||||
|
```
|
||||||
|
|
||||||
|
### Old approach
|
||||||
|
|
||||||
Enable this server mode by adding `-e TYPE=CURSEFORGE` to your command-line,
|
Enable this server mode by adding `-e TYPE=CURSEFORGE` to your command-line,
|
||||||
but note the following additional steps needed...
|
but note the following additional steps needed...
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1 @@
|
|||||||
|
/.*.bkp
|
||||||
Binary file not shown.
|
After Width: | Height: | Size: 5.4 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 3.2 KiB |
@@ -0,0 +1,43 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
set -eu
|
||||||
|
|
||||||
|
# shellcheck source=start-utils
|
||||||
|
. "${SCRIPTS:-/}start-utils"
|
||||||
|
|
||||||
|
: "${CF_PAGE_URL:=}"
|
||||||
|
: "${CF_SLUG:=}"
|
||||||
|
: "${CF_FILE_ID:=}"
|
||||||
|
: "${CF_FILENAME_MATCHER:=}"
|
||||||
|
|
||||||
|
resultsFile=/data/.install-curseforge.env
|
||||||
|
|
||||||
|
isDebugging && set -x
|
||||||
|
|
||||||
|
args=(
|
||||||
|
--results-file="$resultsFile"
|
||||||
|
)
|
||||||
|
if [[ $CF_PAGE_URL ]]; then
|
||||||
|
args+=(--modpack-page-url="$CF_PAGE_URL")
|
||||||
|
fi
|
||||||
|
if [[ $CF_FILE_ID ]]; then
|
||||||
|
args+=(--file-id="$CF_FILE_ID")
|
||||||
|
fi
|
||||||
|
if [[ $CF_SLUG ]]; then
|
||||||
|
args+=(--slug="$CF_SLUG")
|
||||||
|
fi
|
||||||
|
if [[ $CF_FILENAME_MATCHER ]]; then
|
||||||
|
args+=(--filename-matcher="$CF_FILENAME_MATCHER")
|
||||||
|
fi
|
||||||
|
|
||||||
|
if ! mc-image-helper install-curseforge "${args[@]}"; then
|
||||||
|
log "ERROR failed to auto-install CurseForge modpack"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
# grab SERVER, FAMILY and export it
|
||||||
|
set -a
|
||||||
|
# shellcheck disable=SC1090
|
||||||
|
source "${resultsFile}"
|
||||||
|
set +a
|
||||||
|
|
||||||
|
exec "${SCRIPTS:-/}start-setupWorld" "$@"
|
||||||
@@ -136,11 +136,11 @@ cd /data || exit 1
|
|||||||
export ORIGINAL_TYPE=${TYPE^^}
|
export ORIGINAL_TYPE=${TYPE^^}
|
||||||
|
|
||||||
if isTrue "${ENABLE_AUTOPAUSE}"; then
|
if isTrue "${ENABLE_AUTOPAUSE}"; then
|
||||||
${SCRIPTS:-/}start-autopause
|
"${SCRIPTS:-/}start-autopause"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if isTrue "${ENABLE_AUTOSTOP}"; then
|
if isTrue "${ENABLE_AUTOSTOP}"; then
|
||||||
${SCRIPTS:-/}start-autostop
|
"${SCRIPTS:-/}start-autostop"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if
|
if
|
||||||
@@ -152,7 +152,7 @@ if
|
|||||||
then
|
then
|
||||||
log "Starting RCON commands"
|
log "Starting RCON commands"
|
||||||
# shellcheck source=start-rconcmds
|
# shellcheck source=start-rconcmds
|
||||||
${SCRIPTS:-/}start-rconcmds
|
"${SCRIPTS:-/}start-rconcmds"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if versionLessThan 1.7; then
|
if versionLessThan 1.7; then
|
||||||
@@ -196,6 +196,10 @@ case "${TYPE^^}" in
|
|||||||
exec "${SCRIPTS:-/}start-deployCF" "$@"
|
exec "${SCRIPTS:-/}start-deployCF" "$@"
|
||||||
;;
|
;;
|
||||||
|
|
||||||
|
AUTO_CURSEFORGE)
|
||||||
|
exec "${SCRIPTS:-/}start-autoDeployCF" "$@"
|
||||||
|
;;
|
||||||
|
|
||||||
VANILLA)
|
VANILLA)
|
||||||
exec "${SCRIPTS:-/}start-deployVanilla" "$@"
|
exec "${SCRIPTS:-/}start-deployVanilla" "$@"
|
||||||
;;
|
;;
|
||||||
|
|||||||
+26
-24
@@ -4,47 +4,49 @@ set -eu
|
|||||||
# shellcheck source=start-utils
|
# shellcheck source=start-utils
|
||||||
. "${SCRIPTS:-/}start-utils"
|
. "${SCRIPTS:-/}start-utils"
|
||||||
|
|
||||||
requireVar VANILLA_VERSION
|
|
||||||
export TYPE=FABRIC
|
export TYPE=FABRIC
|
||||||
: "${FABRIC_LAUNCHER_VERSION:=${FABRIC_INSTALLER_VERSION:-LATEST}}"
|
: "${FABRIC_LAUNCHER_VERSION:=${FABRIC_INSTALLER_VERSION:-LATEST}}"
|
||||||
: "${FABRIC_LAUNCHER:=}"
|
: "${FABRIC_LAUNCHER:=}"
|
||||||
: "${FABRIC_LAUNCHER_URL:=}"
|
: "${FABRIC_LAUNCHER_URL:=}"
|
||||||
: "${FABRIC_LOADER_VERSION:=LATEST}"
|
: "${FABRIC_LOADER_VERSION:=LATEST}"
|
||||||
|
|
||||||
|
resultsFile=/data/.install-fabric.env
|
||||||
|
|
||||||
isDebugging && set -x
|
isDebugging && set -x
|
||||||
|
|
||||||
# Custom fabric jar
|
# Custom fabric jar
|
||||||
if [[ $FABRIC_LAUNCHER ]]; then
|
if [[ $FABRIC_LAUNCHER ]]; then
|
||||||
export SERVER=${FABRIC_LAUNCHER}
|
if ! mc-image-helper install-fabric-loader \
|
||||||
|
--results-file=${resultsFile} \
|
||||||
|
--from-local-file="$FABRIC_LAUNCHER"; then
|
||||||
|
log "ERROR failed to install Fabric launcher from $FABRIC_LAUNCHER"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
# Custom fabric jar url
|
# Custom fabric jar url
|
||||||
elif [[ $FABRIC_LAUNCHER_URL ]]; then
|
elif [[ $FABRIC_LAUNCHER_URL ]]; then
|
||||||
export SERVER=fabric-server-$(echo -n "$FABRIC_LAUNCHER_URL" | mc-image-helper hash)
|
if ! mc-image-helper install-fabric-loader \
|
||||||
|
--results-file=${resultsFile} \
|
||||||
|
--from-url="$FABRIC_LAUNCHER_URL"; then
|
||||||
|
log "ERROR failed to install Fabric launcher from $FABRIC_LAUNCHER_URL"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
# Official fabric launcher
|
# Official fabric launcher
|
||||||
else
|
else
|
||||||
if [[ ${FABRIC_LAUNCHER_VERSION^^} = LATEST ]]; then
|
if ! mc-image-helper install-fabric-loader \
|
||||||
log "Checking Fabric Launcher version information."
|
--results-file=${resultsFile} \
|
||||||
FABRIC_LAUNCHER_VERSION=$(maven-metadata-release https://maven.fabricmc.net/net/fabricmc/fabric-installer/maven-metadata.xml)
|
--minecraft-version="${VANILLA_VERSION}" \
|
||||||
fi
|
--installer-version="${FABRIC_LAUNCHER_VERSION}" \
|
||||||
if [[ ${FABRIC_LOADER_VERSION^^} = LATEST ]]; then
|
--loader-version="${FABRIC_LOADER_VERSION}"; then
|
||||||
log "Checking Fabric Loader version information."
|
log "ERROR failed to install Fabric launcher from $VANILLA_VERSION, $FABRIC_LAUNCHER_VERSION, $FABRIC_LOADER_VERSION"
|
||||||
FABRIC_LOADER_VERSION=$(maven-metadata-release https://maven.fabricmc.net/net/fabricmc/fabric-loader/maven-metadata.xml)
|
exit 1
|
||||||
fi
|
|
||||||
export SERVER=fabric-server-mc.${VANILLA_VERSION}-loader.${FABRIC_LOADER_VERSION}-launcher.${FABRIC_LAUNCHER_VERSION}.jar
|
|
||||||
export FABRIC_LAUNCHER_URL="https://meta.fabricmc.net/v2/versions/loader/${VANILLA_VERSION}/${FABRIC_LOADER_VERSION}/${FABRIC_LAUNCHER_VERSION}/server/jar"
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [[ ! -e ${SERVER} && ! -z ${FABRIC_LAUNCHER_URL} ]]; then
|
|
||||||
log "Downloading $FABRIC_LAUNCHER_URL ..."
|
|
||||||
if ! get -o "$SERVER" "$FABRIC_LAUNCHER_URL"; then
|
|
||||||
log "Failed to download from given location $FABRIC_LAUNCHER_URL"
|
|
||||||
exit 2
|
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ ! -e ${SERVER} ]]; then
|
# grab SERVER and export it
|
||||||
log "$SERVER does not exist, cannot launch server!"
|
set -a
|
||||||
exit 1
|
# shellcheck disable=SC1090
|
||||||
fi
|
source "${resultsFile}"
|
||||||
|
set +a
|
||||||
|
|
||||||
export FAMILY=FABRIC
|
export FAMILY=FABRIC
|
||||||
exec "${SCRIPTS:-/}start-setupWorld" "$@"
|
exec "${SCRIPTS:-/}start-setupWorld" "$@"
|
||||||
Reference in new issue
Block a user