diff options
Diffstat (limited to 'scripts/pull-and-verify.sh')
-rwxr-xr-x | scripts/pull-and-verify.sh | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/scripts/pull-and-verify.sh b/scripts/pull-and-verify.sh index c53fd66a..6e63e855 100755 --- a/scripts/pull-and-verify.sh +++ b/scripts/pull-and-verify.sh @@ -6,20 +6,22 @@ function die() { } URL=$1 -CERT=$2 -DIR=$3 +DIR=$2 +CERT=$3 TMPF=`mktemp` wget --no-check-certificate -O$TMPF $URL || die "Unable to download $URL: $?" -samlsign -c $CERT -f $TMPF || die "Unable to verify $URL with $CERT: $?" +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 '<?xml version="1.0"?>' -echo "<EntitiesDescriptor xmlns=\"urn:oasis:names:tc:SAML:2.0:metadata\" xmlns:xi=\"http://www.w3.org/2001/XInclude\" Name=\"http://md.swamid.se/md/$3.xml\">" +echo "<EntitiesDescriptor xmlns=\"urn:oasis:names:tc:SAML:2.0:metadata\" xmlns:xi=\"http://www.w3.org/2001/XInclude\" Name=\"http://md.swamid.se/md/$DIR.xml\">" T=`mktemp` -for md in $3/*.xml; do +for md in $DIR/*.xml; do xsltproc xslt/clean-entitydescriptor.xsl $md > $T && mv $T $md echo "<xi:include href=\"$md\"/>" done |