summaryrefslogtreecommitdiffstats
path: root/Tools
diff options
context:
space:
mode:
authorgerald <gerald@FreeBSD.org>2007-09-08 16:23:13 +0000
committergerald <gerald@FreeBSD.org>2007-09-08 16:23:13 +0000
commitbe094347fc5a1700d21752697b2131959700157a (patch)
treeddceac0877d55bd76cb7cf10f0e3f1d71b3774a1 /Tools
parent6e13e64f9ddd7706095eb6a4e0f3bf3c8bc94281 (diff)
downloadFreeBSD-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-xTools/scripts/resolveportsfromlibs.sh18
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
OpenPOWER on IntegriCloud