diff options
author | Björn Mattsson <bjorn@sunet.se> | 2022-12-19 13:59:57 +0100 |
---|---|---|
committer | Björn Mattsson <bjorn@sunet.se> | 2022-12-19 13:59:57 +0100 |
commit | d39ea732087cee12cdc07c25397cd2e6699d20d2 (patch) | |
tree | 419f0e05e434f03c451f64cb418406ea04660f63 /scripts/rename-xml.sh | |
parent | edab7bd7c3e73fa463f1ed6fdd50620a6b5f17dd (diff) |
Renamed files to match entityID
Diffstat (limited to 'scripts/rename-xml.sh')
-rwxr-xr-x | scripts/rename-xml.sh | 29 |
1 files changed, 4 insertions, 25 deletions
diff --git a/scripts/rename-xml.sh b/scripts/rename-xml.sh index 59a0f04b..4326579f 100755 --- a/scripts/rename-xml.sh +++ b/scripts/rename-xml.sh @@ -9,29 +9,15 @@ error() exit 1 } -entityID=$1 -if [ -z "$entityID" ] ; then +metadata=$1 +if [ -z "$metadata" ] ; then cat <<EOF -Usage: `basename $0` <entityID> -Ex: `basename $0` https://shibsp.mysite.com/swamidproxy/gitlab.xml +Usage: `basename $0` <file to check> +Ex: `basename $0` account.eciu.eu.xml 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 "$entityID" | grep -qE '^http://|^https://' ; then - metadata=`grep -il "entityID.*$entityID" *` -else - echo "Missing http(s) in entityID" -fi -[ -n "$metadata" ] || error "Failed to fetch metadata from $metadataurl" - entityid=`cat "$metadata" | sed -n 's/.*entityID=['\''"]\([^"]*\)['\''"].*/\1/p'` [ -n "$entityid" ] || error "Failed to find entityID in metadata" [ `echo "$entityid" | wc -l` = 1 ] || error "Multiple entityid:s found: `echo $entityid`" @@ -49,13 +35,6 @@ fi read x case $x in Y|y|"") - grep -l "$metadata\"" ../*.mxml | while read file; do - sed -i.bak "s;href=\"swamid-2.0/$metadata\";href=\"swamid-2.0/$entityidfn\";" $file - if [ -f ${file}.bak ]; then - rm ${file}.bak - fi - - done git mv $metadata $entityidfn ;; |