Subversion Repositories ALCASAR

Rev

Rev 518 | Rev 672 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log

Rev Author Line No. Line
510 richard 1
#!/bin/sh
2
# $Id: alcasar-version-list.sh 393 2011-01-02 10:00:53Z franck $
3
 
4
# alcasar-version-list.sh
5
# by Rexy
6
# This script is distributed under the Gnu General Public License (GPL)
7
 
8
# permet de connaitre la version d'ALCASAR en production/stable pour permettre une éventuelle MAJ
9
VERSION="/var/www/html/VERSION"
10
SITE_VERSION="version.alcasar.info"
11
MAJ="False"
12
DNS_VERSION_L=`dig $SITE_VERSION txt | grep ^$SITE_VERSION | cut -d"\"" -f2`
13
DNS_VERSION=`echo $DNS_VERSION_L|cut -d" " -f1`
14
MAJ_DNS_VERSION=`echo $DNS_VERSION|cut -d"." -f1`
15
MIN_DNS_VERSION=`echo $DNS_VERSION|cut -d"." -f2`
16
UPD_DNS_VERSION=`echo $DNS_VERSION|cut -d"." -f3`
17
RUNNING_VERSION=`cat $VERSION|cut -d" " -f1`
18
MAJ_RUNNING_VERSION=`echo $RUNNING_VERSION|cut -d"." -f1`
19
MIN_RUNNING_VERSION=`echo $RUNNING_VERSION|cut -d"." -f2|cut -c1`
20
UPD_RUNNING_VERSION=`echo $RUNNING_VERSION|cut -d"." -f3`
518 stephane 21
 
510 richard 22
#compare major number
23
if [ $MAJ_RUNNING_VERSION -lt $MAJ_DNS_VERSION ]
24
then
25
	MAJ="True"
26
fi
27
#compare minor number
28
if [ $MAJ_RUNNING_VERSION -eq $MAJ_DNS_VERSION ] 
29
then
30
	if [ $MIN_RUNNING_VERSION -lt $MIN_DNS_VERSION ]
31
	then
32
		MAJ="True"
33
	fi
34
#compare update number
35
	if [ $MIN_DNS_VERSION -eq $MIN_RUNNING_VERSION ]
36
	then
37
		if [ -n "$UPD_DNS_VERSION" ]
38
		then
39
			if [ -z "$UPD_RUNNING_VERSION" ]
40
			then
41
				MAJ="True"
42
			else
43
		       		if [ $UPD_RUNNING_VERSION -lt $UPD_DNS_VERSION ]
44
				then
45
					MAJ="True"
46
				fi
47
			fi
48
		fi
49
	fi
50
fi
51
 
52
if [ $MAJ = "True" ]
53
	then 
54
		echo "An updated version is available ($DNS_VERSION)"
55
	else 
56
		echo "The Running version ($RUNNING_VERSION) is up to date"
57
fi