Changeset 478 for scripts/usr/local/lib/7dtd/commands/updateengine.sh
- Timestamp:
- Nov 13, 2023, 4:07:41 PM (12 months ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
scripts/usr/local/lib/7dtd/commands/updateengine.sh
r344 r478 76 76 if [ "$CHECKONLY" = "yes" ]; then 77 77 local LOCAL=$(getLocalEngineVersion) 78 local REMOTE=$(get BuildId $(getLocalBranch))79 local REMOTETIME=$(get BuildUpdateTime $(getLocalBranch))78 local REMOTE=$(getRemoteBuildId $(getLocalBranch)) 79 local REMOTETIME=$(getRemoteBuildUpdateTime $(getLocalBranch)) 80 80 81 81 echo "Installed:" … … 91 91 for I in $(getBranchNames); do 92 92 if [[ $I != test* ]] || [ "$SHOWINTERNAL" = "yes" ]; then 93 local BUILD=$(get BuildId $I)94 local CREATED=$(get BuildUpdateTime $I)93 local BUILD=$(getRemoteBuildId $I) 94 local CREATED=$(getRemoteBuildUpdateTime $I) 95 95 printf "%-*s | %*s | %2s\n" 22 "$I" 8 "$BUILD" "$CREATED" 96 96 fi … … 107 107 for I in $(getBranchNames); do 108 108 if [[ $I != test* ]] || [ "$SHOWINTERNAL" = "yes" ]; then 109 local BUILD=$(get BuildId $I)110 local CREATED=$(get BuildUpdateTime $I)109 local BUILD=$(getRemoteBuildId $I) 110 local CREATED=$(getRemoteBuildUpdateTime $I) 111 111 if [ $BUILD -gt $MAXREMOTE ]; then 112 112 MAXREMOTE=$BUILD … … 134 134 135 135 local LOCAL=$(getLocalEngineVersion) 136 local REMOTE=$(get BuildId $BRANCHNAME)136 local REMOTE=$(getRemoteBuildId $BRANCHNAME) 137 137 138 138 if [ "$FORCED" = "yes" -o $REMOTE -gt $LOCAL ]; then 139 139 echo "A newer version of the engine is available." 140 140 echo "Local build id: $LOCAL (installed on $(getLocalEngineUpdateTime))" 141 echo "Available build id: $REMOTE (from $(get BuildUpdateTime $BRANCHNAME))"141 echo "Available build id: $REMOTE (from $(getRemoteBuildUpdateTime $BRANCHNAME))" 142 142 echo 143 143 … … 222 222 fi 223 223 } 224 225 # Get the latest remote (on Steam) engine version numbers etc226 updateRemoteEngineInfo() {227 local DOCHECK=no228 if [ ! -e /tmp/7dtd-appinfo ]; then229 DOCHECK=yes230 else231 AGE=$((`date +%s` - `stat -L --format %Y /tmp/7dtd-appinfo`))232 if [ $AGE -gt 600 ]; then233 DOCHECK=yes234 fi235 fi236 if [ "$DOCHECK" = "yes" ]; then237 echo "Updating version information..."238 rm /root/Steam/appcache/appinfo.vdf239 cd $SDTD_BASE/steamcmd240 241 ./steamcmd.sh +login anonymous +app_info_request 294420 +app_info_update +app_info_update 1 +app_info_print 294420 +quit | grep -A 1000 \"294420\" 2>/dev/null > /tmp/7dtd-appinfo242 243 local BUILDID=$(grep -A 1000 \"branches\" /tmp/7dtd-appinfo | grep -A 1000 \"public\" | grep -B 10 \} --max-count=1 | grep \"buildid\" | cut -d\" -f4)244 245 if [ $(isANumber "$BUILDID") -eq 0 ]; then246 rm -f /tmp/7dtd-appinfo247 fi248 fi249 }250 251 # Get the latest build id (on Steam)252 # Params:253 # 1. Branch name254 # Returns:255 # "?" if data could not be retrieved256 # BuildId otherwise257 getBuildId() {258 local BUILDID=$(grep -A 1000 \"branches\" /tmp/7dtd-appinfo | grep -A 1000 \"$1\" | grep -B 10 \} --max-count=1 | grep \"buildid\" | cut -d\" -f4)259 260 if [ $(isANumber "$BUILDID") -eq 0 ]; then261 echo "?"262 else263 echo $BUILDID264 fi265 }266 267 # Get the update time of the latest build (on Steam)268 # Params:269 # 1. Branch name270 # Returns:271 # "?" if data could not be retrieved272 # Update timestamp otherwise273 getBuildUpdateTime() {274 local TIMESTAMP=$(grep -A 1000 \"branches\" /tmp/7dtd-appinfo | grep -A 1000 \"$1\" | grep -B 10 \} --max-count=1 | grep \"timeupdated\" | cut -d\" -f4)275 276 if [ $(isANumber "$TIMESTAMP") -eq 0 ]; then277 echo "?"278 else279 date --date="@${TIMESTAMP}" "+%Y-%m-%d %H:%M:%S"280 fi281 }282 283 # Get a list of available branch names, blank separated284 # Returns:285 # Blank separated list of branch names (can be empty if an error occured)286 getBranchNames() {287 grep -A 1000 \"branches\" /tmp/7dtd-appinfo | grep -E '^[[:space:]]*"[^"]+"[[:space:]]*$' | tail --lines=+2 | cut -d\" -f2288 }289
Note:
See TracChangeset
for help on using the changeset viewer.