diff options
author | B. Watson <urchlay@slackware.uk> | 2023-10-31 04:26:36 -0400 |
---|---|---|
committer | B. Watson <urchlay@slackware.uk> | 2023-10-31 04:26:36 -0400 |
commit | 7fbd45b8fd2a9ba0d841da7ba7ff29117ec77a0e (patch) | |
tree | 2bcf47aef33ee1f7687ba8d75c072d1d41f496c2 /sbofindsrc | |
parent | 380ac487a921d23bb7439219bc4e8f6d7d68bd41 (diff) | |
download | sbostuff-7fbd45b8fd2a9ba0d841da7ba7ff29117ec77a0e.tar.gz |
Diffstat (limited to 'sbofindsrc')
-rwxr-xr-x | sbofindsrc | 38 |
1 files changed, 32 insertions, 6 deletions
@@ -1,4 +1,4 @@ -#!/bin/sh +#!/bin/bash # 20150827 bkw: attempt to find missing source tarballs @@ -47,7 +47,7 @@ usage() { cat <<EOF $SELF - attempt to find slackbuilds.org sources -Usage: $SELF [-t] [path] +Usage: $SELF [-t] [-r repo] [path] path is either an .info file or a directory containing an .info file. If a directory is given, it's searched for first in the current directory, @@ -70,6 +70,10 @@ failure (non-zero) status. -t is test mode, does an HTTP HEAD request instead of downloading, and doesn't stop after finding a match. + +Use "-r <repo>" to search only one repo from the list. Setting REPO +in the environment has the same effect. This option is mostly just for +testing. Don't forget the space between -r and the repo name! EOF exit "$1" } @@ -153,7 +157,13 @@ sfdirect_download() { } gentoo_download() { - do_wget "http://ftp.osuosl.org/pub/gentoo/distfiles/$dlfile" + # b2sum from SBo blake2 package. + if type -p b2sum &>/dev/null; then + dir="$( echo -n $dlfile | b2sum | head -c2 )" + do_wget "http://ftp.osuosl.org/pub/gentoo/distfiles/$dir/$dlfile" + else + echo "*** can't try gentoo distfiles because b2sum is missing; install system/blake2" + fi } freebsd_download() { @@ -288,6 +298,18 @@ if [ "$1" = "-t" ]; then shift fi +if [ "$1" = "-r" ]; then + if [ "$2" != "" ]; then + REPO="$2" + shift + shift + else + echo "Supported repositories for -r:" + echo $repos + exit 0 + fi +fi + if [ "$#" -gt 1 ]; then usage 1 fi @@ -302,9 +324,13 @@ for srcurl in $DOWNLOAD; do dlmd5=$1 shift - repos="$( ( for repo in $repos; do - echo $repo - done ) | sort -R )" + if [ "$REPO" != "" ]; then + repos="$REPO" + else + repos="$( ( for repo in $repos; do + echo $repo + done ) | sort -R )" + fi for repo in $repos; do echo |