eid-ops/md1.komreg.net/overlay/usr/local/bin/mirror-mdq.sh

30 lines
552 B
Bash
Raw Normal View History

2018-01-23 16:49:46 +01:00
#!/bin/bash
base=$1
target=$2
dir=`mktemp -d`
function cleanup() {
rm -rf $dir
}
trap cleanup EXIT
mkdir -p $target && (
cd $dir
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
2018-01-23 16:49:46 +01:00
)
2018-02-11 23:56:05 +01:00
rsync -az $RSYNC_ARGS --delete $dir/ $target/