mirror of
https://git.FreeBSD.org/ports.git
synced 2024-12-26 05:02:18 +00:00
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>
This commit is contained in:
parent
20418e6c99
commit
d48209bc9b
Notes:
svn2git
2021-03-31 03:12:20 +00:00
svn path=/head/; revision=28669
@ -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.
|
||||
|
61
Tools/scripts/checksum.sh
Executable file
61
Tools/scripts/checksum.sh
Executable file
@ -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
|
Loading…
Reference in New Issue
Block a user