Subversion Repositories ALCASAR

Rev

Go to most recent revision | Details | Last modification | View Log

Rev Author Line No. Line
672 richard 1
#!/bin/bash
826 franck 2
# $Id: alcasar-version.sh 1056 2013-03-26 21:46:36Z stephane $
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
 
510 richard 11
VERSION="/var/www/html/VERSION"
830 richard 12
SITE_VERSION="version.alcasar.net"
510 richard 13
MAJ="False"
14
DNS_VERSION_L=`dig $SITE_VERSION txt | grep ^$SITE_VERSION | cut -d"\"" -f2`
15
DNS_VERSION=`echo $DNS_VERSION_L|cut -d" " -f1`
16
MAJ_DNS_VERSION=`echo $DNS_VERSION|cut -d"." -f1`
17
MIN_DNS_VERSION=`echo $DNS_VERSION|cut -d"." -f2`
18
UPD_DNS_VERSION=`echo $DNS_VERSION|cut -d"." -f3`
19
RUNNING_VERSION=`cat $VERSION|cut -d" " -f1`
20
MAJ_RUNNING_VERSION=`echo $RUNNING_VERSION|cut -d"." -f1`
21
MIN_RUNNING_VERSION=`echo $RUNNING_VERSION|cut -d"." -f2|cut -c1`
22
UPD_RUNNING_VERSION=`echo $RUNNING_VERSION|cut -d"." -f3`
518 stephane 23
 
510 richard 24
#compare major number
25
if [ $MAJ_RUNNING_VERSION -lt $MAJ_DNS_VERSION ]
26
then
27
	MAJ="True"
28
fi
29
#compare minor number
30
if [ $MAJ_RUNNING_VERSION -eq $MAJ_DNS_VERSION ] 
31
then
32
	if [ $MIN_RUNNING_VERSION -lt $MIN_DNS_VERSION ]
33
	then
34
		MAJ="True"
35
	fi
36
#compare update number
37
	if [ $MIN_DNS_VERSION -eq $MIN_RUNNING_VERSION ]
38
	then
39
		if [ -n "$UPD_DNS_VERSION" ]
40
		then
41
			if [ -z "$UPD_RUNNING_VERSION" ]
42
			then
43
				MAJ="True"
44
			else
45
		       		if [ $UPD_RUNNING_VERSION -lt $UPD_DNS_VERSION ]
46
				then
47
					MAJ="True"
48
				fi
49
			fi
50
		fi
51
	fi
52
fi
53
 
54
if [ $MAJ = "True" ]
55
	then 
56
		echo "An updated version is available ($DNS_VERSION)"
57
	else 
58
		echo "The Running version ($RUNNING_VERSION) is up to date"
59
fi