diff options
-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 |