aboutsummaryrefslogtreecommitdiff
path: root/sbofindsrc
diff options
context:
space:
mode:
Diffstat (limited to 'sbofindsrc')
-rwxr-xr-xsbofindsrc38
1 files changed, 32 insertions, 6 deletions
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 <<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