diff options
-rwxr-xr-x | sbofindsrc | 26 |
1 files changed, 23 insertions, 3 deletions
@@ -2,7 +2,13 @@ # 20150827 bkw: attempt to find missing source tarballs -SELF=$( basename $0 ) +### configurable stuff + +# where to look for slackbuilds. override with SBOROOT environment +# variable. current directory is always searched first. + +#SBODEFAULT=$HOME/slackbuilds +SBODEFAULT=/home/urchlay/sbo-master # to add a repo, list its name here, and write a <name>_download() # function, which should return success if a file was downloaded and @@ -34,6 +40,10 @@ http://slackware.org.uk/sbosrcarch http://urchlay.naptime.net/~urchlay/sbosrc " +### end of config, start of code + +SELF=$( basename $0 ) + usage() { cat <<EOF $SELF - attempt to find slackbuilds.org sources @@ -41,6 +51,10 @@ $SELF - attempt to find slackbuilds.org sources Usage: $SELF [-t] [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, +then in $SBODEFAULT (but you can set SBOROOT in the environment to +override this). + If no path given, current directory is assumed. Files are searched for in the following repositories: @@ -69,7 +83,7 @@ die() { read_info_file() { case "$1" in "") dir=. ;; - *.info) file="$1" ;; + *.info) file="$1" ;; *) dir="$1" ;; esac @@ -78,9 +92,15 @@ read_info_file() { fi if [ ! -f $file ]; then - die "Can't find .info file matching $file" + file="${SBOROOT:-$SBODEFAULT}"/$file + fi + + if [ ! -f $file ]; then + die "Can't find .info file matching $1" fi + file=$( eval echo $file ) + echo "Using info file: $file" source $file # snarfed straight from template.SlackBuild: |