Skip to content

Commit

Permalink
No need to log "Downloading" even when download isn't needed (#150)
Browse files Browse the repository at this point in the history
  • Loading branch information
itzg authored Nov 22, 2023
1 parent 6888718 commit c404dcc
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 8 deletions.
13 changes: 13 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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).
Expand Down
20 changes: 12 additions & 8 deletions scripts/run-bungeecord.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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"
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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

Expand Down Expand Up @@ -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

0 comments on commit c404dcc

Please sign in to comment.