summaryrefslogtreecommitdiff
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
parentUpdate to 2.0.1. (diff)
Add checksum.sh script that checks a port or ports for broken distfiles and
gives a diff of any port with broken distfiles, if the distfile names are the same. This script will help keep more ports' up-to-date distfiles on ftp.FreeBSD.org. PR: 18723 Submitted by: Alexander Langer <alex@cichlids.com>
Notes
Notes: svn path=/head/; revision=28669
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