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

Last change on this file since 285 was 265, checked in by alloc, 9 years ago

v100

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