#!/bin/sh set -e COUNT=0 # http://packages.debian.org/sid/kfreebsd-amd64/libppl9/download DEBMD5="2f20593dc5484d7428a4e9405e26cab0" if [ ! -f libppl9_0.11.2-6_kfreebsd-amd64.deb ]; then wget http://ftp.uk.debian.org/debian/pool/main/p/ppl/libppl9_0.11.2-6_kfreebsd-amd64.deb fi DWNLDDEB=`md5sum libppl9_0.11.2-6_kfreebsd-amd64.deb | cut -d' ' -f1` if [ "$DWNLDDEB" != "$DEBMD5" ]; then echo "Failed to download the correct file!" echo "$DWNLDDEB $DEBMD5" exit 5 fi if [ -d ./usr ]; then rm -rf ./usr/ fi if [ -f data.tar.gz ]; then rm data.tar.gz fi ar -x libppl9_0.11.2-6_kfreebsd-amd64.deb tar -xzf data.tar.gz ORIGMD5="0e52e84eebf41588865742edaff7b3c0" DWNLDMD5=`md5sum ./usr/share/doc/libppl9/CREDITS.gz | cut -d ' ' -f1` if [ "$ORIGMD5" != "$DWNLDMD5" ]; then echo "failed to extract the file correctly." exit 4 fi BUGMD5="99e2b9f8972ce00cfe57e3735881015e" if [ "$BUGMD5" = "$DWNLDMD5" ]; then echo "file no longer shows the same bug." exit 3 fi if [ -f control.tar.gz ]; then rm control.tar.gz fi if [ -f data.tar.gz ]; then rm data.tar.gz fi # now redo the compression (which shouldn't change the checksum but does) cp ./usr/share/doc/libppl9/CREDITS.gz . gunzip -f CREDITS.gz CONTENT=`sha256sum CREDITS | cut -d ' ' -f1` touch CREDITS gzip -9nf CREDITS REDONEMD5=`md5sum ./CREDITS.gz | cut -d ' ' -f1` # repeat redoing the compression until it changes again or the tester gets bored. while [ "$BUGMD5" = "$REDONEMD5" ]; do gunzip -f CREDITS.gz CHECK=`sha256sum CREDITS|cut -d ' ' -f1` if [ "$CHECK" != "$CONTENT" ]; then echo "contents of the file have changed!" exit 2 fi touch CREDITS gzip -9nf CREDITS REDONEMD5=`md5sum ./CREDITS.gz | cut -d ' ' -f1` COUNT=$((COUNT+1)) echo -n "$COUNT, " perl -e 'select(undef,undef,undef,.3)' done echo "CREDITS.gz failed to decompress & recompress to the same file!" echo "$BUGMD5 $REDONEMD5"