diff options
author | Iru Cai <mytbk920423@gmail.com> | 2018-11-03 23:10:00 +0800 |
---|---|---|
committer | Iru Cai <mytbk920423@gmail.com> | 2018-11-03 23:10:00 +0800 |
commit | 27e78c2539b19689e0a997af2a7decdbc93052b3 (patch) | |
tree | 2d5bb31b114e77db1b01503cbe7cd36d46f64709 | |
parent | d2d67a1eb569d8770e571417046c7658502a1ff3 (diff) | |
download | liveusb-builder-27e78c2539b19689e0a997af2a7decdbc93052b3.tar.xz |
Use `if wget ...` in case of wget errors
-rw-r--r-- | functions.sh | 21 |
1 files changed, 11 insertions, 10 deletions
diff --git a/functions.sh b/functions.sh index efb27a4..7cd6235 100644 --- a/functions.sh +++ b/functions.sh @@ -79,16 +79,17 @@ download_iso() { mkdir -p "$ISOPATH" for url in ${mirrorlist[@]} do - wget -c -O "$ISOPATH/$ISOFILE" "$url/$ISOURL" - if checksum_verify; then - return 0 - else - # checksum bad, may be due to a bad partial download - # so remove the file and try again - rm -f "$ISOPATH/$ISOFILE" - wget -O "$ISOPATH/$ISOFILE" "$url/$ISOURL" - checksum_verify && return 0 - rm -f "$ISOPATH/$ISOFILE" # then try next mirror + if wget -c -O "$ISOPATH/$ISOFILE" "$url/$ISOURL"; then + if checksum_verify; then + return 0 + else + # checksum bad, may be due to a bad partial download + # so remove the file and try again + rm -f "$ISOPATH/$ISOFILE" + wget -O "$ISOPATH/$ISOFILE" "$url/$ISOURL" + checksum_verify && return 0 + rm -f "$ISOPATH/$ISOFILE" # then try next mirror + fi fi done fatalerror "Fail to download $ISOFILE!" |