From c404dcc99e3201c00aed447f96221fb8ad4bef15 Mon Sep 17 00:00:00 2001 From: Geoff Bourne Date: Wed, 22 Nov 2023 08:52:14 -0600 Subject: [PATCH] No need to log "Downloading" even when download isn't needed (#150) --- README.md | 13 +++++++++++++ scripts/run-bungeecord.sh | 20 ++++++++++++-------- 2 files changed, 25 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index cc204c1..1b99ce9 100644 --- a/README.md +++ b/README.md @@ -95,6 +95,19 @@ healthy === ``` +* **MODRINTH_PROJECTS** + + Comma or newline separated list of project slugs (short name) or IDs. The project ID is located in the "Technical information" section. The slug is the part of the page URL that follows `/mod/`: + ``` + https://modrinth.com/mod/fabric-api + ---------- + | + +-- project slug + ``` + Also, a specific version/type can be declared using colon symbol and version id/type after the project slug. The version id can be found in the 'Metadata' section. Valid version types are `release`, `beta`, `alpha`. + + **NOTE** The variable `MINECRAFT_VERSION` must be set to the corresponding Minecraft version. + * **ENABLE_RCON** Enable the rcon server (uses a third-party plugin to work). diff --git a/scripts/run-bungeecord.sh b/scripts/run-bungeecord.sh index fd8d1b6..d04f54f 100644 --- a/scripts/run-bungeecord.sh +++ b/scripts/run-bungeecord.sh @@ -19,7 +19,7 @@ : "${REPLACE_ENV_VARIABLES_EXCLUDES:=}" : "${REPLACE_ENV_VARIABLES_EXCLUDE_PATHS:=}" : "${MODRINTH_PROJECTS:=}" -: "${MODRINTH_DOWNLOAD_OPTIONAL_DEPENDENCIES:=true}" +: "${MODRINTH_DOWNLOAD_DEPENDENCIES:=required}" : "${MODRINTH_ALLOWED_VERSION_TYPE:=release}" BUNGEE_HOME=/server @@ -159,10 +159,10 @@ function getResourceFromSpiget() { exit 2 fi - mkdir -p ${dest} + mkdir -p "${dest}" if containsJars "${tmpfile}"; then log "Extracting contents of resource ${resource} into plugins" - unzip -o -q -d ${dest} "${tmpfile}" + unzip -o -q -d "${dest}" "${tmpfile}" rm "${tmpfile}" else log "Moving resource ${resource} into plugins" @@ -308,7 +308,6 @@ case "${TYPE^^}" in esac if isTrue "$download_required"; then - log "Downloading ${BUNGEE_JAR_URL}" if ! get -o "$BUNGEE_JAR" --skip-up-to-date --log-progress-each "$BUNGEE_JAR_URL"; then echo "ERROR: failed to download" >&2 exit 2 @@ -382,12 +381,17 @@ if [[ ${SPIGET_PLUGINS} ]]; then fi if [[ $MODRINTH_PROJECTS ]]; then + if ! [[ -v MINECRAFT_VERSION ]]; then + log "ERROR: plugins via MODRINTH_PROJECTS require MINECRAFT_VERSION to be set to corresponding Minecraft game version" + exit 1 + fi + mc-image-helper modrinth \ --output-directory=/data \ --projects="${MODRINTH_PROJECTS}" \ - --game-version="${VERSION}" \ + --game-version="${MINECRAFT_VERSION}" \ --loader="${family}" \ - --download-optional-dependencies="${MODRINTH_DOWNLOAD_OPTIONAL_DEPENDENCIES}" \ + --download-dependencies="${MODRINTH_DOWNLOAD_DEPENDENCIES}" \ --allowed-version-type="${MODRINTH_ALLOWED_VERSION_TYPE}" fi @@ -464,7 +468,7 @@ if isTrue "${ENABLE_JMX}"; then fi if [ $UID == 0 ]; then - exec sudo -E -u bungeecord $JAVA_HOME/bin/java $JVM_XX_OPTS $JVM_OPTS -jar "$BUNGEE_JAR" "$@" + exec sudo -E -u bungeecord "$JAVA_HOME/bin/java" $JVM_XX_OPTS $JVM_OPTS -jar "$BUNGEE_JAR" "$@" else - exec $JAVA_HOME/bin/java $JVM_XX_OPTS $JVM_OPTS -jar "$BUNGEE_JAR" "$@" + exec "$JAVA_HOME/bin/java" $JVM_XX_OPTS $JVM_OPTS -jar "$BUNGEE_JAR" "$@" fi