Skip to content

Commit 22e14cb

Browse files
baltzellraffaelladevita
authored andcommitted
abort on failure to download maps
1 parent db82d9d commit 22e14cb

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

build-coatjava.sh

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,16 +41,21 @@ command_exists () {
4141
type "$1" &> /dev/null
4242
}
4343
download () {
44+
ret=0
4445
if command_exists wget ; then
4546
# -N only redownloads if timestamp/filesize is newer/different
4647
$wget -N --no-check-certificate $1
48+
ret=$?
4749
elif command_exists curl ; then
4850
if ! [ -e ${1##*/} ]; then
4951
curl $1 -o ${1##*/}
52+
ret=$?
5053
fi
5154
else
52-
echo ERROR: Could not find wget nor curl.
55+
ret=1
56+
echo ERROR::::::::::: Could not find wget nor curl.
5357
fi
58+
return $ret
5459
}
5560

5661

@@ -66,6 +71,12 @@ if [ $downloadMaps == "yes" ]; then
6671
for map in $COAT_MAGFIELD_SOLENOIDMAP $COAT_MAGFIELD_TORUSMAP $COAT_MAGFIELD_TORUSSECONDARYMAP
6772
do
6873
download $webDir/$map
74+
if [ $? -ne 0 ]; then
75+
echo ERROR::::::::::: Could not download field map:
76+
echo $webDir/$map
77+
echo One option is to download manually into etc/data/magfield and then run this build script with --nomaps
78+
exit
79+
fi
6980
done
7081
cd -
7182
fi

0 commit comments

Comments
 (0)