diff options
author | Björn Mattsson <bjorn@sunet.se> | 2023-03-06 10:15:02 +0100 |
---|---|---|
committer | Björn Mattsson <bjorn@sunet.se> | 2023-03-06 10:15:02 +0100 |
commit | 070774c77e20d6356bdae280e35c77eb609c98df (patch) | |
tree | 8b126ef6aa898d44f3a76b85be0a0b4d3b264d6c /scripts | |
parent | 30c80a7a52488a6872e113a38bd0f1ed12aaffbc (diff) |
Move existing file into new dir if needed
Diffstat (limited to 'scripts')
-rwxr-xr-x | scripts/get-metadata.sh | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/scripts/get-metadata.sh b/scripts/get-metadata.sh index 71164cb6..16379681 100755 --- a/scripts/get-metadata.sh +++ b/scripts/get-metadata.sh @@ -68,7 +68,11 @@ entityid=`echo "$metadata" | sed -n 's/.*entityID=['\''"]\([^"]*\)['\''"].*/\1/p 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" - +OLDFILE=$(find ../swamid-testing ../swamid-2.0 ../swamid-edugain -name $entityidfn | grep -v $xmldir) +if [ -n "$OLDFILE" ]; then + echo "Moving $OLDFILE into $xmldir" + git mv $OLDFILE $entityidfn +fi [ -r "$entityidfn" ] && new=false || new=true if $new ; then echo -n "Save metadata into $entityidfn [Y/n]? " |