From c3e34481018bc438baf68c2beb2da4177acdc713 Mon Sep 17 00:00:00 2001 From: Iru Cai Date: Tue, 2 Aug 2016 20:14:12 +0800 Subject: download iso from mirrorlist --- buildlive | 3 ++- functions.sh | 9 +++++++++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/buildlive b/buildlive index 31babbd..e8e1f83 100755 --- a/buildlive +++ b/buildlive @@ -65,7 +65,8 @@ do if [ -f "isofiles/$ISOFILE" ]; then checksum_verify else - fatalerror "File isofiles/$ISOFILE not found!" + download_iso + checksum_verify fi install_live diff --git a/functions.sh b/functions.sh index e44b8a7..8d8db9c 100644 --- a/functions.sh +++ b/functions.sh @@ -25,6 +25,15 @@ process_distro() { source "distro/$1/install.sh" ISOFILE="$(basename $ISOURL)" ISOMNT="/media/$ISOFILE" + MIRRORLIST=(`cat "distro/$1/mirrorlist"`) +} + +download_iso() { + for url in ${MIRRORLIST[@]} + do + wget -O "isofiles/$ISOFILE" "$url/$ISOURL" && return 0 + done + fatalerror "Fail to download $ISOFILE!" } mount_iso() { -- cgit v1.2.3