#!/bin/bash ### DO NOT EDIT THIS FILE source "$(dirname "${BASH_SOURCE[0]}")/../../includes/includes.sh" app_dir=$(cd "$(dirname "${BASH_SOURCE[0]}")/../../.." &> /dev/null && pwd) source "$app_dir/etc/config.sh" env="$(getArgument "$1" "Usage: fetch_files.sh [live|stage]" "live stage")" ssh_user="$(getConfig "$env" "ssh_user")" ssh_domain="$(getConfig "$env" "ssh_domain")" httpdocs_path="$(getConfig "$env" "httpdocs_path")" httpdocs_git_subpath="$(getConfig "$env" "httpdocs_git_subpath")" httpdocs_shopware_subpath="$(getConfig "$env" "httpdocs_shopware_subpath")" remote_path="$httpdocs_path$httpdocs_git_subpath$httpdocs_shopware_subpath" local_path="$app_dir/git/$project_name/$local_httpdocs_shopware_subpath" shared_path="$app_dir/shared/$project_name/$env" echoMainTitle "Fetching $env system files" for file in "${shared_files[@]}" do echo "Fetching files $file" addSSHKey "$env" scp "$ssh_user"@"$ssh_domain":"$remote_path/$file/." "$shared_path/$file/." if [ -f "$local_path/$file" ] then rm -rf "$local_path/$file" fi ln -s "$shared_path/$file" "$local_path/$file" done echoFinal "... files fetched" echo "Running postscript ..." postScript "$app_dir/bin/postscripts/function/fetch_files.sh"