summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorcperciva <cperciva@FreeBSD.org>2006-01-06 20:39:11 +0000
committercperciva <cperciva@FreeBSD.org>2006-01-06 20:39:11 +0000
commita95e158b6ddfc6db7054264b529825644a1bf96a (patch)
treeae42adea56a433fff28d090bdffcea9b32d9b2c1
parent4e4ec01ec9838cec537c3fbbc58dfa13d8868f64 (diff)
downloadFreeBSD-src-a95e158b6ddfc6db7054264b529825644a1bf96a.zip
FreeBSD-src-a95e158b6ddfc6db7054264b529825644a1bf96a.tar.gz
Make "portsnap extract" automatically create ${PORTSDIR} if necessary
instead of complaining that "Directory does not exist or is not writable". Suggested by: {tlp, siep} via IRC MFC after: 1 week
-rw-r--r--usr.sbin/portsnap/portsnap/portsnap.sh8
1 files changed, 6 insertions, 2 deletions
diff --git a/usr.sbin/portsnap/portsnap/portsnap.sh b/usr.sbin/portsnap/portsnap/portsnap.sh
index 0f87ab9..307ee6d 100644
--- a/usr.sbin/portsnap/portsnap/portsnap.sh
+++ b/usr.sbin/portsnap/portsnap/portsnap.sh
@@ -255,9 +255,11 @@ fetch_check_params() {
# Perform sanity checks and set some final parameters
# in preparation for extracting or updating ${PORTSDIR}
+# Complain if ${PORTSDIR} exists but is not writable,
+# but don't complain if ${PORTSDIR} doesn't exist.
extract_check_params() {
_WORKDIR_bad="Directory does not exist: "
- _PORTSDIR_bad="Directory does not exist or is not writable: "
+ _PORTSDIR_bad="Directory is not writable: "
if ! [ -d "${WORKDIR}" ]; then
echo -n "`basename $0`: "
@@ -265,7 +267,7 @@ extract_check_params() {
echo ${WORKDIR}
exit 1
fi
- if ! [ -d "${PORTSDIR}" -a -w "${PORTSDIR}" ]; then
+ if [ -d "${PORTSDIR}" ] && ! [ -w "${PORTSDIR}" ]; then
echo -n "`basename $0`: "
echo -n "${_PORTSDIR_bad}"
echo ${PORTSDIR}
@@ -812,6 +814,8 @@ extract_metadata() {
# Do the actual work involved in "extract"
extract_run() {
+ mkdir -p ${PORTSDIR} || return 1
+
if !
if ! [ -z "${EXTRACTPATH}" ]; then
grep "^${EXTRACTPATH}" ${WORKDIR}/INDEX
OpenPOWER on IntegriCloud