Ignore:
Timestamp:
Nov 13, 2023, 4:07:41 PM (12 months ago)
Author:
alloc
Message:

Scripts updates

File:
1 edited

Legend:

Unmodified
Added
Removed
  • scripts/usr/local/lib/7dtd/commands/updateengine.sh

    r344 r478  
    7676        if [ "$CHECKONLY" = "yes" ]; then
    7777                local LOCAL=$(getLocalEngineVersion)
    78                 local REMOTE=$(getBuildId $(getLocalBranch))
    79                 local REMOTETIME=$(getBuildUpdateTime $(getLocalBranch))
     78                local REMOTE=$(getRemoteBuildId $(getLocalBranch))
     79                local REMOTETIME=$(getRemoteBuildUpdateTime $(getLocalBranch))
    8080               
    8181                echo "Installed:"
     
    9191                for I in $(getBranchNames); do
    9292                        if [[ $I != test* ]] || [ "$SHOWINTERNAL" = "yes" ]; then
    93                                 local BUILD=$(getBuildId $I)
    94                                 local CREATED=$(getBuildUpdateTime $I)
     93                                local BUILD=$(getRemoteBuildId $I)
     94                                local CREATED=$(getRemoteBuildUpdateTime $I)
    9595                                printf "%-*s | %*s | %2s\n" 22 "$I" 8 "$BUILD" "$CREATED"
    9696                        fi
     
    107107                        for I in $(getBranchNames); do
    108108                                if [[ $I != test* ]] || [ "$SHOWINTERNAL" = "yes" ]; then
    109                                         local BUILD=$(getBuildId $I)
    110                                         local CREATED=$(getBuildUpdateTime $I)
     109                                        local BUILD=$(getRemoteBuildId $I)
     110                                        local CREATED=$(getRemoteBuildUpdateTime $I)
    111111                                        if [ $BUILD -gt $MAXREMOTE ]; then
    112112                                                MAXREMOTE=$BUILD
     
    134134
    135135        local LOCAL=$(getLocalEngineVersion)
    136         local REMOTE=$(getBuildId $BRANCHNAME)
     136        local REMOTE=$(getRemoteBuildId $BRANCHNAME)
    137137
    138138        if [ "$FORCED" = "yes" -o $REMOTE -gt $LOCAL ]; then
    139139                echo "A newer version of the engine is available."
    140140                echo "Local build id:     $LOCAL (installed on $(getLocalEngineUpdateTime))"
    141                 echo "Available build id: $REMOTE (from $(getBuildUpdateTime $BRANCHNAME))"
     141                echo "Available build id: $REMOTE (from $(getRemoteBuildUpdateTime $BRANCHNAME))"
    142142                echo
    143143
     
    222222        fi
    223223}
    224 
    225 # Get the latest remote (on Steam) engine version numbers etc
    226 updateRemoteEngineInfo() {
    227         local DOCHECK=no
    228         if [ ! -e /tmp/7dtd-appinfo ]; then
    229                 DOCHECK=yes
    230         else
    231                 AGE=$((`date +%s` - `stat -L --format %Y /tmp/7dtd-appinfo`))
    232                 if [ $AGE -gt 600 ]; then
    233                         DOCHECK=yes
    234                 fi
    235         fi
    236         if [ "$DOCHECK" = "yes" ]; then
    237                 echo "Updating version information..."
    238                 rm /root/Steam/appcache/appinfo.vdf
    239                 cd $SDTD_BASE/steamcmd
    240 
    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-appinfo
    242        
    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 ]; then
    246                         rm -f /tmp/7dtd-appinfo
    247                 fi
    248         fi
    249 }
    250 
    251 # Get the latest build id (on Steam)
    252 # Params:
    253 #   1. Branch name
    254 # Returns:
    255 #   "?" if data could not be retrieved
    256 #   BuildId otherwise
    257 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 ]; then
    261                 echo "?"
    262         else
    263                 echo $BUILDID
    264         fi
    265 }
    266 
    267 # Get the update time of the latest build (on Steam)
    268 # Params:
    269 #   1. Branch name
    270 # Returns:
    271 #   "?" if data could not be retrieved
    272 #   Update timestamp otherwise
    273 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 ]; then
    277                 echo "?"
    278         else
    279                 date --date="@${TIMESTAMP}" "+%Y-%m-%d %H:%M:%S"
    280         fi
    281 }
    282 
    283 # Get a list of available branch names, blank separated
    284 # 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\" -f2
    288 }
    289 
Note: See TracChangeset for help on using the changeset viewer.