docker-minecraft-server/scripts/start-deployModrinth

64 lines
1.3 KiB
Text
Raw Normal View History

#!/bin/bash
set -eu
# shellcheck source=start-utils
. "${SCRIPTS:-/}start-utils"
resultsFile=/data/.install-modrinth.env
: "${MODRINTH_MODPACK:=${MODRINTH_PROJECT:-}}"
: "${MODRINTH_LOADER:=}"
: "${MODRINTH_VERSION:=${MODRINTH_VERSION_ID:-}}"
if [[ ! $MODRINTH_MODPACK ]]; then
log "ERROR: MODRINTH_MODPACK must be set when using TYPE/MOD_PLATFORM of MODRINTH"
exit 1
fi
isDebugging && set -x
args=(
--results-file="$resultsFile"
--project="${MODRINTH_MODPACK}"
--output-directory=/data
)
case "${VERSION^^}" in
LATEST)
: "${MODRINTH_DEFAULT_VERSION_TYPE:=release}"
;;
SNAPSHOT)
: "${MODRINTH_DEFAULT_VERSION_TYPE:=beta}"
;;
*)
: "${MODRINTH_DEFAULT_VERSION_TYPE:=release}"
args+=("--game-version=$VERSION")
;;
esac
setArg() {
arg="${1?}"
var="${2?}"
if [[ ${!var} ]]; then
args+=("${arg}=${!var}")
fi
}
setArg --loader MODRINTH_LOADER
setArg --version MODRINTH_VERSION
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, TYPE, VERSION and export it
set -a
# shellcheck disable=SC1090
source "${resultsFile}"
set +a
resolveFamily
exec "${SCRIPTS:-/}start-setupWorld" "$@"