From cdd6388c6fa3d4c2cca8dd85360a27ba143a574f Mon Sep 17 00:00:00 2001
From: ArmandBahi <armand.bahi@veremes.com>
Date: Mon, 15 Oct 2018 17:41:13 +0200
Subject: [PATCH] Utilisation d'une install existante

---
 .gitignore             |  7 +++++++
 utils/init_symlinks.sh | 38 +++++++++++++++++++++++++-------------
 2 files changed, 32 insertions(+), 13 deletions(-)

diff --git a/.gitignore b/.gitignore
index d0b4bc85..9f77b819 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,6 +1,13 @@
 client
 vas
 conf/closure
+conf/properties.json
+src/vitis/vas/log/
+src/vitis/vas/public/
+src/vitis/vas/server/
+src/vitis/vas/ws_data/
+src/vitis/vas/tmp/
+src/vitis/vas/rest/.htaccess
 src/vitis/client/conf
 src/vitis/client/modules/vmap
 src/vitis/vas/rest/ws/vmap
diff --git a/utils/init_symlinks.sh b/utils/init_symlinks.sh
index ef5fd4d9..7de78fe7 100755
--- a/utils/init_symlinks.sh
+++ b/utils/init_symlinks.sh
@@ -83,20 +83,32 @@ if [[ $depsCount > 0 ]]; then
 	if [ -d "${APP_EXISTING_PATH}" ]; then
 		echo "---- Link exixting app ${APP_EXISTING_PATH} ----"
 
-		existing_folders_path[0]="vas/server"
-		existing_folders_path[1]="vas/log"
-		existing_folders_path[2]="vas/public"
-		existing_folders_path[3]="vas/shared"
-		existing_folders_path[4]="vas/tmp"
-		existing_folders_path[5]="vas/upload"
-		existing_folders_path[6]="vas/ws_data"
+		declare -a existing_folders_path=("vas/server"
+		                "vas/log"
+						"vas/public"
+						"vas/shared"
+						"vas/tmp"
+						"vas/upload"
+		                "vas/ws_data")
+		for folder_path in "${existing_folders_path[@]}"; do
+			if [ -d "${APP_EXISTING_PATH}/$folder_path" ]; then
+				echo "copy $folder_path"
+				cp -Rf "${APP_EXISTING_PATH}/$folder_path" "$(pwd)/$folder_path"
+			fi
+		done
+
+		file_path="client/conf/properties.json"
+		if [ -f "${APP_EXISTING_PATH}/$file_path" ]; then
+			echo "copy $file_path"
+			cp -f "${APP_EXISTING_PATH}/$file_path" "$(pwd)/$file_path"
+		fi
 
-		existing_folders_path[8]="vas/rest/conf"
-		file_existing_path[0]="client/conf/properties.json"
-		file_existing_path[1]="vas/rest/.htaccess"
+		file_path="vas/rest/.htaccess"
+		if [ -f "${APP_EXISTING_PATH}/$file_path" ]; then
+			echo "copy $file_path"
+			cp -f "${APP_EXISTING_PATH}/$file_path" "$(pwd)/$file_path"
+		fi
+		# file_existing_path[2]="vas/rest/conf"
 
-		# for i in "${arrayName[@]}" do
-		#
-		# done
 	fi
 fi
-- 
GitLab