summaryrefslogtreecommitdiff
path: root/scripts/remove_entity.sh
diff options
context:
space:
mode:
authorBjörn Mattsson <bjorn@sunet.se>2023-03-06 11:22:05 +0100
committerBjörn Mattsson <bjorn@sunet.se>2023-03-06 11:22:05 +0100
commit467dbdbf3d7212e25ee69daeaadd8adba7c7c5b8 (patch)
treed3576d5f2d4b5cc676c0a12ef8f8c3c83b474bf5 /scripts/remove_entity.sh
parentbc1d55080e5d42e6ef2bba892d640aa8f68bbc90 (diff)
Moved files to make ths repo signed
Diffstat (limited to 'scripts/remove_entity.sh')
-rwxr-xr-xscripts/remove_entity.sh65
1 files changed, 0 insertions, 65 deletions
diff --git a/scripts/remove_entity.sh b/scripts/remove_entity.sh
deleted file mode 100755
index 60645a7e..00000000
--- a/scripts/remove_entity.sh
+++ /dev/null
@@ -1,65 +0,0 @@
-#!/bin/bash
-
-error()
-{
- echo "Error: $*"
- exit 1
-}
-
-if [ -z "$1" ]; then
- echo "$0 <Filename / id from metadata to remove>"
- exit
-fi
-
-metadataurl=$1
-
-if [ -s "${metadataurl}" ]; then
- entityidfn=$(basename "$metadataurl")
-else
- case $metadataurl in
- [0-9][0-9]*)
- url="https://metadata.swamid.se/?rawXML=${metadataurl}"
- ;;
- https://metadata.swamid.se/?showEntity=*)
- #url=$(echo "$metadataurl" | sed 's;showEntity;rawXML;')
- url=${metadataurl//showEntity/rawXML}
- ;;
- esac
- metadata=$(curl -L -m 5 -s -k -f "${url}")
-
- [ -n "$metadata" ] || error "Failed to fetch metadata from $metadataurl"
-
- entityid=$(echo "$metadata" | sed -n 's/.*entityID=['\''"]\([^"]*\)['\''"].*/\1/p')
- [ -n "$entityid" ] || error "Failed to find entityID in metadata"
- [ "$(echo "$entityid" | wc -l | sed 's/ //g')" = "1" ] || error "Multiple entityid:s found: $entityid"
-
- entityidfn=$(echo "$entityid" | sed 's;.*://;;' | sed 's/[^a-zwA-ZW0-9_.-]/-/g' | sed 's/$/.xml/')
- [ -n "$entityidfn" ] || error "Failed to generate filename from entityid $entityid"
-fi
-file=$(find swamid-testing swamid-2.0 swamid-edugain -name "$entityidfn" | head -1)
-
-if [ -r "$file" ]; then
- echo "---------------------"
- grep "$file" ./*.mxml
- echo "---------------------"
- echo -n "OK to remove ? [Y/n]"
- read -r x
- case $x in
- "Y"|"y"|"") ;;
- *) exit 1 ;;
- esac
-
- echo
- git rm "$file"
-
- grep "$file" ./*.mxml | sed 's/\(.*\.mxml\): <xi:include href=".*"\/>/\1/' | while read -r mxmlfile ; do
- sed -i.bak "/\/$entityidfn/d" "$mxmlfile"
- if [ -f "$mxmlfile".bak ]; then
- rm "$mxmlfile".bak
- fi
- done
- git diff
- git status
-else
- error "File not found: $file"
-fi