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

Last change on this file since 62 was 53, checked in by alloc, 10 years ago

Version 15: Fixes #16, adds --force to updatescripts

File size: 2.6 KB
Line 
1#!/bin/bash
2
3# Downloads SteamCMD, downloads/updates the 7dtd engine
4
5sdtdCommandUpdateengine() {
6 local FORCED=no
7 local CHECKONLY=no
8 if [ "$1" = "--force" ]; then
9 FORCED=yes
10 fi
11
12 if [ ! -e $SDTD_BASE/steamcmd ]; then
13 mkdir $SDTD_BASE/steamcmd
14 cd /tmp
15 wget http://media.steampowered.com/installer/steamcmd_linux.tar.gz
16 tar -xvzf steamcmd_linux.tar.gz -C $SDTD_BASE/steamcmd
17 cd $SDTD_BASE/steamcmd
18 ./steamcmd.sh +quit
19 fi
20
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
33
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
41
42 local LOCAL=$(getLocalEngineVersion)
43 local REMOTE=$(getRemoteEngineVersion)
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 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
69 ./steamcmd.sh +@sSteamCmdForcePlatformType windows +login $STEAM_USER $STEAM_PASS +force_install_dir $SDTD_BASE/engine "+app_update 251570" validate +quit
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
78}
79
80sdtdCommandUpdateengineHelp() {
81 echo "Usage: $(basename $0) updateengine [--force | --check]"
82 echo
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."
91}
92
93sdtdCommandUpdateengineDescription() {
94 echo "Update the 7dtd engine files"
95}
96
97sdtdCommandUpdateengineExpects() {
98 case $1 in
99 2)
100 echo "--force --check"
101 ;;
102 esac
103}
104
Note: See TracBrowser for help on using the repository browser.