Select Git revision
init_symlinks.sh
init_symlinks.sh 4.22 KiB
#!/bin/bash
#
#
# Script d'initialisation d'un dépot vMap versionné sous git
#
# Split repo
# git subtree split -P module/ -b module_split_branch
#
# Add subtree
# git subtree add --prefix vmap "git@gitlab.veremes.net:Development/vitis_apps/sources/Vitis.git" master
#
#
echo -n "Existing app path (path/empty)? "
read APP_EXISTING_PATH
# Récupère la liste des dépendances
. ./get_deps.sh
cd ..
# Vitis
echo "---- Link vitis ----"
if ! [ -e "$(pwd)/client" ]; then
echo "---- Link vitis 2 ----"
ln -rsf src/vitis/client client
fi
if ! [ -e "$(pwd)/vas" ]; then
ln -rsf src/vitis/vas vas
fi
# Conf
echo "---- Link conf ----"
if ! [ -e "src/vitis/client/conf" ]; then
ln -rsf conf src/vitis/client/conf
fi
if ! [ -e "conf/closure" ]; then
ln -rsf src/closure/conf conf/closure
fi
# Modules
if [[ $depsCount > 0 ]]; then
for (( i=1; i <= $depsCount; i++ )); do
if [ ${aDeps[$i, nature]} == "modules" ]; then
if [ ${aDeps[$i, name]:0:7} == "module_" ]; then
module=${aDeps[$i, name]:7}
echo "---- Link module_${module} ----"
if [ -d "$(pwd)/src/module_${module}/module" ]; then
if ! [ -e "src/vitis/client/modules/${module}" ]; then
ln -rsf src/module_${module}/module src/vitis/client/modules/${module}
fi
fi
if [ -d "$(pwd)/src/module_${module}/web_service/ws" ]; then
if ! [ -e "src/vitis/vas/rest/ws/${module}" ]; then
ln -rsf src/module_${module}/web_service/ws src/vitis/vas/rest/ws/${module}
fi
fi
if [ -d "$(pwd)/src/module_${module}/web_service/conf" ]; then
if ! [ -e "src/vitis/vas/rest/conf/${module}" ]; then
ln -rsf src/module_${module}/web_service/conf src/vitis/vas/rest/conf/${module}
fi
fi
if [ -d "$(pwd)/src/module_${module}/web_service/sql" ]; then
if ! [ -e "src/vitis/vas/sql/${module}" ]; then
ln -rsf src/module_${module}/web_service/sql src/vitis/vas/sql/${module}
fi
fi
if [ -d "$(pwd)/src/module_${module}/web_service/class" ]; then
for class_dir in $( ls "$(pwd)/src/module_${module}/web_service/class"); do
if [ -d "$(pwd)/src/module_${module}/web_service/class/${class_dir}" ]; then
echo "---- Link module_${module}/${class_dir} ----"
if ! [ -e "src/vitis/vas/rest/class/${class_dir}" ]; then
ln -rsf src/module_${module}/web_service/class/${class_dir} src/vitis/vas/rest/class/${class_dir}
fi
fi
done
fi
fi
fi
done
# Utilisation d'une install déjà existante
if [ -d "${APP_EXISTING_PATH}" ]; then
echo "---- Link exixting app ${APP_EXISTING_PATH} ----"
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"
chmod 777 -R "$(pwd)/$folder_path"
fi
done
declare -a existing_files_path=("client/conf/properties.json"
"vas/rest/conf/properties.inc"
"vas/rest/conf/properties_domain.inc"
"vas/rest/conf/properties_post.inc"
"vas/rest/conf/properties_server.inc"
"vas/rest/conf/version.inc"
"vas/rest/.htaccess")
for file_path in "${existing_files_path[@]}"; do
if [ -f "${APP_EXISTING_PATH}/$file_path" ]; then
echo "copy $file_path"
cp -f "${APP_EXISTING_PATH}/$file_path" "$(pwd)/$file_path"
fi
done
for properties_dir in $( ls "${APP_EXISTING_PATH}/vas/rest/conf"); do
if [ -d "${APP_EXISTING_PATH}/vas/rest/conf/${properties_dir}" ]; then
if [ -d "$(pwd)/vas/rest/conf/${properties_dir}" ]; then
for properties_file in $( ls "${APP_EXISTING_PATH}/vas/rest/conf/${properties_dir}"); do
# if [ ${properties_file:0:10}=="properties" || ${properties_file}=="version.inc" ]; then
if [[ $properties_file == "properties"* ]] || [[ $properties_file == "version.inc" ]]; then
echo "copy vas/rest/conf/${properties_dir}/${properties_file}"
cp -f "${APP_EXISTING_PATH}/vas/rest/conf/${properties_dir}/${properties_file}" "$(pwd)/vas/rest/conf/${properties_dir}/${properties_file}"
fi
done
fi
fi
done
fi
fi