Skip to content

Commit db82d9d

Browse files
baltzellraffaelladevita
authored andcommitted
support curl in build script
1 parent facb457 commit db82d9d

File tree

1 file changed

+19
-3
lines changed

1 file changed

+19
-3
lines changed

build-coatjava.sh

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,19 +37,35 @@ then
3737
mvn='mvn -q -B'
3838
fi
3939

40+
command_exists () {
41+
type "$1" &> /dev/null
42+
}
43+
download () {
44+
if command_exists wget ; then
45+
# -N only redownloads if timestamp/filesize is newer/different
46+
$wget -N --no-check-certificate $1
47+
elif command_exists curl ; then
48+
if ! [ -e ${1##*/} ]; then
49+
curl $1 -o ${1##*/}
50+
fi
51+
else
52+
echo ERROR: Could not find wget nor curl.
53+
fi
54+
}
55+
56+
4057
# download the default field maps, as defined in bin/env.sh:
4158
# (and duplicated in etc/services/reconstruction.yaml):
4259
source `dirname $0`/bin/env.sh
4360
if [ $downloadMaps == "yes" ]; then
4461
echo 'Retrieving field maps ...'
45-
webDir=http://clasweb.jlab.org/clas12offline/magfield
62+
webDir=https://clasweb.jlab.org/clas12offline/magfield
4663
locDir=etc/data/magfield
4764
mkdir -p $locDir
4865
cd $locDir
4966
for map in $COAT_MAGFIELD_SOLENOIDMAP $COAT_MAGFIELD_TORUSMAP $COAT_MAGFIELD_TORUSSECONDARYMAP
5067
do
51-
# -N only redownloads if timestamp/filesize is newer/different
52-
$wget -N --no-check-certificate $webDir/$map
68+
download $webDir/$map
5369
done
5470
cd -
5571
fi

0 commit comments

Comments
 (0)