blob: ac9aa0a64b39b791448a695fdb7839daa0876b47 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
|
#!/bin/bash
function die() {
echo $*
exit 1
}
URL=$1
CERT=$2
DIR=$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: $?"
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\">"
for md in $3/*.xml; do
echo "<xi:include href=\"$md\"/>"
done
echo "</EntitiesDescriptor>"
) > $DIR.mxml
git add $DIR.mxml $DIR
git commit -m "$URL into $DIR" $DIR.mxml $DIR
rm -rf $TMPF $TMPD
|