From 65071323b371d548cd70fb534708122395f4a830 Mon Sep 17 00:00:00 2001 From: jschauma Date: Mon, 24 Jan 2005 03:41:34 +0000 Subject: Add bits to allow bulk-builders to generate checksums for the binary packages they upload (by setting the optional variable MKSUMS=yes) and, also optionally, PGP signing them (by setting SIGN_AS=username@NetBSD.org, for example). --- mk/bulk/upload | 53 ++++++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 52 insertions(+), 1 deletion(-) (limited to 'mk') diff --git a/mk/bulk/upload b/mk/bulk/upload index a94a1001db5..96371ed0763 100644 --- a/mk/bulk/upload +++ b/mk/bulk/upload @@ -1,13 +1,23 @@ #!/bin/sh -# $NetBSD: upload,v 1.19 2005/01/20 02:02:50 tv Exp $ +# $NetBSD: upload,v 1.20 2005/01/24 03:41:34 jschauma Exp $ # # Upload non-restricted binary pkgs to ftp server # +CKSUM="cksum"; +MD5="digest md5"; +SHA1="digest sha1"; +BSDSUM="sum -o 1"; +SYSVSUM="sum -o 2"; + opsys=`uname -s` case "$opsys" in NetBSD) BMAKE=make ;; +IRIX*) BMAKE=bmake; + BSDSUM="sum -r"; + SYSVSUM="sum"; + ;; *) BMAKE=bmake ;; esac @@ -98,6 +108,47 @@ RSFLAGS="-vap --progress $RSYNC_OPTS" failed=no cd $packages +if [ "${MKSUMS}" = "yes" -o "${MKSUMS}" = "YES" ]; then + + SUMFILES="BSDSUM CKSUM MD5 SHA1 SYSVSUM" + + rm -f ${SUMFILES} + + if [ x"${SIGN_AS}" != x"" ]; then + ( cd ${pkgsrcdir}/security/gnupg; ${BMAKE} bulk-install ) + for i in ${SUMFILES}; do + echo > $i + echo "This file is signed with ${SIGN_AS}'s PGP key." >> $i + echo >> $i + done + fi + + ( cd ${pkgsrcdir}/pkgtools/digest; ${BMAKE} bulk-install ) + for i in All/*; do + if ! grep -q $i $exf; then + ${BSDSUM} $i >> BSDSUM + ${CKSUM} $i >> CKSUM + ${MD5} $i >> MD5 + ${SHA1} $i >> SHA1 + ${SYSVSUM} $i >> SYSVSUM + fi + done + + if [ x"${SIGN_AS}" != x"" ]; then + for i in ${SUMFILES}; do + echo "Signing $i" + gpg --clearsign $i && rm $i + done + SUMFILES="BSDSUM.asc CKSUM.asc MD5.asc SHA1.asc SYSVSUM.asc" + fi + + for i in ${SUMFILES}; do + [ -s ${packages}/${i} ] && echo $i >> $osf + done + +fi + + echo "#!/bin/sh" > $upload echo "packages=$packages" >> $upload echo "if ! cd $packages ; then" >> $upload -- cgit v1.2.3