source: scripts/usr/local/lib/7dtd/commands/updatefixes.sh@ 256

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

Scripts

File size: 2.1 KB
RevLine 
[248]1#!/bin/bash
2
3# Checks for newer server fixes version and downloads them
4
5sdtdCommandUpdatefixes() {
6 if [ -d /usr/local/lib/7dtd/server-fixes ]; then
7 local LOCAL=$(cat /usr/local/lib/7dtd/server-fixes/Mods/Allocs_CommonFunc/7dtd-server-fixes_version.txt | grep -v "Combined")
8 else
9 local LOCAL="None"
10 fi
11 local REMOTE=$(wget -qO- http://illy.bz/fi/7dtd/7dtd-server-fixes_version.txt | grep -v "Combined")
12
13 local FORCED
14 if [ "$1" = "--force" ]; then
15 FORCED=yes
16 else
17 FORCED=no
18 fi
19 if [ "$FORCED" = "yes" -o "$REMOTE" != "$LOCAL" ]; then
20 echo "A newer version of the server fixes is available."
21 echo "Local:"
22 echo "$LOCAL"
23 echo
24 echo "Available:"
25 echo "$REMOTE"
26 echo
27 echo "Please check the release notes before continuing:"
28 echo " https://7dtd.illy.bz/wiki/Server%20fixes#ReleaseNotes"
29 echo
30
31 while : ; do
32 local CONTINUE
33 read -p "Continue? (yn) " CONTINUE
34 case $CONTINUE in
35 y)
36 echo "Updating..."
37 break
38 ;;
39 n)
40 echo "Canceled"
41 return
42 ;;
43 *)
44 echo "Wrong input"
45 esac
46 done
47
48 wget -q http://illy.bz/fi/7dtd/server_fixes.tar.gz -O /tmp/server_fixes.tar.gz
49 rm -Rf /usr/local/lib/7dtd/server-fixes
[255]50 mkdir /usr/local/lib/7dtd/server-fixes
[248]51 tar --touch --no-overwrite-dir -xzf /tmp/server_fixes.tar.gz -C /usr/local/lib/7dtd/server-fixes
52
53 if [ -d $SDTD_BASE/engine ]; then
54 if [ -d /usr/local/lib/7dtd/server-fixes ]; then
55 cp /usr/local/lib/7dtd/server-fixes/* $SDTD_BASE/engine/ -R
56 chown $SDTD_USER.$SDTD_GROUP -R $SDTD_BASE/engine/
57 fi
58 fi
59
60 echo "Update done."
61 else
62 echo "Server fixes are already at the latest version:"
63 echo "$LOCAL"
64 fi
65}
66
67sdtdCommandUpdatefixesHelp() {
68 echo "Usage: $(basename $0) updatefixes [--force]"
69 echo
70 echo "Check for a newer version of the server fixes. If there is a newer"
71 echo "version they can be installed/updated by this command."
72 echo
73 echo "If --force is specified you are asked if you want to redownload the fixes"
74 echo "even if there is no new version available."
75}
76
77sdtdCommandUpdatefixesDescription() {
78 echo "Install/Update the server fixes"
79}
80
81sdtdCommandUpdatefixesExpects() {
82 case $1 in
83 2)
84 echo "--force"
85 ;;
86 esac
87}
88
Note: See TracBrowser for help on using the repository browser.