Subversion Repositories ALCASAR

Rev

Rev 1827 | Rev 2454 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log

Rev Author Line No. Line
672 richard 1
#!/bin/bash
826 franck 2
# $Id: alcasar-version.sh 2171 2017-04-21 17:39:13Z tom.houdayer $
510 richard 3
 
4
# alcasar-version-list.sh
672 richard 5
# by Richard REY
510 richard 6
# This script is distributed under the Gnu General Public License (GPL)
7
 
672 richard 8
# récupère les versions d'ALCASAR (stable et développement)
9
# download the ALCASAR versions (stable / dev)
10
 
830 richard 11
SITE_VERSION="version.alcasar.net"
510 richard 12
MAJ="False"
13
DNS_VERSION_L=`dig $SITE_VERSION txt | grep ^$SITE_VERSION | cut -d"\"" -f2`
14
DNS_VERSION=`echo $DNS_VERSION_L|cut -d" " -f1`
15
MAJ_DNS_VERSION=`echo $DNS_VERSION|cut -d"." -f1`
16
MIN_DNS_VERSION=`echo $DNS_VERSION|cut -d"." -f2`
17
UPD_DNS_VERSION=`echo $DNS_VERSION|cut -d"." -f3`
2171 tom.houday 18
RUNNING_VERSION=`grep ^VERSION /usr/local/etc/alcasar.conf|cut -d'=' -f2`
510 richard 19
MAJ_RUNNING_VERSION=`echo $RUNNING_VERSION|cut -d"." -f1`
20
MIN_RUNNING_VERSION=`echo $RUNNING_VERSION|cut -d"." -f2|cut -c1`
21
UPD_RUNNING_VERSION=`echo $RUNNING_VERSION|cut -d"." -f3`
518 stephane 22
 
510 richard 23
#compare major number
24
if [ $MAJ_RUNNING_VERSION -lt $MAJ_DNS_VERSION ]
25
then
26
	MAJ="True"
27
fi
28
#compare minor number
29
if [ $MAJ_RUNNING_VERSION -eq $MAJ_DNS_VERSION ] 
30
then
31
	if [ $MIN_RUNNING_VERSION -lt $MIN_DNS_VERSION ]
32
	then
33
		MAJ="True"
34
	fi
35
#compare update number
36
	if [ $MIN_DNS_VERSION -eq $MIN_RUNNING_VERSION ]
37
	then
38
		if [ -n "$UPD_DNS_VERSION" ]
39
		then
40
			if [ -z "$UPD_RUNNING_VERSION" ]
41
			then
42
				MAJ="True"
43
			else
44
		       		if [ $UPD_RUNNING_VERSION -lt $UPD_DNS_VERSION ]
45
				then
46
					MAJ="True"
47
				fi
48
			fi
49
		fi
50
	fi
51
fi
52
 
53
if [ $MAJ = "True" ]
54
	then 
55
		echo "An updated version is available ($DNS_VERSION)"
56
	else 
57
		echo "The Running version ($RUNNING_VERSION) is up to date"
58
fi