43 lines
914 B
Bash
Executable file
43 lines
914 B
Bash
Executable file
#!/usr/bin/env bash
|
|
|
|
set -e
|
|
|
|
base_url="http://localhost:8080"
|
|
base_dir="/opt/mdqp/work/signed_metadata"
|
|
|
|
tmpfile=$(mktemp /tmp/"$(basename "$0")".XXXXXX)
|
|
|
|
|
|
for expression in "role-sp" "role-idp" "index.html"; do
|
|
echo "Fetching up ${expression}"
|
|
|
|
case $expression in
|
|
role-sp)
|
|
url="role/sp.xml"
|
|
file="/role/sp.xml"
|
|
;;
|
|
role-idp)
|
|
url="role/idp.xml"
|
|
file="/role/idp.xml"
|
|
;;
|
|
index.html)
|
|
url="entities/"
|
|
file="/entities/index.html"
|
|
;;
|
|
|
|
*)
|
|
echo "Unsupported expression ${expression}"
|
|
exit 1
|
|
;;
|
|
esac
|
|
|
|
curl ${base_url}/${url} -o "${tmpfile}"
|
|
if ! grep -q entityID "${tmpfile}" ; then
|
|
echo "No entityID found in file for ${expression}"
|
|
exit 1
|
|
fi
|
|
full_path=${base_dir}${file}
|
|
mkdir -p "$(dirname ${full_path})"
|
|
mv "${tmpfile}" "${full_path}"
|
|
|
|
done
|