diff options
author | gerald <gerald@FreeBSD.org> | 2007-09-08 16:23:13 +0000 |
---|---|---|
committer | gerald <gerald@FreeBSD.org> | 2007-09-08 16:23:13 +0000 |
commit | be094347fc5a1700d21752697b2131959700157a (patch) | |
tree | ddceac0877d55bd76cb7cf10f0e3f1d71b3774a1 /Tools | |
parent | 6e13e64f9ddd7706095eb6a4e0f3bf3c8bc94281 (diff) | |
download | FreeBSD-ports-be094347fc5a1700d21752697b2131959700157a.zip FreeBSD-ports-be094347fc5a1700d21752697b2131959700157a.tar.gz |
Use PKG_DBDIR instead of hard-coding /var/db/pkg/. Do not silently revert
to defaults for PORTSDIR and PKG_DBDIR if the respective directory does
not exist, but bail out.
Approved by: netchild
Diffstat (limited to 'Tools')
-rwxr-xr-x | Tools/scripts/resolveportsfromlibs.sh | 18 |
1 files changed, 15 insertions, 3 deletions
diff --git a/Tools/scripts/resolveportsfromlibs.sh b/Tools/scripts/resolveportsfromlibs.sh index ed207ae..b88a611 100755 --- a/Tools/scripts/resolveportsfromlibs.sh +++ b/Tools/scripts/resolveportsfromlibs.sh @@ -81,9 +81,21 @@ if [ -z "${PORTSDIR}" ]; then PORTSDIR=$(make -f /etc/make.conf -V PORTSDIR) fi -if [ -z "${PORTSDIR}" -o ! -d "${PORTSDIR}" ]; then +if [ -z "${PORTSDIR}" ]; then PORTSDIR=/usr/ports fi +if [ ! -d "${PORTSDIR}" ]; then + echo "PORTSDIR = ${PORTSDIR} is not a directory." + exit 1 +fi + +if [ -z "${PKG_DBDIR}" ]; then + PKG_DBDIR=/var/db/pkg +fi +if [ ! -d "${PKG_DBDIR}" ]; then + echo "PKG_DBDIR = ${PKG_DBDIR} is not a directory." + exit 1 +fi for i in $@; do result="" @@ -112,9 +124,9 @@ for i in $@; do for base in ${bases}; do port=$(pkg_which "${base}/lib/$i") - if [ -f /var/db/pkg/$port/+CONTENTS ]; then + if [ -f $PKG_DBDIR/$port/+CONTENTS ]; then origin=$(grep "@comment ORIGIN:" \ - /var/db/pkg/$port/+CONTENTS \ + $PKG_DBDIR/$port/+CONTENTS \ | sed -e 's/@comment ORIGIN://') break else |