mirror of
https://github.com/eliasstepanik/ark-ac-server-tools.git
synced 2026-01-27 08:48:27 +00:00
Parse steamcmd output and extract buildid
buildid for public branch is under depots.branches.public.buildid The output from app_info_print is a line-oriented json-like structure which is easily parsed by bash.
This commit is contained in:
parent
9ba4655315
commit
b0936f2f13
@ -96,11 +96,35 @@ function getCurrentVersion(){
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#
|
||||||
|
# Parse the buildid from steamcmd
|
||||||
|
#
|
||||||
|
function parseSteamAppVer(){
|
||||||
|
local sname
|
||||||
|
while read name val; do
|
||||||
|
name="${name#\"}"
|
||||||
|
name="${name%\"}"
|
||||||
|
val="${val#\"}"
|
||||||
|
val="${val%\"}"
|
||||||
|
if [ "$name" = "}" ]; then
|
||||||
|
break
|
||||||
|
elif [ "$name" == "{" ]; then
|
||||||
|
parseSteamAppVer "${1}.${sname}"
|
||||||
|
else
|
||||||
|
if [ "$1" == ".depots.branches.public" -a "$name" == "buildid" ]; then
|
||||||
|
echo "$val"
|
||||||
|
break
|
||||||
|
fi
|
||||||
|
sname="${name}"
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
}
|
||||||
|
|
||||||
#
|
#
|
||||||
# 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 | grep -EA 5 "^\s+\"public\"$" | grep -E "^\s+\"buildid\"\s+" | tr '[:blank:]"' ' ' | tr -s ' ' | cut -f3 | sed 's/^ //' | cut -c9-14`
|
bnumber=`$steamcmdroot/$steamcmdexec +login anonymous +app_info_print "$appid" +quit | while read name val; do if [ "${name}" == "{" ]; then parseSteamAppVer; break; fi; done`
|
||||||
return $bnumber
|
return $bnumber
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user