summaryrefslogtreecommitdiffhomepage
path: root/subr.rtl
diff options
context:
space:
mode:
authorLucio Andrés Illanes Albornoz <lucio@lucioillanes.de>2021-01-22 14:19:49 +0000
committerLucio Andrés Illanes Albornoz <lucio@lucioillanes.de>2021-01-22 14:19:49 +0000
commit1bd15efef1dfe0fff29a448fb719b5dfc2a0e861 (patch)
tree4b1206faf2a08858dd1a5fd993e4425a825aa871 /subr.rtl
parent15563993a0b8ebfcf663a8a99566ee0d6e6091a2 (diff)
downloadmidipix_build-1bd15efef1dfe0fff29a448fb719b5dfc2a0e861.tar.bz2
midipix_build-1bd15efef1dfe0fff29a448fb719b5dfc2a0e861.tar.xz
Implements ${{DEFAULT,PKG,...}_MIRRORS}.
build.sh:build(): define and zero-initialise ${DEFAULT_MIRRORS}. etc/README.md: updated. midipix.env: adds ${DEFAULT_MIRRORS} (https://midipix.org/mirror/ https://midipix.lucioillanes.de/archives/). subr.rtl/rtl_fetch.subr:rtl_fetch_url_wget(): receive and operate on target name and optional list of mirrors. subr/pkg_fetch_download.subr: additionally pass ${PKG_NAME} and ${PKG_MIRRORS} to rtl_fetch_url_wget().
Diffstat (limited to 'subr.rtl')
-rw-r--r--subr.rtl/rtl_fetch.subr12
1 files changed, 8 insertions, 4 deletions
diff --git a/subr.rtl/rtl_fetch.subr b/subr.rtl/rtl_fetch.subr
index d0ad54b0..64eac921 100644
--- a/subr.rtl/rtl_fetch.subr
+++ b/subr.rtl/rtl_fetch.subr
@@ -53,12 +53,16 @@ rtl_fetch_urls_git() {
# N.B. URLs ($1) may contain `?' or '&' characters.
rtl_fetch_url_wget() {
- local _urls="${1}" _sha256sum_src="${2}" _target_fname="${3}" _rc=0 _target_fname_full=""\
- _url="" _urls_count=0;
+ local _urls="${1}" _sha256sum_src="${2}" _target_fname="${3}" _target_name="${4}" _mirrors="${5:-}" \
+ _rc=0 _target_fname_full="" _url="" _url_base="" _urls_count=0 _urls_full="";
if [ "${ARG_FETCH_FORCE}" = "offline" ]; then
return 0;
- else _urls_count="$(rtl_llength "${_urls}")";
- for _url in ${_urls}; do
+ else _urls_full="${_urls}";
+ for _url_base in ${_mirrors}; do
+ _urls_full="$(rtl_lconcat "${_urls_full}" "${_url_base%/}/${_target_name}/${_target_fname}")";
+ done;
+ _urls_count="$(rtl_llength "${_urls_full}")";
+ for _url in ${_urls_full}; do
if [ -z "${_target_fname}" ]; then
_target_fname="$(rtl_basename "${_url}")";
fi;