diff options
author | Fredrik Domeij <fredrik.domeij@umu.se> | 2022-02-10 21:05:09 +0100 |
---|---|---|
committer | Fredrik Domeij <fredrik.domeij@umu.se> | 2022-02-10 21:05:09 +0100 |
commit | 5c98771e1a72745ccab665165a725d7ae6d51056 (patch) | |
tree | cb62e35847b3e84bb0909f06a701ea67e2695291 /scripts/get-metadata.sh | |
parent | 6b532999567f9de7b8904257da27d2f79f5de197 (diff) |
Read registrationInstant from existing metadata if available
Diffstat (limited to 'scripts/get-metadata.sh')
-rwxr-xr-x | scripts/get-metadata.sh | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/scripts/get-metadata.sh b/scripts/get-metadata.sh index aa105e8e..1a4af53e 100755 --- a/scripts/get-metadata.sh +++ b/scripts/get-metadata.sh @@ -75,8 +75,11 @@ entityidfn=`echo "$entityid" | sed 's;.*://;;' | sed 's/[^a-zwA-ZW0-9_.-]/-/g' | if $new ; then echo -n "Save metadata into $entityidfn [Y/n]? " else + regdate=$(sed -n 's;.*RegistrationInfo.*registrationInstant="\([^"]*\)".*;\1;p' < "$entityidfn" | head -n 1) echo -n "Replace $entityidfn with metadata [Y/n]? " fi +[ -n "$regdate" ] || regdate=$(perl $script_cwd/../scripts/now_date.pl) + read x case $x in Y|y|"") @@ -98,7 +101,7 @@ case $x in echo "$metadata" > $entityidfn tmp=`mktemp` - xsltproc --stringparam regDate $(perl $script_cwd/../scripts/now_date.pl) $script_cwd/../xslt/add-rpi.xsl ${entityidfn} > ${tmp} && mv ${tmp} ${entityidfn} + 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 $new ; then |