#!/bin/bash function die() { echo $* exit 1 } URL=$1 DIR=$2 CERT=$3 if echo "$DIR" | grep -q "mds.swamid.se" ; then publish_name=mds.swamid.se else publish_name=md.swamid.se fi TMPF=`mktemp` wget -q --timeout 120 --no-check-certificate -O$TMPF $URL || die "Unable to download $URL: $?" if [ "x$CERT" != "x" ]; then samlsign -c $CERT -f $TMPF || die "Unable to verify $URL with $CERT: $?" fi TMPD=`mktemp -d` xsltproc --stringparam output $TMPD xslt/import-metadata.xsl $TMPF || die "Unable to import metadata from $URL: $?" rsync -avz $TMPD/ $DIR ( echo '' echo "" T=`mktemp` for md in $DIR/*.xml; do xsltproc xslt/clean-entitydescriptor.xsl $md > $T && mv $T $md test=`echo $md | cut -d/ -f2-` if [ ! -f "swamid-2.0/$test" -a ! -f "swamid-2.0-obsolete/$test" ]; then echo "" fi done rm -f $T echo "" ) > $DIR.mxml #git add $DIR.mxml $DIR #git commit -m "$URL into $DIR" $DIR.mxml $DIR rm -rf $TMPF $TMPD