Changeset 478 for scripts/usr/local/lib/7dtd/commands
- Timestamp:
- Nov 13, 2023, 4:07:41 PM (14 months ago)
- Location:
- scripts/usr/local/lib/7dtd/commands
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
scripts/usr/local/lib/7dtd/commands/instances.sh
r308 r478 60 60 y|Y) 61 61 cp $SDTD_BASE/templates/config.xml $IPATH/config.xml 62 loadCurrentConfigValues "$INSTANCE"63 62 break 64 63 ;; … … 70 69 echo 71 70 fi 72 configEditAll configQueryValue73 echo74 configSetAutoParameters "$INSTANCE"75 echo76 echo "Saving"77 71 78 72 if [ ! -f $IPATH/config.xml ]; then 79 echo "<ServerSettings/>" >$IPATH/config.xml73 cp $SDTD_BASE/engine/serverconfig.xml $IPATH/config.xml 80 74 fi 81 saveCurrentConfigValues "$INSTANCE" 75 76 $EDITOR $IPATH/config.xml 77 configSetAutoParameters "$INSTANCE" 78 82 79 if [ -f "$SDTD_BASE/templates/admins.xml" ]; then 83 80 cp "$SDTD_BASE/templates/admins.xml" "$IPATH/" … … 94 91 95 92 if [ $(isRunning "$1") -eq 0 ]; then 96 INSTANCE=$197 lo adCurrentConfigValues "$1"93 local INSTANCE=$1 94 local IPATH=$(getInstancePath "$INSTANCE") 98 95 99 while : ; do 100 echo "What section of the config do you want to edit?" 101 local i=0 102 local sects=() 103 for S in $(listConfigEditFuncs); do 104 (( i++ )) 105 sects[$i]=$S 106 printf " %2d: %s\n" $i "$S" 107 done 108 echo 109 echo " W: Save and exit" 110 echo " Q: Exit WITHOUT saving" 111 112 local SEC 113 while : ; do 114 read -p "Section number: " SEC 115 SEC=$(lowercase $SEC) 116 if [ $(isANumber $SEC) -eq 1 ]; then 117 if [ $SEC -ge 1 -a $SEC -le $i ]; then 118 break 119 fi 120 else 121 if [ "$SEC" = "q" -o "$SEC" = "w" ]; then 122 break 123 fi 124 fi 125 echo "Not a valid section number!" 126 done 127 echo 128 129 case "$SEC" in 130 q) 131 echo "Not saving" 132 break 133 ;; 134 w) 135 configSetAutoParameters "$INSTANCE" 136 echo "Saving" 137 saveCurrentConfigValues "$1" 138 echo "Done" 139 break 140 ;; 141 *) 142 configEdit${sects[$SEC]} configQueryValue 143 echo 144 esac 145 done 96 $EDITOR $IPATH/config.xml 146 97 else 147 98 echo "Instance $1 is currently running. Please stop it first." … … 184 135 fi 185 136 186 INSTANCE=$1 187 loadCurrentConfigValues "$1" 188 189 configEditAll printConfigValue 137 local INSTANCE=$1 138 local IPATH=$(getInstancePath "$INSTANCE") 139 cat $IPATH/config.xml 190 140 } 191 141 -
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.