aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorB. Watson <yalhcru@gmail.com>2015-10-25 23:42:59 -0400
committerB. Watson <yalhcru@gmail.com>2015-10-25 23:42:59 -0400
commitd61673351faf041a96891f560b842b8ed5bbb101 (patch)
tree880b909787bdc615f9232176cd51efbe31b0c021
parent3f651fdcfa6738f8062d32415e699b07e6dad2d4 (diff)
downloadsbostuff-d61673351faf041a96891f560b842b8ed5bbb101.tar.gz
sbofindsrc: add default dir and SBOROOT env var
-rwxr-xr-xsbofindsrc26
1 files changed, 23 insertions, 3 deletions
diff --git a/sbofindsrc b/sbofindsrc
index e2aedea..76bf067 100755
--- a/sbofindsrc
+++ b/sbofindsrc
@@ -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: