mirror of
https://github.com/itzg/docker-minecraft-server.git
synced 2026-02-27 03:16:23 +00:00
Added support for Modrinth modpacks as a server type (#2128)
This commit is contained in:
@@ -208,6 +208,10 @@ case "${TYPE^^}" in
|
||||
exec "${SCRIPTS:-/}start-deployAutoCF" "$@"
|
||||
;;
|
||||
|
||||
MODRINTH)
|
||||
exec "${SCRIPTS:-/}start-deployModrinth" "$@"
|
||||
;;
|
||||
|
||||
VANILLA)
|
||||
exec "${SCRIPTS:-/}start-deployVanilla" "$@"
|
||||
;;
|
||||
|
||||
50
scripts/start-deployModrinth
Normal file
50
scripts/start-deployModrinth
Normal file
@@ -0,0 +1,50 @@
|
||||
#!/bin/bash
|
||||
set -eu
|
||||
|
||||
# shellcheck source=start-utils
|
||||
. "${SCRIPTS:-/}start-utils"
|
||||
|
||||
resultsFile=/data/.install-modrinth.env
|
||||
|
||||
requireVar MODRINTH_PROJECT
|
||||
: "${MODRINTH_MC_VERSION:=}"
|
||||
: "${MODRINTH_LOADER:=}"
|
||||
: "${MODRINTH_VERSION_ID:=}"
|
||||
: "${MODRINTH_DEFAULT_VERSION_TYPE:=release}"
|
||||
|
||||
isDebugging && set -x
|
||||
|
||||
args=(
|
||||
--results-file="$resultsFile"
|
||||
--project="${MODRINTH_PROJECT}"
|
||||
--output-directory=/data
|
||||
)
|
||||
|
||||
setArg() {
|
||||
arg="${1?}"
|
||||
var="${2?}"
|
||||
|
||||
if [[ ${!var} ]]; then
|
||||
args+=("${arg}=${!var}")
|
||||
fi
|
||||
}
|
||||
setArg --game-version MODRINTH_MC_VERSION
|
||||
setArg --loader MODRINTH_LOADER
|
||||
setArg --version-id MODRINTH_VERSION_ID
|
||||
setArg --default-version-type MODRINTH_DEFAULT_VERSION_TYPE
|
||||
|
||||
if ! mc-image-helper install-modrinth-modpack "${args[@]}"; then
|
||||
log "ERROR failed to install Modrinth modpack"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# grab SERVER, FAMILY and export it
|
||||
set -a
|
||||
# shellcheck disable=SC1090
|
||||
source "${resultsFile}"
|
||||
set +a
|
||||
# grab the version resolved from modpack
|
||||
VANILLA_VERSION="$VERSION"
|
||||
export VANILLA_VERSION
|
||||
|
||||
exec "${SCRIPTS:-/}start-setupWorld" "$@"
|
||||
Reference in New Issue
Block a user