Support for multi source download when using https protocol (#3306)
* Bugfix - toolchain download only from a single source * - replaced hardcoded continent value with dynamic - set https download as default since its downloading from multiple closest servers by default
This commit is contained in:
parent
3196fac0d1
commit
0344d20c15
@ -19,6 +19,6 @@ DEST_LANG="en_US.UTF-8" # sl_SI.UTF-8, en_US.UTF-8
|
||||
EXTERNAL_NEW="prebuilt" # compile and install or install prebuilt additional packages
|
||||
INSTALL_HEADERS="" # install kernel headers package
|
||||
LIB_TAG="master" # change to "branchname" to use any branch currently available.
|
||||
USE_TORRENT="yes" # use torrent network for faster toolchain and cache download
|
||||
USE_TORRENT="no" # use torrent network for faster toolchain and cache download
|
||||
DOWNLOAD_MIRROR="" # set to "china" to use mirrors.tuna.tsinghua.edu.cn
|
||||
CARD_DEVICE="" # device name /dev/sdx of your SD card to burn directly to the card when done
|
||||
|
||||
@ -1588,23 +1588,22 @@ function webseed ()
|
||||
{
|
||||
# list of mirrors that host our files
|
||||
unset text
|
||||
WEBSEED=($(curl -s https://redirect.armbian.com/mirrors | jq '.[] |.[] | values' | grep https | awk '!a[$0]++'))
|
||||
# Hardcoded to EU mirrors since
|
||||
local CCODE=$(curl -s redirect.armbian.com/geoip | jq '.continent.code' -r)
|
||||
WEBSEED=($(curl -s https://redirect.armbian.com/mirrors | jq -r '.'${CCODE}' | .[] | values'))
|
||||
# aria2 simply split chunks based on sources count not depending on download speed
|
||||
# when selecting china mirrors, use only China mirror, others are very slow there
|
||||
if [[ $DOWNLOAD_MIRROR == china ]]; then
|
||||
WEBSEED=(
|
||||
"https://mirrors.tuna.tsinghua.edu.cn/armbian-releases/"
|
||||
https://mirrors.tuna.tsinghua.edu.cn/armbian-releases/
|
||||
)
|
||||
elif [[ $DOWNLOAD_MIRROR == bfsu ]]; then
|
||||
WEBSEED=(
|
||||
"https://mirrors.bfsu.edu.cn/armbian-releases/"
|
||||
https://mirrors.bfsu.edu.cn/armbian-releases/
|
||||
)
|
||||
fi
|
||||
for toolchain in ${WEBSEED[@]}; do
|
||||
# use only live, tnahosting return ok also when file is absent
|
||||
if [[ $(wget -S --spider "${toolchain}${1}" 2>&1 >/dev/null | grep 'HTTP/1.1 200 OK') && ${toolchain} != *tnahosting* ]]; then
|
||||
text="${text} ${toolchain}${1}"
|
||||
fi
|
||||
text="${text} ${toolchain}${1}"
|
||||
done
|
||||
text="${text:1}"
|
||||
echo "${text}"
|
||||
@ -1693,7 +1692,7 @@ download_and_verify()
|
||||
# direct download if torrent fails
|
||||
if [[ ! -f "${localdir}/${filename}.complete" ]]; then
|
||||
if [[ ! `timeout 10 curl --head --fail --silent ${server}${remotedir}/${filename} 2>&1 >/dev/null` ]]; then
|
||||
display_alert "downloading from $(echo $server | cut -d'/' -f3 | cut -d':' -f1) using http(s) network" "$filename"
|
||||
display_alert "downloading using http(s) network" "$filename"
|
||||
aria2c --download-result=hide --rpc-save-upload-metadata=false --console-log-level=error \
|
||||
--dht-file-path="${SRC}"/cache/.aria2/dht.dat --disable-ipv6=true --summary-interval=0 --auto-file-renaming=false --dir="${localdir}" ${server}${remotedir}/${filename} $(webseed "${remotedir}/${filename}") -o "${filename}"
|
||||
# mark complete
|
||||
|
||||
Loading…
Reference in New Issue
Block a user