[17] | 1 | #!/bin/bash
|
---|
| 2 |
|
---|
[258] | 3 | # Copyright 2016 Christian 'Alloc' Illy
|
---|
| 4 | #
|
---|
| 5 | # Licensed under the Apache License, Version 2.0 (the "License");
|
---|
| 6 | # you may not use this file except in compliance with the License.
|
---|
| 7 | # You may obtain a copy of the License at
|
---|
| 8 | #
|
---|
| 9 | # http://www.apache.org/licenses/LICENSE-2.0
|
---|
| 10 | #
|
---|
| 11 | # Unless required by applicable law or agreed to in writing, software
|
---|
| 12 | # distributed under the License is distributed on an "AS IS" BASIS,
|
---|
| 13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
---|
| 14 | # See the License for the specific language governing permissions and
|
---|
| 15 | # limitations under the License.
|
---|
| 16 |
|
---|
| 17 |
|
---|
[48] | 18 | # Downloads SteamCMD, downloads/updates the 7dtd engine
|
---|
[17] | 19 |
|
---|
| 20 | sdtdCommandUpdateengine() {
|
---|
[248] | 21 | # local FORCED=no
|
---|
| 22 | # if [ "$1" = "--force" ]; then
|
---|
| 23 | # FORCED=yes
|
---|
| 24 | # fi
|
---|
[17] | 25 |
|
---|
[28] | 26 | if [ ! -e $SDTD_BASE/steamcmd ]; then
|
---|
| 27 | mkdir $SDTD_BASE/steamcmd
|
---|
[17] | 28 | cd /tmp
|
---|
| 29 | wget http://media.steampowered.com/installer/steamcmd_linux.tar.gz
|
---|
[28] | 30 | tar -xvzf steamcmd_linux.tar.gz -C $SDTD_BASE/steamcmd
|
---|
| 31 | cd $SDTD_BASE/steamcmd
|
---|
[17] | 32 | ./steamcmd.sh +quit
|
---|
| 33 | fi
|
---|
| 34 |
|
---|
[248] | 35 | # if [ "$1" = "--check" -o "$2" = "--check" ]; then
|
---|
| 36 | # local LOCAL=$(getLocalEngineVersion)
|
---|
| 37 | # local REMOTE=$(getRemoteEngineVersion)
|
---|
| 38 | # if [ $REMOTE -gt $LOCAL ]; then
|
---|
| 39 | # echo "Newer engine version available."
|
---|
| 40 | # else
|
---|
| 41 | # echo "Engine up to date."
|
---|
| 42 | # fi
|
---|
| 43 | # echo "Local buildid: $LOCAL"
|
---|
| 44 | # echo "Available buildid: $REMOTE"
|
---|
| 45 | # return
|
---|
| 46 | # fi
|
---|
[17] | 47 |
|
---|
[53] | 48 | for I in $(getInstanceList); do
|
---|
| 49 | if [ $(isRunning $I) -eq 1 ]; then
|
---|
| 50 | echo "At least one instance is still running (\"$I\")."
|
---|
| 51 | echo "Before updating the engine please stop all instances!"
|
---|
| 52 | return
|
---|
| 53 | fi
|
---|
| 54 | done
|
---|
[17] | 55 |
|
---|
[53] | 56 | local LOCAL=$(getLocalEngineVersion)
|
---|
[229] | 57 | #local REMOTE=$(getRemoteEngineVersion)
|
---|
[248] | 58 | #local LOCAL_SUPPORTED_BUILD=$(cat /usr/local/lib/7dtd/VERSION | grep "DediBuild" | cut -d\ -f2)
|
---|
[35] | 59 |
|
---|
[229] | 60 | # if [ "$FORCED" = "yes" -o $REMOTE -gt $LOCAL ]; then
|
---|
| 61 | # echo "A newer version of the engine is available."
|
---|
[53] | 62 | echo "Local buildid: $LOCAL"
|
---|
[229] | 63 | #echo "Available buildid: $REMOTE"
|
---|
[53] | 64 | echo
|
---|
[87] | 65 |
|
---|
[229] | 66 | # if [ "$LOCAL_SUPPORTED_BUILD" != "$REMOTE" ]; then
|
---|
[248] | 67 | # echo "WARNING!!! The currently installed version of the scripts might not support the newer dedicated server build!"
|
---|
| 68 | # echo "If you continue you might not be able to start the server."
|
---|
[229] | 69 | # echo "Please wait for an updated release of the scripts or continue at your own risk."
|
---|
[248] | 70 | # echo
|
---|
[229] | 71 | # fi
|
---|
[87] | 72 |
|
---|
[53] | 73 | while : ; do
|
---|
| 74 | local CONTINUE
|
---|
| 75 | read -p "Continue? (yn) " CONTINUE
|
---|
| 76 | case $CONTINUE in
|
---|
| 77 | y)
|
---|
| 78 | echo "Updating..."
|
---|
| 79 | break
|
---|
| 80 | ;;
|
---|
| 81 | n)
|
---|
| 82 | echo "Canceled"
|
---|
| 83 | return
|
---|
| 84 | ;;
|
---|
| 85 | *)
|
---|
| 86 | echo "Wrong input"
|
---|
| 87 | esac
|
---|
| 88 | done
|
---|
[229] | 89 |
|
---|
[53] | 90 | cd $SDTD_BASE/steamcmd
|
---|
[257] | 91 | ./steamcmd.sh +login anonymous +force_install_dir $SDTD_BASE/engine +app_update 294420 validate +quit
|
---|
[53] | 92 |
|
---|
[248] | 93 | if [ -d /usr/local/lib/7dtd/server-fixes ]; then
|
---|
[257] | 94 | cp /usr/local/lib/7dtd/server-fixes/* $SDTD_BASE/engine/ -R
|
---|
[248] | 95 | fi
|
---|
[53] | 96 |
|
---|
| 97 | chown $SDTD_USER.$SDTD_GROUP -R $SDTD_BASE/engine
|
---|
[87] | 98 |
|
---|
[248] | 99 | # if [ "$LOCAL_SUPPORTED_BUILD" != "$REMOTE" ]; then
|
---|
| 100 | # echo
|
---|
| 101 | # echo "Also update the scripts as soon as there is a new release for this dedicated server build."
|
---|
| 102 | # echo
|
---|
| 103 | # fi
|
---|
[229] | 104 | # else
|
---|
| 105 | # echo "Engine is already at the newest build (local: $LOCAL, remote: $REMOTE)."
|
---|
| 106 | # fi
|
---|
[17] | 107 | }
|
---|
| 108 |
|
---|
| 109 | sdtdCommandUpdateengineHelp() {
|
---|
[229] | 110 | echo "Usage: $(basename $0) updateengine" # [--force | --check]"
|
---|
[17] | 111 | echo
|
---|
[53] | 112 | echo "Check for a newer version of engine (aka game) files of 7dtd. If there is a newer"
|
---|
[229] | 113 | echo "version they will be updated by this command."
|
---|
| 114 | # echo
|
---|
| 115 | # echo "If --force is specified you are asked if you want to redownload the engine"
|
---|
| 116 | # echo "even if there is no new version available."
|
---|
| 117 | # echo
|
---|
| 118 | # echo "If --check is specified it will only output the current local and remote build ids"
|
---|
| 119 | # echo "and if an update is available."
|
---|
[17] | 120 | }
|
---|
| 121 |
|
---|
| 122 | sdtdCommandUpdateengineDescription() {
|
---|
| 123 | echo "Update the 7dtd engine files"
|
---|
| 124 | }
|
---|
[53] | 125 |
|
---|
| 126 | sdtdCommandUpdateengineExpects() {
|
---|
[229] | 127 | # case $1 in
|
---|
| 128 | # 2)
|
---|
| 129 | # echo "--force --check"
|
---|
| 130 | # ;;
|
---|
| 131 | # esac
|
---|
[231] | 132 | echo
|
---|
[53] | 133 | }
|
---|
| 134 |
|
---|