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

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

Scripts: License

File size: 3.8 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 if [ ! -e $SDTD_BASE/steamcmd ]; then
27 mkdir $SDTD_BASE/steamcmd
28 cd /tmp
29 wget http://media.steampowered.com/installer/steamcmd_linux.tar.gz
30 tar -xvzf steamcmd_linux.tar.gz -C $SDTD_BASE/steamcmd
31 cd $SDTD_BASE/steamcmd
32 ./steamcmd.sh +quit
33 fi
34
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
47
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
55
56 local LOCAL=$(getLocalEngineVersion)
57 #local REMOTE=$(getRemoteEngineVersion)
58 #local LOCAL_SUPPORTED_BUILD=$(cat /usr/local/lib/7dtd/VERSION | grep "DediBuild" | cut -d\ -f2)
59
60# if [ "$FORCED" = "yes" -o $REMOTE -gt $LOCAL ]; then
61# echo "A newer version of the engine is available."
62 echo "Local buildid: $LOCAL"
63 #echo "Available buildid: $REMOTE"
64 echo
65
66# if [ "$LOCAL_SUPPORTED_BUILD" != "$REMOTE" ]; then
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."
69# echo "Please wait for an updated release of the scripts or continue at your own risk."
70# echo
71# fi
72
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
89
90 cd $SDTD_BASE/steamcmd
91 ./steamcmd.sh +login anonymous +force_install_dir $SDTD_BASE/engine +app_update 294420 validate +quit
92
93 if [ -d /usr/local/lib/7dtd/server-fixes ]; then
94 cp /usr/local/lib/7dtd/server-fixes/* $SDTD_BASE/engine/ -R
95 fi
96
97 chown $SDTD_USER.$SDTD_GROUP -R $SDTD_BASE/engine
98
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
104# else
105# echo "Engine is already at the newest build (local: $LOCAL, remote: $REMOTE)."
106# fi
107}
108
109sdtdCommandUpdateengineHelp() {
110 echo "Usage: $(basename $0) updateengine" # [--force | --check]"
111 echo
112 echo "Check for a newer version of engine (aka game) files of 7dtd. If there is a newer"
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."
120}
121
122sdtdCommandUpdateengineDescription() {
123 echo "Update the 7dtd engine files"
124}
125
126sdtdCommandUpdateengineExpects() {
127# case $1 in
128# 2)
129# echo "--force --check"
130# ;;
131# esac
132 echo
133}
134
Note: See TracBrowser for help on using the repository browser.