redundant-opt-files.sh script: validate PORTSDIR value

Before checking validity of $db_dir, verify $portdir is valid and eject if
it is not.  This provides a better error message when PORTSDIR is invalid.
This commit is contained in:
John Marino
2016-03-17 13:18:21 +00:00
parent 2e28ad5977
commit aafd191750

View File

@@ -9,6 +9,12 @@
# deleted in order to prevent future configuration check failures.
portsdir=${PORTSDIR:-/usr/ports}
if [ ! -d "${portsdir}" ]; then
echo "The ${portsdir} ports directory does not exist"
echo "There is nothing more to do."
exit
fi
db_dir=$(/usr/bin/make -C ${portsdir}/devel/gmake -V PORT_DBDIR 2>/dev/null)
if [ ! -d "${db_dir}" ]; then