From da32e28a388abfa439e7aae2f97ab43532cb8727 Mon Sep 17 00:00:00 2001 From: luatan Date: Sun, 11 Feb 2024 02:09:23 +0100 Subject: [PATCH 1/2] change from builds to manifest --- scripts/update.sh | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/scripts/update.sh b/scripts/update.sh index 614597a74..68fa12a95 100644 --- a/scripts/update.sh +++ b/scripts/update.sh @@ -11,8 +11,8 @@ fi temp_file=$(mktemp) http_code=$(curl https://api.steamcmd.net/v1/info/2394010 --output "$temp_file" --silent --location --write-out "%{http_code}") -CURRENTBUILD=$(awk '/buildid/{ print $2 }' < /palworld/steamapps/appmanifest_2394010.acf) -TARGETBUILD=$(grep -P '"public": {"buildid": "\d+"' -o <"$temp_file" | sed -r 's/.*("[0-9]+")$/\1/') +CURRENT_MANIFEST=$(awk '/manifest/{count++} count==2 {print $2; exit}' /palworld/steamapps/appmanifest_2394010.acf) +TARGET_MANIFEST=$(grep -Po '"2394012".*"gid": "\d+"' <"$temp_file" | sed -r 's/.*("[0-9]+")$/\1/') rm "$temp_file" if [ "$http_code" -ne 200 ]; then @@ -23,7 +23,7 @@ if [ "$http_code" -ne 200 ]; then exit 1 fi -if [ -z "$TARGETBUILD" ]; then +if [ -z "$TARGET_MANIFEST" ]; then echo "The server response does not contain the expected BuildID. Unable to check for updates!" if [ -n "${DISCORD_WEBHOOK_URL}" ]; then /home/steam/server/discord.sh "Steam servers response does not contain the expected BuildID. Unable to check for updates!" "failure" & @@ -31,8 +31,8 @@ if [ -z "$TARGETBUILD" ]; then exit 1 fi -if [ "$CURRENTBUILD" != "$TARGETBUILD" ]; then - echo "New Build was found. Updating the server from $CURRENTBUILD to $TARGETBUILD." +if [ "$CURRENT_MANIFEST" != "$TARGET_MANIFEST" ]; then + echo "New Build was found. Updating the server from $CURRENT_MANIFEST to $TARGET_MANIFEST." if [ "${RCON_ENABLED,,}" = true ]; then rm /palworld/steamapps/appmanifest_2394010.acf if [ -n "${DISCORD_WEBHOOK_URL}" ]; then From 87bd16e3702389a761895c252c7f05b781ab06f9 Mon Sep 17 00:00:00 2001 From: luatan Date: Sun, 11 Feb 2024 15:01:12 +0100 Subject: [PATCH 2/2] fix merge --- scripts/update.sh | 13 ++----------- 1 file changed, 2 insertions(+), 11 deletions(-) diff --git a/scripts/update.sh b/scripts/update.sh index 5203c1d37..f9b6528ce 100644 --- a/scripts/update.sh +++ b/scripts/update.sh @@ -32,18 +32,9 @@ if [ -z "$TARGET_MANIFEST" ]; then fi exit 1 fi - +echo "player count: $(get_player_count)" if [ "$CURRENT_MANIFEST" != "$TARGET_MANIFEST" ]; then - if [ "${RCON_ENABLED,,}" = true ]; then - rm /palworld/steamapps/appmanifest_2394010.acf - if [ -n "${DISCORD_WEBHOOK_URL}" ]; then - /home/steam/server/discord.sh "Server will update in ${AUTO_UPDATE_WARN_MINUTES} minutes" "info" & - fi - 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" - backup - rcon-cli -c /home/steam/server/rcon.yaml "shutdown 1" - else + if [ "${RCON_ENABLED,,}" != true ]; then echo "An update is available however auto updating without rcon is not supported" if [ -n "${DISCORD_WEBHOOK_URL}" ]; then /home/steam/server/discord.sh "An update is available however auto updating without rcon is not supported" "warn"