From 07e9be3081bbc86c01eabf8c7a175cf70ba94eae Mon Sep 17 00:00:00 2001 From: "B. Watson" Date: Wed, 20 Apr 2022 11:45:54 -0400 Subject: set PKG in cdsb() --- sbostuff.sh | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/sbostuff.sh b/sbostuff.sh index 7de15f5..2c15284 100644 --- a/sbostuff.sh +++ b/sbostuff.sh @@ -59,10 +59,15 @@ _cdsbexp() { /bin/ls -d1 "$@" 2>/dev/null | grep -v /local/ | head -1 } +_set_pkg() { + PKG=${TMP:-/tmp/SBo}/package-"$( basename "$( pwd )" )" +} + cdsb() { # FIXME: get from config file local dir local oldshopt + local ret case "$1" in -h|--help) @@ -88,16 +93,20 @@ EOF if [ -d $SBO_GITROOT/$1 ]; then # category/prgnam (exact) cd $SBO_GITROOT/$1 + _set_pkg elif [ -d "$( _cdsbexp $SBO_GITROOT/*/$1)" ]; then # prgnam without category (exact) cd "$( _cdsbexp $SBO_GITROOT/*/$1)" + _set_pkg else echo "cdsb: no exact match, guessing dir" 1>&2 dir="$( _cdsbexp $SBO_GITROOT/*/$1* )" [ -z "$dir" ] && dir="$( _cdsbexp $SBO_GITROOT/*/*$1* )" if [ -n "$dir" ]; then cd "$dir" - return "$?" + ret="$?" + [ "$ret" = "0" ] && _set_pkg + return "$ret" else echo "cdsb: no match" 1>&2 return 1 -- cgit v1.2.3