-
Notifications
You must be signed in to change notification settings - Fork 0
/
hs-version
executable file
·82 lines (65 loc) · 1.63 KB
/
hs-version
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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
#!/bin/bash
# HepSim setup toolkit.
# This is a part of the HepSim http://atlaswww.hep.anl.gov/hepsim
# S.Chekanov (ANL)
CFILE="./hepsim.jar"
export HEPSIM_DIR=`pwd`
if [ ! -f $CFILE ];
then
export HEPSIM_DIR="$( cd "$( echo "${BASH_SOURCE[0]%/*}" )" && pwd )"
fi
#chmod 755 $HEPSIM_DIR/*
export PATH="$HEPSIM_DIR:$PATH"
HEPSIM_VERSION="http://atlaswww.hep.anl.gov/asc/hepsim/version"
WWW_VERSION=-1
MIN_VERSION=0
# try wget
fcheck=`type -p wget`
if test -x "$fcheck";
then
WWW_VERSION=`wget -q $HEPSIM_VERSION -O - | cat`
fi
# is it numeric?
error=0
if [[ $WWW_VERSION = *[[:digit:]]* ]]; then
error=0
else
error=1 # is not numeric
WWW_VERSION=-1
fi
# we have failed with wget, try curl
if [ "$error" -gt "$MIN_VERSION" ] ; then
fcheck=`type -p curl`
if test -x "$fcheck";
then
WWW_VERSION=`curl -s $HEPSIM_VERSION | cat`
fi
fi
# is it numeric?
if [[ $WWW_VERSION = *[[:digit:]]* ]]; then
error=0
else
error=1 # is not numeric
WWW_VERSION=-1
fi
# we have failed with curl as well. Complain
if [ "$error" -gt "$MIN_VERSION" ] ; then
echo "Failed to check the version of HS-TOOLS. Please install \"wget\" or \"curl\""
fi
LOCAL_VERSION=1
VERSION_FILE=$HEPSIM_DIR/version
if [ -e $VERSION_FILE ]
then
LOCAL_VERSION=`cat $VERSION_FILE`
fi
echo "Installed hs-version is: $LOCAL_VERSION"
if [ "$error" -le "$MIN_VERSION" ]
then
if [ "$WWW_VERSION" -gt "$LOCAL_VERSION" ]
then
echo "A new version of \"hs-toolkit\" was found. Your version is $LOCAL_VERSION!"
echo "Please update your installation as explained in"
echo "http://atlaswww.hep.anl.gov/hepsim/description.ph"
echo " "
fi
fi