[17] | 1 | #!/bin/bash
|
---|
| 2 |
|
---|
[48] | 3 | # Downloads SteamCMD, downloads/updates the 7dtd engine
|
---|
[17] | 4 |
|
---|
| 5 | sdtdCommandUpdateengine() {
|
---|
[53] | 6 | local FORCED=no
|
---|
| 7 | local CHECKONLY=no
|
---|
| 8 | if [ "$1" = "--force" ]; then
|
---|
| 9 | FORCED=yes
|
---|
| 10 | fi
|
---|
[17] | 11 |
|
---|
[28] | 12 | if [ ! -e $SDTD_BASE/steamcmd ]; then
|
---|
| 13 | mkdir $SDTD_BASE/steamcmd
|
---|
[17] | 14 | cd /tmp
|
---|
| 15 | wget http://media.steampowered.com/installer/steamcmd_linux.tar.gz
|
---|
[28] | 16 | tar -xvzf steamcmd_linux.tar.gz -C $SDTD_BASE/steamcmd
|
---|
| 17 | cd $SDTD_BASE/steamcmd
|
---|
[17] | 18 | ./steamcmd.sh +quit
|
---|
| 19 | fi
|
---|
| 20 |
|
---|
[53] | 21 | if [ "$1" = "--check" -o "$2" = "--check" ]; then
|
---|
| 22 | local LOCAL=$(getLocalEngineVersion)
|
---|
| 23 | local REMOTE=$(getRemoteEngineVersion)
|
---|
| 24 | if [ $REMOTE -gt $LOCAL ]; then
|
---|
| 25 | echo "Newer engine version available."
|
---|
| 26 | else
|
---|
| 27 | echo "Engine up to date."
|
---|
| 28 | fi
|
---|
| 29 | echo "Local buildid: $LOCAL"
|
---|
| 30 | echo "Available buildid: $REMOTE"
|
---|
| 31 | return
|
---|
| 32 | fi
|
---|
[17] | 33 |
|
---|
[53] | 34 | for I in $(getInstanceList); do
|
---|
| 35 | if [ $(isRunning $I) -eq 1 ]; then
|
---|
| 36 | echo "At least one instance is still running (\"$I\")."
|
---|
| 37 | echo "Before updating the engine please stop all instances!"
|
---|
| 38 | return
|
---|
| 39 | fi
|
---|
| 40 | done
|
---|
[17] | 41 |
|
---|
[53] | 42 | local LOCAL=$(getLocalEngineVersion)
|
---|
| 43 | local REMOTE=$(getRemoteEngineVersion)
|
---|
[35] | 44 |
|
---|
[53] | 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 | while : ; do
|
---|
| 52 | local CONTINUE
|
---|
| 53 | read -p "Continue? (yn) " CONTINUE
|
---|
| 54 | case $CONTINUE in
|
---|
| 55 | y)
|
---|
| 56 | echo "Updating..."
|
---|
| 57 | break
|
---|
| 58 | ;;
|
---|
| 59 | n)
|
---|
| 60 | echo "Canceled"
|
---|
| 61 | return
|
---|
| 62 | ;;
|
---|
| 63 | *)
|
---|
| 64 | echo "Wrong input"
|
---|
| 65 | esac
|
---|
| 66 | done
|
---|
| 67 |
|
---|
| 68 | cd $SDTD_BASE/steamcmd
|
---|
[80] | 69 | ./steamcmd.sh +@sSteamCmdForcePlatformType windows +login $STEAM_USER $STEAM_PASS +force_install_dir $SDTD_BASE/engine "+app_update 294420" validate +quit
|
---|
[53] | 70 |
|
---|
| 71 | cp $SDTD_BASE/linux_files/engine/* $SDTD_BASE/engine/ -R
|
---|
| 72 | cp $SDTD_BASE/engine/Install/32bit/SteamworksManaged.dll $SDTD_BASE/engine/7DaysToDie_Data/Managed/
|
---|
| 73 |
|
---|
| 74 | chown $SDTD_USER.$SDTD_GROUP -R $SDTD_BASE/engine
|
---|
| 75 | else
|
---|
| 76 | echo "Engine is already at the newest build (local: $LOCAL, remote: $REMOTE)."
|
---|
| 77 | fi
|
---|
[17] | 78 | }
|
---|
| 79 |
|
---|
| 80 | sdtdCommandUpdateengineHelp() {
|
---|
[53] | 81 | echo "Usage: $(basename $0) updateengine [--force | --check]"
|
---|
[17] | 82 | echo
|
---|
[53] | 83 | echo "Check for a newer version of engine (aka game) files of 7dtd. If there is a newer"
|
---|
| 84 | echo "version they can be updated by this command."
|
---|
| 85 | echo
|
---|
| 86 | echo "If --force is specified you are asked if you want to redownload the engine"
|
---|
| 87 | echo "even if there is no new version available."
|
---|
| 88 | echo
|
---|
| 89 | echo "If --check is specified it will only output the current local and remote build ids"
|
---|
| 90 | echo "and if an update is available."
|
---|
[17] | 91 | }
|
---|
| 92 |
|
---|
| 93 | sdtdCommandUpdateengineDescription() {
|
---|
| 94 | echo "Update the 7dtd engine files"
|
---|
| 95 | }
|
---|
[53] | 96 |
|
---|
| 97 | sdtdCommandUpdateengineExpects() {
|
---|
| 98 | case $1 in
|
---|
| 99 | 2)
|
---|
| 100 | echo "--force --check"
|
---|
| 101 | ;;
|
---|
| 102 | esac
|
---|
| 103 | }
|
---|
| 104 |
|
---|