Retain declared version for placeholder usage (#2486)

This commit is contained in:
Geoff Bourne 2023-11-12 16:10:03 -06:00 committed by GitHub
parent 37a5d50f70
commit 85a957fe6f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 5 additions and 4 deletions

View File

@ -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

View File

@ -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"

View File

@ -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