Minor improvements to scripts.

- Platform symlinking should support multiple system folders
- Always forcibly symlink a new resource

Change-Id: Id8f5d6419577a53663fda9b003aae386fe6376bc
Reviewed-on: https://git.eclipse.org/r/50565
Reviewed-by: Roland Grunberg <rgrunber@redhat.com>
Tested-by: Roland Grunberg <rgrunber@redhat.com>
diff --git a/dependencies/replace_platform_plugins_with_symlinks.sh b/dependencies/replace_platform_plugins_with_symlinks.sh
index 2e269d0..aec27a3 100755
--- a/dependencies/replace_platform_plugins_with_symlinks.sh
+++ b/dependencies/replace_platform_plugins_with_symlinks.sh
@@ -6,21 +6,20 @@
 
 set -e
 
-SCL_JAVA_DIR=$2
+SCL_JAVA_DIRS=${@:2}
 
 function _symlink {
 	_f=`ls | grep -e "^$1"`
 	rm -rf $_f
-	if [ -f ${SCL_JAVA_DIR}/$2  ]; then
-		echo "found ${SCL_JAVA_DIR}/$2"
-		ln -s ${SCL_JAVA_DIR}/$2 ${_f%.jar}.jar
-	elif [ -f /usr/share/java/$2 ]; then
-		echo "found /usr/share/java/$2"
-		ln -s /usr/share/java/$2 ${_f%.jar}.jar
-	else
-		echo "not found ${SCL_JAVA_DIR}/$2 or /usr/share/java/$2"
-		exit 1
-	fi
+	for SCL_JAVA_DIR in ${SCL_JAVA_DIRS}; do
+		if [ -f ${SCL_JAVA_DIR}/$2  ]; then
+			echo "found ${SCL_JAVA_DIR}/$2"
+			ln -s ${SCL_JAVA_DIR}/$2 ${_f%.jar}.jar
+			return 0
+		fi
+	done
+	echo "not found $2 in any of ${SCL_JAVADIRS}"
+	exit 1
 }
 
 pushd $1
diff --git a/testbundle-to-eclipse-test/gatherBundles.sh b/testbundle-to-eclipse-test/gatherBundles.sh
index a388f4e..4379357 100755
--- a/testbundle-to-eclipse-test/gatherBundles.sh
+++ b/testbundle-to-eclipse-test/gatherBundles.sh
@@ -32,15 +32,13 @@
 	      (cd $eclipse/dropins/$f/eclipse;
 				ls -d plugins/* features/* 2>/dev/null) |
 	      while read g; do
-		  [ ! -e $g ] && \
-		    ln -s $eclipse/dropins/$f/eclipse/$g $g
+		    ln -sf $eclipse/dropins/$f/eclipse/$g $g
 	      done
           else
 	      (cd $eclipse/dropins/$f;
 				ls -d plugins/* features/* 2>/dev/null) |
 	      while read g; do
-	          [ ! -e $g ] && \
-		    ln -s $eclipse/dropins/$f/$g $g
+		    ln -sf $eclipse/dropins/$f/$g $g
 	      done
           fi
       done
@@ -50,15 +48,13 @@
 	      (cd $datadir/dropins/$f/eclipse;
 				ls -d plugins/* features/* 2>/dev/null) |
 	      while read g; do
-		  [ ! -e $g ] && \
-		    ln -s $datadir/dropins/$f/eclipse/$g $g
+		    ln -sf $datadir/dropins/$f/eclipse/$g $g
 	      done
           else
 	      (cd $datadir/dropins/$f;
 				ls -d plugins/* features/* 2>/dev/null) |
 	      while read g; do
-	          [ ! -e $g ] && \
-		    ln -s $datadir/dropins/$f/$g $g
+		    ln -sf $datadir/dropins/$f/$g $g
 	      done
           fi
       done