make script for updating composite sites more robust

Change-Id: I4c87c75cf59e695a431d9cddac3b0ebcf40e5d6c
diff --git a/org.eclipse.mylyn-downloads/update-repositories.sh b/org.eclipse.mylyn-downloads/update-repositories.sh
index 9eed532..5286d3c 100755
--- a/org.eclipse.mylyn-downloads/update-repositories.sh
+++ b/org.eclipse.mylyn-downloads/update-repositories.sh
@@ -5,7 +5,15 @@
 BASEDIR=$(cd $(dirname $0) && pwd)
 TARGET=/home/data/httpd/download.eclipse.org/mylyn
 
-cp -r snapshots releases $TARGET
+cp -R $BASEDIR/snapshots $BASEDIR/releases $TARGET
 
 cd $TARGET
 $BASEDIR/update-composite.sh -r
+
+cd $TARGET
+for i in $(find -name composite.index); do
+  for j in $(dirname $i)/*.xml $(dirname $i)/*.index; do
+    [ -O $j ] && chgrp mylyn $j || true
+    [ -O $j ] && chmod g+rw $j || true 
+  done
+done