-
Notifications
You must be signed in to change notification settings - Fork 23
/
check_version.sh
executable file
·42 lines (33 loc) · 1.3 KB
/
check_version.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
#!/bin/bash
PATH=${PATH}:/usr/local/sbin:/usr/sbin:/sbin:/usr/local/bin:/usr/bin:/bin
################################################################################
#
# based on check_version.sh by xenion http://dallachiesa.com/doku.php?id=itsec:rtpbreak
#
latest_version_absurl="http://projects.xplico.org/version/capanalysis_ver.txt"
this_version_relpath="include/version.h"
timeout=1
if [ "$1" = "" ]; then
timeout=20
fi
this_version_a="`cat "$this_version_relpath" | grep CAPANA_VER_MAG | cut -f 3 -d ' ' `"
this_version_b="`cat "$this_version_relpath" | grep CAPANA_VER_MIN | cut -f 3 -d ' ' `"
this_version_c="`cat "$this_version_relpath" | grep CAPANA_VER_REV | cut -f 3 -d ' ' `"
this_version=$this_version_a.$this_version_b.$this_version_c
latest_version="`wget -T $timeout --user-agent=\"CapAnalysis "$this_version"\" -t 1 -qO- "$latest_version_absurl" 2> /dev/null | cut -f2- -d=`"
if [ "$latest_version" != "" ] ;
then
if [ "$latest_version" = "$this_version" ] ;
then
if [ "$1" = "" ]; then
echo "You have the latest available version!"
fi
else
if [[ "$latest_version" > "$this_version" ]];
then
echo ""
echo "There is a NEW version of CapAnalysis. (ver: $latest_version)"
echo ""
fi
fi
fi