Merge pull request #55 from klightspeed/dev#1.1#appupdate

Dev#1.1 app_info_update (issue #53)
This commit is contained in:
Fez Vrasta 2015-06-26 11:57:26 +02:00
commit b07c60cb7c

View File

@ -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(){ function parseSteamACF(){
cd "$arkserverroot"
if ! [ -f arkversion ];then
touch arkversion
fi
instver=`cat "arkversion"`
return $instver
}
#
# Parse the buildid from steamcmd
#
function parseSteamAppVer(){
local sname local sname
while read name val; do while read name val; do
name="${name#\"}" name="${name#\"}"
@ -109,9 +99,9 @@ function parseSteamAppVer(){
if [ "$name" = "}" ]; then if [ "$name" = "}" ]; then
break break
elif [ "$name" == "{" ]; then elif [ "$name" == "{" ]; then
parseSteamAppVer "${1}.${sname}" parseSteamACF "$1" "$2" "${3}.${sname}"
else else
if [ "$1" == ".depots.branches.public" -a "$name" == "buildid" ]; then if [ "$3" == "$1" -a "$name" == "$2" ]; then
echo "$val" echo "$val"
break break
fi fi
@ -120,11 +110,23 @@ function parseSteamAppVer(){
done 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 # Get the current available server version on steamdb
# #
function getAvailableVersion(){ 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_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 return $bnumber
} }