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.
45 lines
1.6 KiB
45 lines
1.6 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: create_directories.sh [live|stage]" "live stage")"
|
|
|
|
echoMainTitle "Installing $env system directories"
|
|
|
|
addSSHKey "$env"
|
|
|
|
httpdocs_path="$(getConfig "$env" "httpdocs_path")"
|
|
httpdocs_git_subpath="$(getConfig "$env" "httpdocs_git_subpath")"
|
|
ssh_user="$(getConfig "$env" "ssh_user")"
|
|
ssh_domain="$(getConfig "$env" "ssh_domain")"
|
|
database_name="$(getConfig "$env" "database_name")"
|
|
|
|
has_httpdocs_path="$(ssh "$ssh_user"@"ssh_domain" "[ -d \"$httpdocs_path\" ] && echo 1 || echo 0")"
|
|
has_httpdocs_git_path="$(ssh "$ssh_user"@"ssh_domain" "[ -d \"$httpdocs$httpdocs_git_subpath\" ] && echo 1 || echo 0")"
|
|
|
|
if [ "$has_httpdocs" == "0" ]
|
|
then
|
|
create_httpdocs="$(readConsole "The $env System has no httpdocs ($httpdocs_path), should i create it [y,n]" "Invalid selection" "y n")"
|
|
if [ "$create_httpdocs" == "y" ]
|
|
then
|
|
ssh "$ssh_user"@"ssh_domain" "mkdir -p \"$httpdocs_path\""
|
|
fi
|
|
fi
|
|
|
|
if [ "$has_httpdocs_git_path" == "0" ]
|
|
then
|
|
create_git="$(readConsole "The $env System has no subpath to git directory ($httpdocs_path$httpdocs_git_path), should i create it [y,n]" "Invalid selection" "y n")"
|
|
if [ "$create_git" == "y" ]
|
|
then
|
|
ssh "$ssh_user"@"ssh_domain" "mkdir -p \"$httpdocs_path$httpdocs_git_subpath\""
|
|
fi
|
|
fi
|
|
|
|
echoFinal "... directories created"
|
|
|
|
echo "Running postscript ..."
|
|
postScript "$app_dir/bin/postscript//create_directories.sh"
|