From 721491975b37954b968adbb264923aad672deadc Mon Sep 17 00:00:00 2001 From: Ben Peddell Date: Fri, 26 Jun 2015 12:54:12 +1000 Subject: [PATCH 1/2] Get current version from appmanifest_${appid}.acf forceUpdate had a window of time between initiating the update and getting the current version where it could miss an update. Close that window by getting the installed version from the appmanifest file. --- tools/arkmanager | 38 ++++++++++++++++++++------------------ 1 file changed, 20 insertions(+), 18 deletions(-) diff --git a/tools/arkmanager b/tools/arkmanager index 2be3091..267a6d7 100755 --- a/tools/arkmanager +++ b/tools/arkmanager @@ -84,22 +84,12 @@ function isUpdateNeeded(){ } # -# Return the current version number +# Parse an ACF structure +# $1 is the desired path +# $2 is the desired property +# $3 is the current path # -function getCurrentVersion(){ - cd "$arkserverroot" - if ! [ -f arkversion ];then - touch arkversion - fi - instver=`cat "arkversion"` - return $instver - -} - -# -# Parse the buildid from steamcmd -# -function parseSteamAppVer(){ +function parseSteamACF(){ local sname while read name val; do name="${name#\"}" @@ -109,9 +99,9 @@ function parseSteamAppVer(){ if [ "$name" = "}" ]; then break elif [ "$name" == "{" ]; then - parseSteamAppVer "${1}.${sname}" + parseSteamACF "$1" "$2" "${3}.${sname}" else - if [ "$1" == ".depots.branches.public" -a "$name" == "buildid" ]; then + if [ "$3" == "$1" -a "$name" == "$2" ]; then echo "$val" break fi @@ -120,11 +110,23 @@ function parseSteamAppVer(){ done } +# +# Return the current version number +# +function getCurrentVersion(){ + if [ -f "${arkserverroot}/steamapps/appmanifest_${appid}.acf" ]; then + instver=`while read name val; do if [ "${name}" == "{" ]; then parseSteamACF "" "buildid"; break; fi; done <"${arkserverroot}/steamapps/appmanifest_${appid}.acf"` + else + instver="" + fi + return $instver +} + # # Get the current available server version on steamdb # function getAvailableVersion(){ - bnumber=`$steamcmdroot/$steamcmdexec +login anonymous +app_info_print "$appid" +quit | while read name val; do if [ "${name}" == "{" ]; then parseSteamAppVer; break; fi; done` + bnumber=`$steamcmdroot/$steamcmdexec +login anonymous +app_info_print "$appid" +quit | while read name val; do if [ "${name}" == "{" ]; then parseSteamACF ".depots.branches.public" "buildid"; break; fi; done` return $bnumber } From 6fb7f6a4e6004596ca483d2afd4a422e6cfb26bc Mon Sep 17 00:00:00 2001 From: Ben Peddell Date: Fri, 26 Jun 2015 16:34:30 +1000 Subject: [PATCH 2/2] Add app_info_update --- tools/arkmanager | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/arkmanager b/tools/arkmanager index 267a6d7..a62781c 100755 --- a/tools/arkmanager +++ b/tools/arkmanager @@ -126,7 +126,7 @@ function getCurrentVersion(){ # Get the current available server version on steamdb # function getAvailableVersion(){ - bnumber=`$steamcmdroot/$steamcmdexec +login anonymous +app_info_print "$appid" +quit | while read name val; do if [ "${name}" == "{" ]; then parseSteamACF ".depots.branches.public" "buildid"; break; fi; done` + bnumber=`$steamcmdroot/$steamcmdexec +login anonymous +app_info_update 1 +app_info_print "$appid" +quit | while read name val; do if [ "${name}" == "{" ]; then parseSteamACF ".depots.branches.public" "buildid"; break; fi; done` return $bnumber }