source: scripts/usr/local/lib/7dtd/commands/updateengine.sh@ 238

Last change on this file since 238 was 231, checked in by alloc, 10 years ago

Scripts 83

File size: 3.4 KB
RevLine 
[17]1#!/bin/bash
2
[48]3# Downloads SteamCMD, downloads/updates the 7dtd engine
[17]4
5sdtdCommandUpdateengine() {
[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)
[229]43 #local REMOTE=$(getRemoteEngineVersion)
[87]44 local LOCAL_SUPPORTED_BUILD=$(cat /usr/local/lib/7dtd/VERSION | grep "DediBuild" | cut -d\ -f2)
[35]45
[229]46# if [ "$FORCED" = "yes" -o $REMOTE -gt $LOCAL ]; then
47# echo "A newer version of the engine is available."
[53]48 echo "Local buildid: $LOCAL"
[229]49 #echo "Available buildid: $REMOTE"
[53]50 echo
[87]51
[229]52# if [ "$LOCAL_SUPPORTED_BUILD" != "$REMOTE" ]; then
53 echo "WARNING!!! The currently installed version of the scripts might not support the newer dedicated server build!"
[87]54 echo "If you continue you might not be able to start the server."
[229]55# echo "Please wait for an updated release of the scripts or continue at your own risk."
[87]56 echo
[229]57# fi
[87]58
[53]59 while : ; do
60 local CONTINUE
61 read -p "Continue? (yn) " CONTINUE
62 case $CONTINUE in
63 y)
64 echo "Updating..."
65 break
66 ;;
67 n)
68 echo "Canceled"
69 return
70 ;;
71 *)
72 echo "Wrong input"
73 esac
74 done
[229]75
76 if [ $STEAM_USER = "" ]; then
77 read -p "Steam username: " STEAM_USER
78 fi
[53]79
[229]80 if [ $STEAM_PASS = "" ]; then
81 read -s -p "Steam password: " STEAM_PASS
82 fi
83
[53]84 cd $SDTD_BASE/steamcmd
[225]85 ./steamcmd.sh +login $STEAM_USER $STEAM_PASS +force_install_dir $SDTD_BASE/engine +app_update 294420 validate +quit
[53]86
[102]87 cp $SDTD_BASE/engine/7DaysToDie_Data/Managed/Assembly-CSharp.dll $SDTD_BASE/engine/7DaysToDie_Data/Managed/Assembly-CSharp.dll_orig
[225]88 cp /usr/local/lib/7dtd/server-fixes/* $SDTD_BASE/engine/ -R
[53]89
90 chown $SDTD_USER.$SDTD_GROUP -R $SDTD_BASE/engine
[87]91
92 if [ "$LOCAL_SUPPORTED_BUILD" != "$REMOTE" ]; then
93 echo
94 echo "Also update the scripts as soon as there is a new release for this dedicated server build."
95 echo
96 fi
[229]97# else
98# echo "Engine is already at the newest build (local: $LOCAL, remote: $REMOTE)."
99# fi
[17]100}
101
102sdtdCommandUpdateengineHelp() {
[229]103 echo "Usage: $(basename $0) updateengine" # [--force | --check]"
[17]104 echo
[53]105 echo "Check for a newer version of engine (aka game) files of 7dtd. If there is a newer"
[229]106 echo "version they will be updated by this command."
107# echo
108# echo "If --force is specified you are asked if you want to redownload the engine"
109# echo "even if there is no new version available."
110# echo
111# echo "If --check is specified it will only output the current local and remote build ids"
112# echo "and if an update is available."
[17]113}
114
115sdtdCommandUpdateengineDescription() {
116 echo "Update the 7dtd engine files"
117}
[53]118
119sdtdCommandUpdateengineExpects() {
[229]120# case $1 in
121# 2)
122# echo "--force --check"
123# ;;
124# esac
[231]125 echo
[53]126}
127
Note: See TracBrowser for help on using the repository browser.