diff options
author | B. Watson <yalhcru@gmail.com> | 2015-10-20 19:07:34 -0400 |
---|---|---|
committer | B. Watson <yalhcru@gmail.com> | 2015-10-20 19:07:34 -0400 |
commit | bed31e73ccfa20b52ff2bea44b62f3693bfbd451 (patch) | |
tree | 680c5748e6f23cede70c9d751fa29b39de9072f1 /sbofindsrc | |
parent | 42f6d70256292db0da49fb3480eedf772de6182b (diff) | |
download | sbostuff-bed31e73ccfa20b52ff2bea44b62f3693bfbd451.tar.gz |
sbofindsrc: support for sbosrcarch-style mirrors
Diffstat (limited to 'sbofindsrc')
-rwxr-xr-x | sbofindsrc | 34 |
1 files changed, 28 insertions, 6 deletions
@@ -5,12 +5,16 @@ SELF=$( basename $0 ) # to add a repo, list its name here, and write a <name>_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 <<EOF @@ -86,6 +90,14 @@ do_wget() { wget $wgetopts $@ $url } +sbosrcarch_download() { + dir="by-md5/$( echo $dlmd5 | cut -b1 )/$( echo $dlmd5 | cut -b2 )/$dlmd5" + for mirror in $sbosrcarch_mirrors; do + do_wget "$mirror/$dir/$dlfile" + check_file && return 0; + done +} + # ponce's server returns 200 OK status for its 404 page, hence the ugly: ponce_download() { do_wget "http://ponce.cc/slackware/sources/repo/$dlfile" 2>&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 |