From 37e1b739a65b480096c8c8a549d27bd353028b7e Mon Sep 17 00:00:00 2001 From: "Carlos M. Martinez" Date: Thu, 1 Feb 2024 20:14:08 -0500 Subject: [PATCH 1/2] Make booleans case insensitive --- README.md | 5 ----- scripts/backup.sh | 4 ++-- scripts/init.sh | 2 +- scripts/start.sh | 12 ++++++------ scripts/update.sh | 2 +- 5 files changed, 10 insertions(+), 15 deletions(-) diff --git a/README.md b/README.md index 9e3dc048e..57db7cea2 100644 --- a/README.md +++ b/README.md @@ -188,11 +188,6 @@ It is highly recommended you set the following environment values before startin *** Required for docker stop to save and gracefully close the server -> [!IMPORTANT] -> Boolean values used in environment variables are case-sensitive because they are used in the shell script. -> -> They must be set using exactly `true` or `false` for the option to take effect. - ### Game Ports | Port | Info | diff --git a/scripts/backup.sh b/scripts/backup.sh index c659f0c50..805326234 100644 --- a/scripts/backup.sh +++ b/scripts/backup.sh @@ -1,6 +1,6 @@ #!/bin/bash -if [ "${RCON_ENABLED}" = true ]; then +if [ "${RCON_ENABLED,,}" = true ]; then rcon-cli -c /home/steam/server/rcon.yaml save fi @@ -17,7 +17,7 @@ fi echo "backup created at $FILE_PATH" -if [ "${DELETE_OLD_BACKUPS}" = true ]; then +if [ "${DELETE_OLD_BACKUPS,,}" = true ]; then if [ -z "${OLD_BACKUP_DAYS}" ]; then echo "Unable to deleted old backups, OLD_BACKUP_DAYS is empty." elif [[ "${OLD_BACKUP_DAYS}" =~ ^[0-9]+$ ]]; then diff --git a/scripts/init.sh b/scripts/init.sh index 8a216c23c..d4d99e4c0 100644 --- a/scripts/init.sh +++ b/scripts/init.sh @@ -13,7 +13,7 @@ mkdir -p /palworld/backups chown -R steam:steam /palworld /home/steam/ term_handler() { - if [ "${RCON_ENABLED}" = true ]; then + if [ "${RCON_ENABLED,,}" = true ]; then rcon-cli save rcon-cli "shutdown 1" else # Does not save diff --git a/scripts/start.sh b/scripts/start.sh index ab86d3b5f..0cda7710e 100644 --- a/scripts/start.sh +++ b/scripts/start.sh @@ -1,6 +1,6 @@ #!/bin/bash -if [ "${UPDATE_ON_BOOT}" = true ]; then +if [ "${UPDATE_ON_BOOT,,}" = true ]; then printf "\e[0;32m*****STARTING INSTALL/UPDATE*****\e[0m\n" /home/steam/steamcmd/steamcmd.sh +@sSteamCmdForcePlatformType linux +@sSteamCmdForcePlatformBitness 64 +force_install_dir "/palworld" +login anonymous +app_update 2394010 validate +quit fi @@ -15,11 +15,11 @@ if [ -n "${QUERY_PORT}" ]; then STARTCOMMAND+=("-queryport=${QUERY_PORT}") fi -if [ "${COMMUNITY}" = true ]; then +if [ "${COMMUNITY,,}" = true ]; then STARTCOMMAND+=("EpicApp=PalServer") fi -if [ "${MULTITHREADING}" = true ]; then +if [ "${MULTITHREADING,,}" = true ]; then STARTCOMMAND+=("-useperfthreads" "-NoAsyncLoadingThread" "-UseMultithreadForDS") fi @@ -301,18 +301,18 @@ if [ -n "${RCON_PORT}" ]; then fi rm -f "/home/steam/server/crontab" -if [ "${BACKUP_ENABLED}" = true ]; then +if [ "${BACKUP_ENABLED,,}" = true ]; then echo "BACKUP_ENABLED=${BACKUP_ENABLED}" echo "$BACKUP_CRON_EXPRESSION bash /usr/local/bin/backup" >> "/home/steam/server/crontab" fi -if [ "${AUTO_UPDATE_ENABLED}" = true ] && [ "${UPDATE_ON_BOOT}" = true ]; then +if [ "${AUTO_UPDATE_ENABLED,,}" = true ] && [ "${UPDATE_ON_BOOT}" = true ]; then echo "AUTO_UPDATE_ENABLED=${AUTO_UPDATE_ENABLED}" echo "$AUTO_UPDATE_CRON_EXPRESSION bash /usr/local/bin/update" >> "/home/steam/server/crontab" fi -if { [ "${AUTO_UPDATE_ENABLED}" = true ] && [ "${UPDATE_ON_BOOT}" = true ]; } || [ "${BACKUP_ENABLED}" = true ]; then +if { [ "${AUTO_UPDATE_ENABLED,,}" = true ] && [ "${UPDATE_ON_BOOT,,}" = true ]; } || [ "${BACKUP_ENABLED,,}" = true ]; then supercronic "/home/steam/server/crontab" & fi diff --git a/scripts/update.sh b/scripts/update.sh index c523c4c71..a20798c4c 100644 --- a/scripts/update.sh +++ b/scripts/update.sh @@ -24,7 +24,7 @@ fi if [ "$CURRENTBUILD" != "$TARGETBUILD" ]; then echo "New Build was found. Updating the server from $CURRENTBUILD to $TARGETBUILD." - if [ "${RCON_ENABLED}" = true ]; then + if [ "${RCON_ENABLED,,}" = true ]; then rm /palworld/steamapps/appmanifest_2394010.acf rcon-cli -c /home/steam/server/rcon.yaml "broadcast The_Server_will_update_in_${AUTO_UPDATE_WARN_MINUTES}_Minutes" sleep "${AUTO_UPDATE_WARN_MINUTES}m" From c9f039a3d85826bd32c9001fe6841599813ce72b Mon Sep 17 00:00:00 2001 From: Thijs van Loef Date: Fri, 2 Feb 2024 09:10:20 +0100 Subject: [PATCH 2/2] Change RCON to lowercase, change debug output to lowercase --- scripts/start.sh | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/scripts/start.sh b/scripts/start.sh index 0cda7710e..6addee023 100644 --- a/scripts/start.sh +++ b/scripts/start.sh @@ -291,8 +291,8 @@ if [ -n "${BAN_LIST_URL}" ]; then echo "BAN_LIST_URL=$BAN_LIST_URL" sed -E -i "s~BanListURL=\"[^\"]*\"~BanListURL=\"$BAN_LIST_URL\"~" /palworld/Pal/Saved/Config/LinuxServer/PalWorldSettings.ini fi -if [ -n "${RCON_ENABLED}" ]; then - echo "RCON_ENABLED=${RCON_ENABLED}" +if [ -n "${RCON_ENABLED,,}" ]; then + echo "RCON_ENABLED=${RCON_ENABLED,,}" sed -i "s/RCONEnabled=[a-zA-Z]*/RCONEnabled=$RCON_ENABLED/" /palworld/Pal/Saved/Config/LinuxServer/PalWorldSettings.ini fi if [ -n "${RCON_PORT}" ]; then @@ -302,13 +302,13 @@ fi rm -f "/home/steam/server/crontab" if [ "${BACKUP_ENABLED,,}" = true ]; then - echo "BACKUP_ENABLED=${BACKUP_ENABLED}" + echo "BACKUP_ENABLED=${BACKUP_ENABLED,,}" echo "$BACKUP_CRON_EXPRESSION bash /usr/local/bin/backup" >> "/home/steam/server/crontab" fi if [ "${AUTO_UPDATE_ENABLED,,}" = true ] && [ "${UPDATE_ON_BOOT}" = true ]; then - echo "AUTO_UPDATE_ENABLED=${AUTO_UPDATE_ENABLED}" + echo "AUTO_UPDATE_ENABLED=${AUTO_UPDATE_ENABLED,,}" echo "$AUTO_UPDATE_CRON_EXPRESSION bash /usr/local/bin/update" >> "/home/steam/server/crontab" fi