You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
46 lines
1.5 KiB
46 lines
1.5 KiB
#!/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: clone_repo.sh [live|stage|local]" "live stage local")"
|
|
|
|
echoMainTitle "Cloning $env system repository"
|
|
|
|
is_remote=$(if [ "$env" == "live" ] || [ "$env" == "stage" ]; then echo 1; else echo 0; fi)
|
|
if [ "$is_remote" == "1" ]
|
|
then
|
|
addSSHKey "$env"
|
|
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")"
|
|
has_git="$(ssh "$ssh_user"@"ssh_domain" "[ -d \"$httpdocs_path$httpdocs_git_subpath/.git\" ] && echo 1 || echo 0")"
|
|
|
|
if [ "$has_git" == "1" ]
|
|
then
|
|
echoWarning "Git allready installed, aborting"
|
|
else
|
|
ssh "$ssh_user"@"ssh_domain" "cd $httpdocs_path$httpdocs_git_subpath && git clone \"$git_url\" ."
|
|
ssh "$ssh_user"@"ssh_domain" "cd $httpdocs_path$httpdocs_git_subpath && git config credential.helper store"
|
|
fi
|
|
fi
|
|
|
|
if [ "$is_remote" == "0" ]
|
|
then
|
|
has_git="$(if [ -d "$app_dir/git/$project_name" ]; then echo 1; else echo 0; fi)"
|
|
if [ "$has_git" == "1" ]
|
|
then
|
|
echoWarning "Git allready installed, aborting"
|
|
else
|
|
git clone "$git_url" "$app_dir/git/$project_name"
|
|
fi
|
|
fi
|
|
|
|
echoFinal "... git repository cloned"
|
|
|
|
echo "Running postscript ..."
|
|
postScript "$app_dir/bin/postscript/functions/clone_repo.sh"
|