aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMaxim Sobolev <sobomax@FreeBSD.org>2001-05-17 13:11:18 +0000
committerMaxim Sobolev <sobomax@FreeBSD.org>2001-05-17 13:11:18 +0000
commitb22c4e2030f8ebe38781d3a1ce7ef487d469e470 (patch)
treef68c402dae8267c81624463d69c10468f13fe225
parenta2b3b8deb8ec4d1bedecaa829fe9ff40a1631b3b (diff)
downloadports-b22c4e2030f8ebe38781d3a1ce7ef487d469e470.tar.gz
ports-b22c4e2030f8ebe38781d3a1ce7ef487d469e470.zip
- Add an option to disable interactive confirmation;
- catch up possible signals to remove temporary files. Submitted by: dirk, sobomax
Notes
Notes: svn path=/head/; revision=42670
-rwxr-xr-xTools/scripts/distclean.sh19
1 files changed, 18 insertions, 1 deletions
diff --git a/Tools/scripts/distclean.sh b/Tools/scripts/distclean.sh
index 854e414256db..5ef0aef12f2f 100755
--- a/Tools/scripts/distclean.sh
+++ b/Tools/scripts/distclean.sh
@@ -14,22 +14,39 @@
# Maxim Sobolev
# ----------------------------------------------------------------------------
#
-# $FreeBSD: /tmp/pcvs/ports/Tools/scripts/distclean.sh,v 1.6 2001-03-19 15:20:00 sobomax Exp $
+# $FreeBSD: /tmp/pcvs/ports/Tools/scripts/distclean.sh,v 1.7 2001-05-17 13:11:18 sobomax Exp $
#
# MAINTAINER= sobomax@FreeBSD.org
PATH=/sbin:/bin:/usr/bin
+cleanup() {
+ rm -f $FN_RESULTS_SCRIPT $FN_PORTS $FN_DISTFILES
+ echo "Terminated."
+ exit 1
+}
+
echo "Distfiles clean utility by Maxim Sobolev <sobomax@FreeBSD.org>."
echo "Assumes that your ports in /usr/ports and distfiles in /usr/ports/distfiles."
echo ""
+if [ x"$1" = x"-f" ]; then
+ RM_FLAG="-f"
+else
+ RM_FLAG="-i"
+ echo "Use \"`basename $0` -f\" to remove the files without prompting for confirmation."
+ echo ""
+fi
+
umask 077
FN_PORTS=`mktemp -t dclean` || exit 1
FN_DISTFILES=`mktemp -t dclean` || exit 1
FN_RESULTS_SCRIPT=`mktemp -t dclean` || exit 1
+trap cleanup 1 2 3 4 5 6 7 8 10 11 12 13 14 15 16 20 21 22 23 24 25 26 27 28 \
+ 29 30 21
+
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
echo "Done."