aboutsummaryrefslogtreecommitdiff
path: root/Tools/scripts
diff options
context:
space:
mode:
authorMaxim Sobolev <sobomax@FreeBSD.org>2002-05-07 14:04:05 +0000
committerMaxim Sobolev <sobomax@FreeBSD.org>2002-05-07 14:04:05 +0000
commit58f55ea1c5765cf24687f45984e349ff810101f3 (patch)
tree3376aabcc484a840cc736ab4df43332452293e61 /Tools/scripts
parent50990d56cbd3e3a7a240ce80429baba82c7b8b2b (diff)
downloadports-58f55ea1c5765cf24687f45984e349ff810101f3.tar.gz
ports-58f55ea1c5765cf24687f45984e349ff810101f3.zip
Notes
Diffstat (limited to 'Tools/scripts')
-rwxr-xr-xTools/scripts/distclean.sh20
1 files changed, 15 insertions, 5 deletions
diff --git a/Tools/scripts/distclean.sh b/Tools/scripts/distclean.sh
index 0d58d848bcc5..8c3f773fc548 100755
--- a/Tools/scripts/distclean.sh
+++ b/Tools/scripts/distclean.sh
@@ -14,7 +14,7 @@
# Maxim Sobolev
# ----------------------------------------------------------------------------
#
-# $FreeBSD: /tmp/pcvs/ports/Tools/scripts/distclean.sh,v 1.11 2001-12-19 16:46:42 sobomax Exp $
+# $FreeBSD: /tmp/pcvs/ports/Tools/scripts/distclean.sh,v 1.12 2002-05-07 14:04:05 sobomax Exp $
#
# MAINTAINER= sobomax@FreeBSD.org
@@ -27,7 +27,17 @@ cleanup() {
}
echo "Distfiles clean utility by Maxim Sobolev <sobomax@FreeBSD.org>."
-echo "Assumes that your ports in /usr/ports and distfiles in /usr/ports/distfiles."
+
+PORTSDIR=${PORTSDIR:-/usr/ports}
+if [ ! -d ${PORTSDIR} ]; then
+ echo "Ports directory ${PORTSDIR} does not exist."
+ exit 1
+fi
+
+DISTDIR=`(cd ${PORTSDIR} && make -V DISTDIR) 2>/dev/null`
+DISTDIR=${DISTDIR:-/usr/ports/distfiles}
+
+echo "Assumes that your ports are in ${PORTSDIR} and distfiles in ${DISTDIR}."
echo ""
if [ x"$1" = x"-f" ]; then
@@ -48,19 +58,19 @@ trap cleanup 1 2 3 4 5 6 7 8 10 11 12 13 14 15 16 21 22 23 24 25 26 27 28 \
30 31
echo -n "Building ports md5 index..."
-find /usr/ports/ -name "distinfo" -or -name "distinfo.i386" -or -name "distinfo.alpha" -type f | xargs cat | grep "^MD5 ("| sort | uniq > $FN_PORTS
+find ${PORTSDIR} -name "distinfo" -or -name "distinfo.i386" -or -name "distinfo.alpha" -type f | xargs cat | grep "^MD5 ("| sort | uniq > $FN_PORTS
echo "Done."
P_MD5_COUNT=`wc -l $FN_PORTS | sed "s| $FN_PORTS|| ; s| ||g"`
echo "Found $P_MD5_COUNT md5 entries in your ports directory."
echo -n "Building distfiles md5 index..."
-find /usr/ports/distfiles/ -type f | xargs md5 | sed 's|/usr/ports/distfiles/||' | sort > $FN_DISTFILES
+find ${DISTDIR} -type f | xargs md5 | sed 's|'${DISTDIR}'/||' | sort > $FN_DISTFILES
echo "Done."
D_MD5_COUNT=`wc -l $FN_DISTFILES | sed "s| $FN_DISTFILES|| ; s| ||g"`
echo "Found $D_MD5_COUNT distfile(s) in your distfiles directory."
echo -n "Comparing results..."
-diff -d $FN_DISTFILES $FN_PORTS | grep "^<" | sed 's|.*(|rm '$RM_FLAG' /usr/ports/distfiles/| ; s|).*||' > $FN_RESULTS_SCRIPT
+diff -d $FN_DISTFILES $FN_PORTS | grep "^<" | sed 's|.*(|rm '$RM_FLAG' '${DISTDIR}'/| ; s|).*||' > $FN_RESULTS_SCRIPT
echo "Done."
R_MD5_COUNT=`wc -l $FN_RESULTS_SCRIPT | sed "s| $FN_RESULTS_SCRIPT|| ; s| ||g"`
echo "$R_MD5_COUNT distfile(s) doesn't have corresponding md5 entries in ports directory."