updated mirror-mdq

This commit is contained in:
Leif Johansson 2018-02-13 12:15:04 +01:00
parent fc0652899e
commit 2347c38963

View file

@ -4,6 +4,10 @@ base=$1
target=$2
dir=`mktemp -d`
if [ -z $MIRROR_MDQ_POST ]; then
MIRROR_MDQ_POST=/etc/mirror-mdq/post.d
fi
function cleanup() {
rm -rf $dir
}
@ -15,15 +19,9 @@ mkdir -p $target && (
WGET_ARGS="--mirror --no-host-directories -q"
idx_obj=".well-known/webfinger?rel=urn:oasis:names:tc:SAML:2.0:metadata"
wget $WGET_ARGS "$base/$idx_obj" && jq -r '.links[].href' < "$idx_obj" | wget $WGET_ARGS -i -
cat>$dir/index.html<<EOF
<html><head><title>Metadata</title></head>
<body>
<ul>
<li><a href="/entities">/entities</a></li>
</ul>
</body>
</html>
EOF
if [ -d $MIRROR_MDQ_POST ]; then
env SOURCE=$1 TARGET=$target IDX_OBJ=$idx_obj run-parts $MIRROR_MDQ_POST
fi
)
rsync -az $RSYNC_ARGS --delete $dir/ $target/