2005-12-06 23:21:22 -01:00
|
|
|
#!/bin/sh
|
|
|
|
#
|
|
|
|
# grab_md5
|
|
|
|
# (c) 2004 Steve McIntyre <steve@einval.com>
|
|
|
|
#
|
|
|
|
# GPL v2
|
|
|
|
#
|
|
|
|
# Parse Packages and Sources files out of a mirror and pre-process
|
|
|
|
# them into a single list ready for mkisofs to check later
|
|
|
|
|
|
|
|
MIRROR=$1
|
2006-11-30 21:13:42 -01:00
|
|
|
ARCHES="$2"
|
2007-07-30 07:36:39 +00:00
|
|
|
CODENAME=$3
|
|
|
|
DI_CODENAME=$4
|
2006-11-30 21:13:42 -01:00
|
|
|
OUT=$5
|
2005-12-06 23:21:22 -01:00
|
|
|
|
2006-11-30 21:13:42 -01:00
|
|
|
for ARCH in $ARCHES
|
|
|
|
do
|
2008-07-06 21:08:21 +00:00
|
|
|
LOCATIONS="$MIRROR/dists/$CODENAME/ $MIRROR/dists/$DI_CODENAME/"
|
|
|
|
echo "Looking in $LOCATIONS"
|
2006-03-09 00:27:20 -01:00
|
|
|
|
2008-07-06 21:08:21 +00:00
|
|
|
case $ARCH in
|
|
|
|
source)
|
|
|
|
FILES=`find $LOCATIONS -name Sources.gz`
|
|
|
|
echo "Using MD5 sums from Sources files:"
|
2008-07-06 21:01:18 +00:00
|
|
|
echo $FILES
|
2008-07-06 21:08:21 +00:00
|
|
|
zcat -f $FILES | awk -v MIRROR=$MIRROR '
|
|
|
|
/^Directory:/ {
|
|
|
|
DIR = $2
|
|
|
|
next
|
|
|
|
}
|
|
|
|
/^Files:/ {
|
|
|
|
in_files = 1
|
|
|
|
next
|
|
|
|
}
|
|
|
|
/^ / {
|
|
|
|
if (in_files) {
|
|
|
|
gsub("^ ", "", $0)
|
|
|
|
MD5 = $1
|
|
|
|
SIZE = $2
|
|
|
|
FILE = $3
|
|
|
|
printf("%s %12s %s/%s/%s\n", MD5, SIZE, MIRROR, DIR, FILE);
|
|
|
|
next
|
|
|
|
}
|
|
|
|
}
|
|
|
|
/^[^ ]/ {
|
|
|
|
in_files = 0
|
2006-11-30 21:13:42 -01:00
|
|
|
FILE = ""
|
|
|
|
DIR = ""
|
2008-07-06 21:08:21 +00:00
|
|
|
}' | sort | uniq >> $OUT
|
|
|
|
;;
|
2010-08-20 15:04:23 +00:00
|
|
|
alpha|amd64|arm|armel|hppa|i386|ia64|m68k|mips|mipsel|powerpc|s390|sparc|kfreebsd-amd64|kfreebsd-i386)
|
2008-07-06 21:08:21 +00:00
|
|
|
FILES=`find $LOCATIONS -name Packages.gz | grep binary-$ARCH`
|
|
|
|
echo "Using MD5 sums from Packages files:"
|
2008-07-06 21:01:18 +00:00
|
|
|
echo $FILES
|
2008-07-06 21:08:21 +00:00
|
|
|
zcat -f $FILES | awk -v MIRROR=$MIRROR '
|
|
|
|
/^Filename:/ {
|
|
|
|
FILE = $2
|
|
|
|
}
|
|
|
|
/^Size:/ {
|
|
|
|
SIZE = $2
|
|
|
|
}
|
|
|
|
/^MD5sum:/ {
|
|
|
|
MD5 = $2
|
|
|
|
printf("%s %12d %s/%s\n", MD5, SIZE, MIRROR, FILE)
|
|
|
|
}' | sort | uniq >> $OUT
|
2006-11-30 21:13:42 -01:00
|
|
|
# Use the new D-I images. Do NOT use the "current"
|
|
|
|
# link; it causes problems with overlaid files...
|
2007-07-30 07:36:39 +00:00
|
|
|
for VER in $MIRROR/dists/$DI_CODENAME/main/installer-$ARCH/*
|
2006-11-30 21:13:42 -01:00
|
|
|
do
|
|
|
|
if [ -d $VER ] && [ ! -L $VER ] ; then
|
|
|
|
FILE=$VER/images/MD5SUMS
|
2008-07-06 21:08:21 +00:00
|
|
|
echo "Using MD5 sums from d-i: $FILE"
|
2007-07-30 07:36:39 +00:00
|
|
|
LOC=dists/$DI_CODENAME/main/installer-$ARCH/`basename $VER`/images
|
2006-11-30 21:13:42 -01:00
|
|
|
for ENTRY in `cat $FILE | sed 's/ /:/g'`
|
|
|
|
do
|
|
|
|
PATH=`echo $ENTRY | /bin/sed "s?^.*:\./?$MIRROR/$LOC/?g"`
|
|
|
|
MD5=`echo $ENTRY | /bin/sed 's/:.*$//g'`
|
|
|
|
SIZE=`/usr/bin/stat -c %s $PATH`
|
|
|
|
printf '%s %12.12s %s\n' $MD5 $SIZE $PATH
|
|
|
|
done | sort | uniq >> $OUT
|
|
|
|
fi
|
|
|
|
done
|
2008-07-06 21:08:21 +00:00
|
|
|
;;
|
|
|
|
*)
|
|
|
|
echo "Unknown arch/source $ARCH!"
|
|
|
|
exit 1
|
|
|
|
;;
|
|
|
|
esac
|
2006-11-30 21:13:42 -01:00
|
|
|
done
|
2005-12-06 23:21:22 -01:00
|
|
|
|
|
|
|
exit 0
|