source: scripts/usr/local/lib/7dtd/commands/updatescripts.sh@ 48

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

Scripts: added about, updatescripts; Bootstrapper: added version

File size: 2.0 KB
Line 
1#!/bin/bash
2
3# Checks for newer scripts version and downloads them
4
5sdtdCommandUpdatescripts() {
6 LOCAL=$(cat /usr/local/lib/7dtd/VERSION | grep "Version" | cut -d\ -f2)
7 REMOTE=$(wget -qO- http://illy.bz/fi/7dtd/VERSION | grep "Version" | cut -d\ -f2)
8
9 if [ $CURRENT -gt $LOCAL ]; then
10 echo "A newer version of the scripts is available."
11 echo "Local: v.$LOCAL"
12 echo "Available: v.$REMOTE"
13 echo
14 echo "Please check the release notes before continuing:"
15 echo " https://7dtd.illy.bz/wiki/Release%20Notes"
16 echo
17
18 while : ; do
19 local CONTINUE
20 read -p "Continue? (yn) " CONTINUE
21 case $CONTINUE in
22 y)
23 echo "Updating..."
24 break
25 ;;
26 n)
27 echo "Canceled"
28 return
29 ;;
30 *)
31 echo "Wrong input"
32 esac
33 done
34
35 wget -nv http://illy.bz/fi/7dtd/management_scripts.tar.gz -O /tmp/management_scripts.tar.gz
36 rm -Rf /usr/local/lib/7dtd /usr/local/bin/7dtd.sh
37 tar --touch --exclude=etc/7dtd.conf --exclude=etc/cron.d --exclude=home -xzf /tmp/management_scripts.tar.gz -C /
38
39 chown root.root /etc/init.d/7dtd.sh
40 chown root.root /etc/bash_completion.d/7dtd
41 chown root.root /usr/local/bin/7dtd.sh
42 chown root.root /usr/local/lib/7dtd -R
43 chmod 0755 /etc/init.d/7dtd.sh
44 chmod 0755 /etc/bash_completion.d/7dtd
45 chmod 0755 /usr/local/bin/7dtd.sh
46 chmod 0755 /usr/local/lib/7dtd -R
47
48 echo "Update done."
49 echo
50 echo "Note: This updated only script files. If the global config file"
51 echo "/etc/7dtd.conf contains changes for the newer version or there"
52 echo "were new files added to the user folder /home/sdtd those changes"
53 echo "have not been applied!"
54 else
55 echo "Scripts are already at the newest version (v.$LOCAL)."
56 fi
57}
58
59sdtdCommandUpdatescriptsHelp() {
60 echo "Usage: $(basename $0) updatescripts"
61 echo
62 echo "Check for a newer version of the management scripts. If there is a newer"
63 echo "version they can be updated by this command."
64}
65
66sdtdCommandUpdatescriptsDescription() {
67 echo "Update these scripts"
68}
69
Note: See TracBrowser for help on using the repository browser.