From e70319db9ebb880af2ee4fe1dd6f1b476b590230 Mon Sep 17 00:00:00 2001
From: Fredrik Domeij <fredrik.domeij@umu.se>
Date: Fri, 11 Feb 2022 14:26:41 +0100
Subject: Do not touch xml if fetched from metadata.swamid.se

---
 scripts/get-metadata.sh | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/scripts/get-metadata.sh b/scripts/get-metadata.sh
index 1a4af53e..89e33bab 100755
--- a/scripts/get-metadata.sh
+++ b/scripts/get-metadata.sh
@@ -35,6 +35,7 @@ if test -d swamid-2.0 ; then
 	echo "$script_cwd" | grep -q ^/ || script_cwd=../$script_cwd
 fi
 
+update_xml=true
 if echo "$metadataurl" | grep -qE '^http://|^https://' ; then
 	metadata=`curl -L -s -k -f "$metadataurl"`
 elif echo "$metadataurl" | grep -qE '^reep:' ; then
@@ -48,6 +49,7 @@ else
 		case $metadataurl in
 			[0-9][0-9]*)
 				urls="https://metadata.swamid.se/?rawXML=${metadataurl}"
+				update_xml=false
 				;;
 			http*)
 				urls="$metadataurl"
@@ -100,9 +102,11 @@ case $x in
 		fi
 
 		echo "$metadata" > $entityidfn
-		tmp=`mktemp`
-		xsltproc --stringparam regDate "$regdate" $script_cwd/../xslt/add-rpi.xsl ${entityidfn} > ${tmp} && mv ${tmp} ${entityidfn}
-		xsltproc $script_cwd/../xslt/clean-entitydescriptor.xsl ${entityidfn} > ${tmp} && mv ${tmp} ${entityidfn}
+		if $update_xml ; then
+			tmp=`mktemp`
+			xsltproc --stringparam regDate "$regdate" $script_cwd/../xslt/add-rpi.xsl ${entityidfn} > ${tmp} && mv ${tmp} ${entityidfn}
+			xsltproc $script_cwd/../xslt/clean-entitydescriptor.xsl ${entityidfn} > ${tmp} && mv ${tmp} ${entityidfn}
+		fi
 
 		if $new ; then
 			echo -n "Add swamid-2.0/$entityidfn to git [Y/n]? "
-- 
cgit v1.2.3