2023-05-14 18:09:54 +00:00
|
|
|
#!/bin/bash
|
|
|
|
set -eu
|
|
|
|
|
|
|
|
# shellcheck source=start-utils
|
|
|
|
. "${SCRIPTS:-/}start-utils"
|
|
|
|
|
|
|
|
resultsFile=/data/.install-modrinth.env
|
|
|
|
|
2023-08-13 00:56:18 +00:00
|
|
|
: "${MODRINTH_MODPACK:=${MODRINTH_PROJECT:-}}"
|
2023-05-14 18:09:54 +00:00
|
|
|
: "${MODRINTH_LOADER:=}"
|
2023-05-15 23:23:43 +00:00
|
|
|
: "${MODRINTH_VERSION:=${MODRINTH_VERSION_ID:-}}"
|
2023-08-20 14:11:55 +00:00
|
|
|
: "${MODRINTH_IGNORE_MISSING_FILES:=}"
|
2023-12-05 05:01:26 +00:00
|
|
|
: "${MODRINTH_EXCLUDE_FILES:=}"
|
2023-05-14 18:09:54 +00:00
|
|
|
|
2023-08-13 00:56:18 +00:00
|
|
|
if [[ ! $MODRINTH_MODPACK ]]; then
|
|
|
|
log "ERROR: MODRINTH_MODPACK must be set when using TYPE/MOD_PLATFORM of MODRINTH"
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
2023-05-14 18:09:54 +00:00
|
|
|
isDebugging && set -x
|
|
|
|
|
|
|
|
args=(
|
|
|
|
--results-file="$resultsFile"
|
2023-08-13 00:56:18 +00:00
|
|
|
--project="${MODRINTH_MODPACK}"
|
2023-05-14 18:09:54 +00:00
|
|
|
--output-directory=/data
|
|
|
|
)
|
|
|
|
|
2023-08-20 14:11:55 +00:00
|
|
|
if [[ $MODRINTH_IGNORE_MISSING_FILES ]]; then
|
|
|
|
args+=(--ignore-missing-files "$MODRINTH_IGNORE_MISSING_FILES")
|
|
|
|
fi
|
|
|
|
|
2023-05-15 23:23:43 +00:00
|
|
|
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
|
|
|
|
|
2023-05-14 18:09:54 +00:00
|
|
|
setArg() {
|
|
|
|
arg="${1?}"
|
|
|
|
var="${2?}"
|
|
|
|
|
|
|
|
if [[ ${!var} ]]; then
|
|
|
|
args+=("${arg}=${!var}")
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
setArg --loader MODRINTH_LOADER
|
2023-05-15 23:23:43 +00:00
|
|
|
setArg --version MODRINTH_VERSION
|
2023-05-14 18:09:54 +00:00
|
|
|
setArg --default-version-type MODRINTH_DEFAULT_VERSION_TYPE
|
2023-12-03 20:13:40 +00:00
|
|
|
setArg --exclude-files MODRINTH_EXCLUDE_FILES
|
2023-05-14 18:09:54 +00:00
|
|
|
|
|
|
|
if ! mc-image-helper install-modrinth-modpack "${args[@]}"; then
|
|
|
|
log "ERROR failed to install Modrinth modpack"
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
2023-06-17 18:00:22 +00:00
|
|
|
# grab SERVER, TYPE, VERSION and export it
|
2023-05-14 18:09:54 +00:00
|
|
|
set -a
|
|
|
|
# shellcheck disable=SC1090
|
|
|
|
source "${resultsFile}"
|
|
|
|
set +a
|
2023-06-17 18:00:22 +00:00
|
|
|
resolveFamily
|
2023-05-14 18:09:54 +00:00
|
|
|
|
|
|
|
exec "${SCRIPTS:-/}start-setupWorld" "$@"
|