#!/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: import_media.sh [live|stage] /path/to/files" "live stage") filepath=$(getArgument "$2" "Usage: import_media.sh [live|stage] /path/to/files" true) echo echoMainTitle "Fetching $filepath files from $env" addSSHKey "$env" ssh_user="$(eval "echo \$${env}_ssh_user")" ssh_domain="$(eval "echo \$${env}_ssh_domain")" slug="$(eval "echo \"\$local_${env}_slug\"")" source="$(eval "echo \"\$${env}_httpdocs_path\$${env}_httpdocs_slug\$filepath/.\"")" target="$app_dir/shared/$project_name/$env$filepath" link="$app_dir/git/${project_name}${slug}${filepath}/." echo echo "Fetch Files ..." rsync -auvzqLK --delete "$ssh_user"@"$ssh_domain":"$source" "$target" if [ -f "$link" ] then rm -rf "$link" fi ln -s "$target" "$link" postScript "$app_dir/bin/postscripts/import_media.sh" echo