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