From 982d79e47a7fc6d5bd9e5473fa195afece2a4c7f Mon Sep 17 00:00:00 2001 From: Fredrik Domeij Date: Fri, 17 Mar 2017 07:58:03 +0100 Subject: jira-test.its.umu.se added --- scripts/get-metadata.sh | 45 ++++++++++++++++++++++++++++++++++++++++----- 1 file changed, 40 insertions(+), 5 deletions(-) (limited to 'scripts') diff --git a/scripts/get-metadata.sh b/scripts/get-metadata.sh index 88938b61..efc73c7d 100755 --- a/scripts/get-metadata.sh +++ b/scripts/get-metadata.sh @@ -22,6 +22,13 @@ EOF exit 1 fi +script_cwd=`dirname "$0"` +if test -d swamid-2.0 ; then + echo "Moving into swamid-2.0/" + cd swamid-2.0 + echo "$script_cwd" | grep -q ^/ || script_cwd=../$script_cwd +fi + if echo "$metadataurl" | grep -qE '^http://|^https://' ; then metadata=`curl -s -k -f "$metadataurl"` elif echo "$metadataurl" | grep -qE '^reep:' ; then @@ -48,19 +55,47 @@ entityid=`echo "$metadata" | sed -n 's/.*entityID=['\''"]\([^"]*\)['\''"].*/\1/p entityidfn=`echo "$entityid" | sed 's;https*://;;' | tr 'A-Z' 'a-z' | sed 's;/$;;' | sed 's/[^a-z0-9_.-]/-/g' | sed 's/\.xml$//;s/$/.xml/'` [ -n "$entityidfn" ] || error "Failed to generate filename from entityid $entityid" -if [ -r "$entityidfn" ] ; then - echo -n "Replace $entityidfn with metadata [Y/n]? " -else +[ -r "$entityidfn" ] && new=false || new=true +if $new ; then echo -n "Save metadata into $entityidfn [Y/n]? " +else + echo -n "Replace $entityidfn with metadata [Y/n]? " fi read x case $x in Y|y|"") + if $new ; then + echo -n "Add swamid-2.0/$entityidfn to swamid-sp-2.0.mxml [Y/n]? " + read x + case $x in + Y|y|"") + sed -i "s;^; \n&;" ../swamid-sp-2.0.mxml + echo -- + tail -n 10 ../swamid-sp-2.0.mxml | sed 's/^/ /' + echo -- + ;; + *) + echo "Not added" + ;; + esac + fi + echo "$metadata" > $entityidfn tmp=`mktemp` - xsltproc `dirname $0`/../xslt/clean-entitydescriptor.xsl ${entityidfn} > ${tmp} && mv ${tmp} ${entityidfn} + xsltproc $script_cwd/../xslt/clean-entitydescriptor.xsl ${entityidfn} > ${tmp} && mv ${tmp} ${entityidfn} - echo $entityidfn + if $new ; then + echo -n "Add swamid-2.0/$entityidfn to git [Y/n]? " + read x + case $x in + Y|y|"") + git add $entityidfn + ;; + *) + echo "Not added" + ;; + esac + fi ;; *) echo "Nothing done" -- cgit v1.2.3