From 7fbd45b8fd2a9ba0d841da7ba7ff29117ec77a0e Mon Sep 17 00:00:00 2001 From: "B. Watson" Date: Tue, 31 Oct 2023 04:26:36 -0400 Subject: sbofindsrc: support new gentoo layout; add -r option. --- sbofindsrc | 38 ++++++++++++++++++++++++++++++++------ 1 file changed, 32 insertions(+), 6 deletions(-) (limited to 'sbofindsrc') diff --git a/sbofindsrc b/sbofindsrc index 83939ea..0297204 100755 --- a/sbofindsrc +++ b/sbofindsrc @@ -1,4 +1,4 @@ -#!/bin/sh +#!/bin/bash # 20150827 bkw: attempt to find missing source tarballs @@ -47,7 +47,7 @@ usage() { cat <" 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 -- cgit v1.2.3