diff options
author | trevor <trevor@FreeBSD.org> | 2004-03-12 18:56:53 +0000 |
---|---|---|
committer | trevor <trevor@FreeBSD.org> | 2004-03-12 18:56:53 +0000 |
commit | 307c6e63ac42293b6fe00373a6fc99d87c5290f2 (patch) | |
tree | dada4b63a10ab9f583e06d8437787346bd8b9a6c /Tools/scripts | |
parent | 9809d5a46d38e94227d6920991543e79814bd7c8 (diff) | |
download | FreeBSD-ports-307c6e63ac42293b6fe00373a6fc99d87c5290f2.zip FreeBSD-ports-307c6e63ac42293b6fe00373a6fc99d87c5290f2.tar.gz |
script for finding "size mismatch" and "size unknown" errors
Diffstat (limited to 'Tools/scripts')
-rwxr-xr-x | Tools/scripts/checksize.sh | 58 |
1 files changed, 58 insertions, 0 deletions
diff --git a/Tools/scripts/checksize.sh b/Tools/scripts/checksize.sh new file mode 100755 index 0000000..38af931 --- /dev/null +++ b/Tools/scripts/checksize.sh @@ -0,0 +1,58 @@ +#!/bin/sh +# checksize.sh: scan the ports collection for "size mismatch" and +# "size unknown" errors by attempting to fetch onto a full filesystem +# +# When called with a parameter that is the name of a category of +# ports, the script checks that category, then checks the whole +# ports collection, redoing the named category. When called with +# no parameter, it checks the whole collection. +# +# First do something like: +# +# dd if=/dev/zero of=/usr/ports/mfs.img bs=1k count=512 +# mdconfig -a -t vnode -f /usr/ports/mfs.img -u 1 +# newfs /dev/md1 +# mount /dev/md1 /mnt +# dd if=/dev/zero of=/mnt/zero +# +# (for RELENG_4 use vnconfig instead of mdconfig). Then run this +# while logging with, for example, the "script" utility and look +# for "size mismatch" (indicating the server has a distfile with a +# different size than what is listed in the distinfo file) and "size +# unknown" (indicating that the server does not report file sizes) +# errors in the output. Pipe the output through: +# +# grep -w size | grep -1 -E "unknown|mismatch" +# +# By keeping the filesystem full, we avoid fetching entire distfiles. +# The script attempts to partially download each distfile from all +# master sites. Contacting all sites is desirable because sometimes +# a site which ostensibly mirrors another may contain corrupt files +# which are intact on the main site (or vice versa). +# +# bugs: +# - assumes ports tree is in /usr/ports/ +# - doesn't provide for checking only particular categories or ports +# - support for multiple architectures is inefficient +# - output is messy +# - on my system, the first 20 kB of each distfile are fetched +# - needs manual setup of /mnt/ +# +# placed in the public domain by Trevor Johnson + +for category in $1 `grep ^SUBDIR /usr/ports/Makefile | cut -f3 -d\ `; do + cd /usr/ports/$category + for port in \ + `grep -wc SIZE */distinfo* | grep -v :0 | cut -f1 -d\/`; do + cd /usr/ports/$category/$port + for arc in i386; do + echo checking $arc size data for $category/$port + make DISTDIR=/mnt \ + ARCH=$arc \ + BATCH=yes \ + MACHINE_ARCH=$arc \ + PACKAGE_BUILDING=yes \ + TRYBROKEN=yes checksum + done + done +done |