#!/bin/bash # Copyright 2010-2015 Gentoo Foundation; Distributed under the GPL v2 # might be earlier copyright, no history available ARCHES="alpha amd64 arm hppa ia64 ppc s390 sh sparc x86" #alpha amd64 arm hppa ia64 mips ppc s390 sh sparc x86 RELEASES=/var/tmp/gmirror-releases/releases/ [[ $HOSTNAME == TODO ]] && RELEASES=/var/tmp/gmirror/releases/ DEBUG='' VERBOSE='' # Do not change DEBUGP= VERBOSEP=false [ -n "$DEBUG" ] && DEBUGP=echo [ -n "$VERBOSE" ] && VERBOSEP= [ -n "$DEBUG" ] && RSYNC_OPTS="${RSYNC_OPTS} -n" [ -n "$VERBOSE" ] && RSYNC_OPTS="${RSYNC_OPTS} -v" signone() { f="$1" $DEBUGP gpg --homedir /home/gmirror/.gnupg-releng/ --armor --clearsign "${f}" } for a in $ARCHES ; do pushd $RELEASES/$a >/dev/null || continue #echo "ISOS:" [[ -d autobuilds ]] || exit digests="$(find autobuilds -name '*.DIGESTS' )" sigs="$(find autobuilds -name '*.DIGESTS.asc' )" unsigned="$(comm -23 <(echo "$digests" |sort) <(echo "$sigs" | sed -e 's,.asc$,,g' |sort))" #$VERBOSEP echo "=== ARCH: $a" for dgst in $unsigned ; do if [ ! -f ${dgst}.asc ]; then $VERBOSEP echo "Signing $dgst" signone $dgst fi done for dgst in $digests ; do if [ -f ${dgst}.asc -a ${dgst} -nt ${dgst}.asc ]; then $VERBOSEP echo "Resigning $dgst" rm -f ${dgst}.asc signone $dgst fi done #echo "$isos" #latest="$(echo "$isos" | tail -n1)" #if [[ -n $latest ]]; then # #echo "latest is $latest" # latest=$(echo "$latest" | awk '{print $2}') # #pwd # rm current && ln -s $latest current #fi popd >/dev/null done