From 85a957fe6fa2d5eeae4a7c3d321d30fa0bbba16c Mon Sep 17 00:00:00 2001 From: Geoff Bourne Date: Sun, 12 Nov 2023 16:10:03 -0600 Subject: [PATCH] Retain declared version for placeholder usage (#2486) --- docs/configuration/server-properties.md | 2 +- scripts/start-configuration | 3 ++- scripts/start-setupServerProperties | 4 ++-- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/docs/configuration/server-properties.md b/docs/configuration/server-properties.md index 8c1a240..2d08a10 100644 --- a/docs/configuration/server-properties.md +++ b/docs/configuration/server-properties.md @@ -22,7 +22,7 @@ The following options are available for placeholders: : The `FMT` string is processed by [Java's DateTimeFormatter](https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/time/format/DateTimeFormatter.html) and the current date/time is formatted. -Any declared or resolved environment variable may be referenced, such as `VERSION` and `TYPE`. Additionally, [Modrinth](../types-and-platforms/mod-platforms/modrinth-modpacks.md) and [Auto CurseForge](../types-and-platforms/mod-platforms/auto-curseforge.md) modpacks will expose the environment variables `MODPACK_NAME` and `MODPACK_VERSION`. +Any declared or resolved environment variable may be referenced, such as `VERSION` and `TYPE`. Additionally, [Modrinth](../types-and-platforms/mod-platforms/modrinth-modpacks.md) and [Auto CurseForge](../types-and-platforms/mod-platforms/auto-curseforge.md) modpacks will expose the environment variables `MODPACK_NAME` and `MODPACK_VERSION`. The originally declared version, such as "LATEST" or "SNAPSHOT", is available in the variable `DECLARED_VERSION` !!! example diff --git a/scripts/start-configuration b/scripts/start-configuration index d5da1ca..1ce3cef 100755 --- a/scripts/start-configuration +++ b/scripts/start-configuration @@ -113,7 +113,8 @@ fi cd /data || exit 1 -export ORIGINAL_TYPE=${TYPE^^} +export DECLARED_TYPE=${TYPE^^} +export DECLARED_VERSION="$VERSION" if isTrue "${ENABLE_AUTOPAUSE}"; then "${SCRIPTS:-/}start-autopause" diff --git a/scripts/start-setupServerProperties b/scripts/start-setupServerProperties index f81f8e5..aa3faf6 100755 --- a/scripts/start-setupServerProperties +++ b/scripts/start-setupServerProperties @@ -145,10 +145,10 @@ if ! isTrue "${SKIP_SERVER_PROPERTIES}"; then # which shows up in the server listing in the client if ! [ -v MOTD ]; then # snapshot is the odd case where we have to look at version to identify that label - if [[ ${ORIGINAL_TYPE} == "VANILLA" && ${VERSION} == "SNAPSHOT" ]]; then + if [[ ${DECLARED_TYPE} == "VANILLA" && ${VERSION} == "SNAPSHOT" ]]; then label=SNAPSHOT else - label=${ORIGINAL_TYPE} + label=${DECLARED_TYPE} fi # Convert label to title-case