Skip to content

Commit c4bbb9d

Browse files
committed
Add check if download was successfull
1 parent fc1330c commit c4bbb9d

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

src/hst_autocompile.sh

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,9 @@
1212
clear
1313

1414
# Define download function
15+
set -e
1516
download_file() {
17+
set +e
1618
local url=$1
1719
local destination=$2
1820
local force=$3
@@ -50,6 +52,11 @@ download_file() {
5052
if [ ! -f "$ARCHIVE_DIR/$filename" ]; then
5153
[ "$HESTIA_DEBUG" ] && >&2 echo DEBUG: wget $url -q $dstopt --show-progress --progress=bar:force --limit-rate=3m
5254
wget $url -q $dstopt --show-progress --progress=bar:force --limit-rate=3m
55+
if [ $? -ne 0 ]; then
56+
>&2 echo "[!] Archive $ARCHIVE_DIR/$filename is corrupted and exit script";
57+
rm -f $ARCHIVE_DIR/$filename
58+
exit 1;
59+
fi
5360
fi
5461

5562
if [ ! -z "$destination" ] && [ "$is_archive" = "true" ]; then

0 commit comments

Comments
 (0)