From bed31e73ccfa20b52ff2bea44b62f3693bfbd451 Mon Sep 17 00:00:00 2001 From: "B. Watson" Date: Tue, 20 Oct 2015 19:07:34 -0400 Subject: sbofindsrc: support for sbosrcarch-style mirrors --- sbofindsrc | 34 ++++++++++++++++++++++++++++------ 1 file changed, 28 insertions(+), 6 deletions(-) diff --git a/sbofindsrc b/sbofindsrc index e5682db..552e27c 100755 --- a/sbofindsrc +++ b/sbofindsrc @@ -5,12 +5,16 @@ SELF=$( basename $0 ) # to add a repo, list its name here, and write a _download() -# function, which should return success if a file was downloaded -# and failure otherwise. +# function, which should return success if a file was downloaded and +# failure otherwise. order isn't important here, it's randomized on +# every run. -# these are used in the order listed. the order is basically random -# right now, possibly could rank them according to something or another. -repos="macports fedora wayback naptime tld ponce sfdirect gentoo netbsd freebsd debian" +repos="wayback sbosrcarch macports fedora naptime pldattic tld ponce sfdirect gentoo netbsd freebsd debian" + +# mirror(s) to use for sbosrcarch, one or more, space-separated. +# these are tried in the order listed. +# leave off the trailing / (shouldn't really matter, but...) +sbosrcarch_mirrors="http://urchlay.naptime.net/~urchlay/sbosrc" usage() { cat <&1 | tee tmp.$$ @@ -152,6 +164,12 @@ tld_download() { do_wget "http://df.tld-linux.org/distfiles/by-md5/$dir/" -r -l1 -nH -np -nd -Rdesc -Rindex.html\* } +# TODO: try also http://distfiles.pld-linux.org/distfiles/by-md5/ ? (is it the same?) +pldattic_download() { + dir="$( echo $dlmd5 | cut -b1 )/$( echo $dlmd5 | cut -b2 )/$dlmd5" + do_wget "http://attic-distfiles.pld-linux.org/distfiles/by-md5/$dir/" -r -l1 -nH -np -nd -Rdesc -Rindex.html\* +} + # https://archive.org/help/wayback_api.php # json_pp included in slackware's perl package wayback_download() { @@ -224,6 +242,10 @@ for srcurl in $DOWNLOAD; do dlmd5=$1 shift + repos="$( ( for repo in $repos; do + echo $repo + done ) | sort -R )" + for repo in $repos; do echo echo "Trying $repo:" @@ -235,7 +257,7 @@ for srcurl in $DOWNLOAD; do if [ "$testmode" = "1" ]; then [ "$got" = "0" ] && found=1 else - check_file && break + check_file && found=1 && break fi done done -- cgit v1.2.3