Subversion Repositories ALCASAR

Rev

Go to most recent revision | Details | 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`
21
#compare major number
22
if [ $MAJ_RUNNING_VERSION -lt $MAJ_DNS_VERSION ]
23
then
24
	MAJ="True"
25
fi
26
#compare minor number
27
if [ $MAJ_RUNNING_VERSION -eq $MAJ_DNS_VERSION ] 
28
then
29
	if [ $MIN_RUNNING_VERSION -lt $MIN_DNS_VERSION ]
30
	then
31
		MAJ="True"
32
	fi
33
#compare update number
34
	if [ $MIN_DNS_VERSION -eq $MIN_RUNNING_VERSION ]
35
	then
36
		if [ -n "$UPD_DNS_VERSION" ]
37
		then
38
			if [ -z "$UPD_RUNNING_VERSION" ]
39
			then
40
				MAJ="True"
41
			else
42
		       		if [ $UPD_RUNNING_VERSION -lt $UPD_DNS_VERSION ]
43
				then
44
					MAJ="True"
45
				fi
46
			fi
47
		fi
48
	fi
49
fi
50
 
51
if [ $MAJ = "True" ]
52
	then 
53
		echo "An updated version is available ($DNS_VERSION)"
54
	else 
55
		echo "The Running version ($RUNNING_VERSION) is up to date"
56
fi