aboutsummaryrefslogtreecommitdiff
path: root/Tools
diff options
context:
space:
mode:
authorWill Andrews <will@FreeBSD.org>2000-05-22 10:02:42 +0000
committerWill Andrews <will@FreeBSD.org>2000-05-22 10:02:42 +0000
commitd48209bc9bd40d2c4cc878fb2bcf0db699a590ae (patch)
tree35b7b628b93263b555b952294d036d7534cfd1bc /Tools
parent20418e6c996565b98fd3bdbf2101d98d4c669009 (diff)
downloadports-d48209bc9bd40d2c4cc878fb2bcf0db699a590ae.tar.gz
ports-d48209bc9bd40d2c4cc878fb2bcf0db699a590ae.zip
Notes
Diffstat (limited to 'Tools')
-rw-r--r--Tools/scripts/README5
-rwxr-xr-xTools/scripts/checksum.sh61
2 files changed, 66 insertions, 0 deletions
diff --git a/Tools/scripts/README b/Tools/scripts/README
index c051234ec0ca..738c54f4f98f 100644
--- a/Tools/scripts/README
+++ b/Tools/scripts/README
@@ -45,3 +45,8 @@ NOTE: These scripts need work and are *NOT* safe to use unless you know
what they do. Use at your own risk. Patches would be great, but
I'd prefer they pass through me.
+----------------------------------------------------------------------
+
+checksum is a script that allows checking of ports to see if their checksums
+match, and if they don't, give a diff against the older version to try and
+discover why the checksum didn't match.
diff --git a/Tools/scripts/checksum.sh b/Tools/scripts/checksum.sh
new file mode 100755
index 000000000000..b227812f7d7c
--- /dev/null
+++ b/Tools/scripts/checksum.sh
@@ -0,0 +1,61 @@
+#!/bin/sh
+
+if [ -z $1 ]; then
+ echo "Usage: $0 <portname>"
+ exit 1
+fi
+
+if [ -z $TMPDIR ]; then
+ TMPDIR=/tmp
+fi
+if [ -z $PORTSDIR ]; then
+ PORTSDIR=/usr/ports
+fi
+
+cd $PORTSDIR
+DIR=`grep $1 INDEX| cut -f2 -d\|`
+cd $DIR
+
+make fetch
+broken=`make checksum 2>&1 | grep "Checksum mismatch for" | awk '{print $5}' \
+ | sed -e 's:\.$::'`
+
+if [ -z $broken ]; then
+ make checksum
+ echo "Checksum ok, exiting..."
+ exit 1
+fi
+
+rm -rf $TMPDIR/checksum
+mkdir $TMPDIR/checksum
+cd $TMPDIR/checksum
+mkdir $TMPDIR/checksum/orig
+mkdir $TMPDIR/checksum/new
+
+echo Fetching $broken
+fetch ftp://ftp.FreeBSD.ORG/pub/FreeBSD/distfiles/$broken
+
+if [ ! -r $broken ]; then
+ echo "File $broken not found, fetch error?"
+ exit 1
+fi
+
+if file $broken | grep "gzip compressed data" >/dev/null; then
+ cd orig
+ tar -zxf ../$broken
+ cd ../new
+ tar -zxf $PORTSDIR/distfiles/$broken
+ cd ..
+elif file $broken | grep "zip archive file" >/dev/null ; then
+ cd orig
+ unzip ../$broken
+ cd ../new
+ unzip $PORTSDIR/distfiles/$broken
+ cd ..
+else
+ cp $broken orig/
+ cp $PORTSDIR/distfiles/$broken new/
+fi
+
+echo Diff follows:
+diff -rNu orig new