Optional install directory
This commit is contained in:
parent
cc6ffc6c41
commit
a7e550ebc5
|
@ -41,6 +41,7 @@ app_node=
|
||||||
app_onion_only=
|
app_onion_only=
|
||||||
app_port=''
|
app_port=''
|
||||||
app_daemon=
|
app_daemon=
|
||||||
|
app_dir=
|
||||||
your_name=''
|
your_name=''
|
||||||
your_email=''
|
your_email=''
|
||||||
SHOW_ON_ABOUT=1
|
SHOW_ON_ABOUT=1
|
||||||
|
@ -65,6 +66,7 @@ function show_help {
|
||||||
echo $' -p --php [yes|no] Is this a PHP app?'
|
echo $' -p --php [yes|no] Is this a PHP app?'
|
||||||
echo $' -s --daemon [yes|no] Add a daemon'
|
echo $' -s --daemon [yes|no] Add a daemon'
|
||||||
echo $' -d --database [mariadb|postgresql] Type of database'
|
echo $' -d --database [mariadb|postgresql] Type of database'
|
||||||
|
echo $' --dir [directory] Where to install to'
|
||||||
echo ''
|
echo ''
|
||||||
exit 0
|
exit 0
|
||||||
}
|
}
|
||||||
|
@ -128,6 +130,10 @@ do
|
||||||
shift
|
shift
|
||||||
app_port="$1"
|
app_port="$1"
|
||||||
;;
|
;;
|
||||||
|
--dir)
|
||||||
|
shift
|
||||||
|
app_dir="$1"
|
||||||
|
;;
|
||||||
*)
|
*)
|
||||||
# unknown option
|
# unknown option
|
||||||
;;
|
;;
|
||||||
|
@ -340,8 +346,13 @@ echo " ${app_name_upper}_DOMAIN_NAME=\$(get_completion_param \"${app_name
|
||||||
echo ' fi'
|
echo ' fi'
|
||||||
echo ''
|
echo ''
|
||||||
echo ' # update to the next commit'
|
echo ' # update to the next commit'
|
||||||
echo " set_repo_commit /var/www/\$${app_name_upper}_DOMAIN_NAME/htdocs \"${app_name} commit\" \"\$${app_name_upper}_COMMIT\" \$${app_name_upper}_REPO"
|
if [ ! $app_dir ]; then
|
||||||
echo " chown -R www-data:www-data /var/www/\${${app_name_upper}_DOMAIN_NAME}/htdocs"
|
echo " set_repo_commit /var/www/\$${app_name_upper}_DOMAIN_NAME/htdocs \"${app_name} commit\" \"\$${app_name_upper}_COMMIT\" \$${app_name_upper}_REPO"
|
||||||
|
echo " chown -R www-data:www-data /var/www/\${${app_name_upper}_DOMAIN_NAME}/htdocs"
|
||||||
|
else
|
||||||
|
echo " set_repo_commit ${app_dir} \"${app_name} commit\" \"\$${app_name_upper}_COMMIT\" \$${app_name_upper}_REPO"
|
||||||
|
echo " chown -R ${app_name}:${app_name} ${app_dir}"
|
||||||
|
fi
|
||||||
echo '}'
|
echo '}'
|
||||||
echo ''
|
echo ''
|
||||||
echo "function backup_local_${app_name} {"
|
echo "function backup_local_${app_name} {"
|
||||||
|
@ -350,7 +361,11 @@ echo " if grep -q \"${app_name} domain\" \$COMPLETION_FILE; then"
|
||||||
echo " ${app_name_upper}_DOMAIN_NAME=\$(get_completion_param \"${app_name} domain\")"
|
echo " ${app_name_upper}_DOMAIN_NAME=\$(get_completion_param \"${app_name} domain\")"
|
||||||
echo ' fi'
|
echo ' fi'
|
||||||
echo ''
|
echo ''
|
||||||
echo " source_directory=/var/www/\${${app_name_upper}_DOMAIN_NAME}/htdocs"
|
if [ ! $app_dir ]; then
|
||||||
|
echo " source_directory=/var/www/\${${app_name_upper}_DOMAIN_NAME}/htdocs"
|
||||||
|
else
|
||||||
|
echo " source_directory=${app_dir}"
|
||||||
|
fi
|
||||||
echo ''
|
echo ''
|
||||||
echo " suspend_site \${${app_name_upper}_DOMAIN_NAME}"
|
echo " suspend_site \${${app_name_upper}_DOMAIN_NAME}"
|
||||||
echo ''
|
echo ''
|
||||||
|
@ -376,7 +391,11 @@ echo ' fi'
|
||||||
echo " ${app_name_upper}_DOMAIN_NAME=\$(get_completion_param \"${app_name} domain\")"
|
echo " ${app_name_upper}_DOMAIN_NAME=\$(get_completion_param \"${app_name} domain\")"
|
||||||
echo " if [ \$${app_name_upper}_DOMAIN_NAME ]; then"
|
echo " if [ \$${app_name_upper}_DOMAIN_NAME ]; then"
|
||||||
echo " temp_restore_dir=/root/temp${app_name}"
|
echo " temp_restore_dir=/root/temp${app_name}"
|
||||||
echo " ${app_name}_dir=/var/www/\${${app_name_upper}_DOMAIN_NAME}/htdocs"
|
if [ ! $app_dir ]; then
|
||||||
|
echo " ${app_name}_dir=/var/www/\${${app_name_upper}_DOMAIN_NAME}/htdocs"
|
||||||
|
else
|
||||||
|
echo " ${app_name}_dir=${app_dir}"
|
||||||
|
fi
|
||||||
echo ''
|
echo ''
|
||||||
if [[ "$database_type" == "mariadb" || "$database_type" == "mysql" ]]; then
|
if [[ "$database_type" == "mariadb" || "$database_type" == "mysql" ]]; then
|
||||||
echo " ${app_name}_create_database"
|
echo " ${app_name}_create_database"
|
||||||
|
@ -420,7 +439,11 @@ echo " if grep -q \"${app_name} domain\" \$COMPLETION_FILE; then"
|
||||||
echo " ${app_name_upper}_DOMAIN_NAME=\$(get_completion_param \"${app_name} domain\")"
|
echo " ${app_name_upper}_DOMAIN_NAME=\$(get_completion_param \"${app_name} domain\")"
|
||||||
echo ' fi'
|
echo ' fi'
|
||||||
echo ''
|
echo ''
|
||||||
echo " source_directory=/var/www/\${${app_name_upper}_DOMAIN_NAME}/htdocs"
|
if [ ! $app_dir ]; then
|
||||||
|
echo " source_directory=/var/www/\${${app_name_upper}_DOMAIN_NAME}/htdocs"
|
||||||
|
else
|
||||||
|
echo " source_directory=${app_dir}"
|
||||||
|
fi
|
||||||
echo ''
|
echo ''
|
||||||
echo " suspend_site \${${app_name_upper}_DOMAIN_NAME}"
|
echo " suspend_site \${${app_name_upper}_DOMAIN_NAME}"
|
||||||
echo ''
|
echo ''
|
||||||
|
@ -446,7 +469,11 @@ echo ' fi'
|
||||||
echo " ${app_name_upper}_DOMAIN_NAME=\$(get_completion_param \"${app_name} domain\")"
|
echo " ${app_name_upper}_DOMAIN_NAME=\$(get_completion_param \"${app_name} domain\")"
|
||||||
echo " if [ \$${app_name_upper}_DOMAIN_NAME ]; then"
|
echo " if [ \$${app_name_upper}_DOMAIN_NAME ]; then"
|
||||||
echo " temp_restore_dir=/root/temp${app_name}"
|
echo " temp_restore_dir=/root/temp${app_name}"
|
||||||
echo " ${app_name}_dir=/var/www/\${${app_name_upper}_DOMAIN_NAME}/htdocs"
|
if [ ! $app_dir ]; then
|
||||||
|
echo " ${app_name}_dir=/var/www/\${${app_name_upper}_DOMAIN_NAME}/htdocs"
|
||||||
|
else
|
||||||
|
echo " ${app_name}_dir=${app_dir}"
|
||||||
|
fi
|
||||||
echo ''
|
echo ''
|
||||||
if [[ "$database_type" == "mariadb" || "$database_type" == "mysql" ]]; then
|
if [[ "$database_type" == "mariadb" || "$database_type" == "mysql" ]]; then
|
||||||
echo " ${app_name}_create_database"
|
echo " ${app_name}_create_database"
|
||||||
|
@ -553,20 +580,37 @@ echo ' fi'
|
||||||
echo " if [ ! -d /var/www/\$${app_name_upper}_DOMAIN_NAME/htdocs ]; then"
|
echo " if [ ! -d /var/www/\$${app_name_upper}_DOMAIN_NAME/htdocs ]; then"
|
||||||
echo " if [ -d /repos/${app_name} ]; then"
|
echo " if [ -d /repos/${app_name} ]; then"
|
||||||
echo " mkdir /var/www/\$${app_name_upper}_DOMAIN_NAME/htdocs"
|
echo " mkdir /var/www/\$${app_name_upper}_DOMAIN_NAME/htdocs"
|
||||||
echo " cp -r -p /repos/${app_name}/. /var/www/\$${app_name_upper}_DOMAIN_NAME/htdocs"
|
if [ ! $app_dir ]; then
|
||||||
echo " cd /var/www/\$${app_name_upper}_DOMAIN_NAME/htdocs"
|
echo " cp -r -p /repos/${app_name}/. /var/www/\$${app_name_upper}_DOMAIN_NAME/htdocs"
|
||||||
|
echo " cd /var/www/\$${app_name_upper}_DOMAIN_NAME/htdocs"
|
||||||
|
else
|
||||||
|
echo " cp -r -p /repos/${app_name}/. ${app_dir}"
|
||||||
|
echo " cd ${app_dir}"
|
||||||
|
fi
|
||||||
echo ' git pull'
|
echo ' git pull'
|
||||||
echo ' else'
|
echo ' else'
|
||||||
echo " git_clone \$${app_name_upper}_REPO /var/www/\$${app_name_upper}_DOMAIN_NAME/htdocs"
|
if [ ! $app_dir ]; then
|
||||||
|
echo " git_clone \$${app_name_upper}_REPO /var/www/\$${app_name_upper}_DOMAIN_NAME/htdocs"
|
||||||
|
else
|
||||||
|
echo " git_clone \$${app_name_upper}_REPO ${app_dir}"
|
||||||
|
fi
|
||||||
echo ' fi'
|
echo ' fi'
|
||||||
echo ''
|
echo ''
|
||||||
echo " if [ ! -d /var/www/\$${app_name_upper}_DOMAIN_NAME/htdocs ]; then"
|
if [ ! $app_dir ]; then
|
||||||
|
echo " if [ ! -d /var/www/\$${app_name_upper}_DOMAIN_NAME/htdocs ]; then"
|
||||||
|
else
|
||||||
|
echo " if [ ! -d ${app_dir} ]; then"
|
||||||
|
fi
|
||||||
echo " echo \$'Unable to clone ${app_name} repo'"
|
echo " echo \$'Unable to clone ${app_name} repo'"
|
||||||
echo ' exit 87525'
|
echo ' exit 87525'
|
||||||
echo ' fi'
|
echo ' fi'
|
||||||
echo ' fi'
|
echo ' fi'
|
||||||
echo ''
|
echo ''
|
||||||
echo " cd /var/www/\$${app_name_upper}_DOMAIN_NAME/htdocs"
|
if [ ! $app_dir ]; then
|
||||||
|
echo " cd /var/www/\$${app_name_upper}_DOMAIN_NAME/htdocs"
|
||||||
|
else
|
||||||
|
echo " cd ${app_dir}"
|
||||||
|
fi
|
||||||
echo " git checkout \$${app_name_upper}_COMMIT -b \$${app_name_upper}_COMMIT"
|
echo " git checkout \$${app_name_upper}_COMMIT -b \$${app_name_upper}_COMMIT"
|
||||||
echo " set_completion_param \"${app_name} commit\" \"\$${app_name_upper}_COMMIT\""
|
echo " set_completion_param \"${app_name} commit\" \"\$${app_name_upper}_COMMIT\""
|
||||||
echo ''
|
echo ''
|
||||||
|
@ -684,7 +728,11 @@ if [ $app_daemon ]; then
|
||||||
echo " echo 'Type=simple' >> /etc/systemd/system/${app_name}.service"
|
echo " echo 'Type=simple' >> /etc/systemd/system/${app_name}.service"
|
||||||
echo " echo 'User=${app_name}' >> /etc/systemd/system/${app_name}.service"
|
echo " echo 'User=${app_name}' >> /etc/systemd/system/${app_name}.service"
|
||||||
echo " echo 'Group=${app_name}' >> /etc/systemd/system/${app_name}.service"
|
echo " echo 'Group=${app_name}' >> /etc/systemd/system/${app_name}.service"
|
||||||
echo " echo 'WorkingDirectory=TODO' >> /etc/systemd/system/${app_name}.service"
|
if [ ! $app_dir ]; then
|
||||||
|
echo " echo 'WorkingDirectory=TODO' >> /etc/systemd/system/${app_name}.service"
|
||||||
|
else
|
||||||
|
echo " echo 'WorkingDirectory=${app_dir}' >> /etc/systemd/system/${app_name}.service"
|
||||||
|
fi
|
||||||
echo " echo 'ExecStart=TODO' >> /etc/systemd/system/${app_name}.service"
|
echo " echo 'ExecStart=TODO' >> /etc/systemd/system/${app_name}.service"
|
||||||
echo " echo 'Restart=always' >> /etc/systemd/system/${app_name}.service"
|
echo " echo 'Restart=always' >> /etc/systemd/system/${app_name}.service"
|
||||||
echo " echo 'Environment=\"USER=${app_name}\"' >> /etc/systemd/system/${app_name}.service"
|
echo " echo 'Environment=\"USER=${app_name}\"' >> /etc/systemd/system/${app_name}.service"
|
||||||
|
@ -692,6 +740,9 @@ if [ $app_daemon ]; then
|
||||||
echo " echo '[Install]' >> /etc/systemd/system/${app_name}.service"
|
echo " echo '[Install]' >> /etc/systemd/system/${app_name}.service"
|
||||||
echo " echo 'WantedBy=multi-user.target' >> /etc/systemd/system/${app_name}.service"
|
echo " echo 'WantedBy=multi-user.target' >> /etc/systemd/system/${app_name}.service"
|
||||||
echo " systemctl enable ${app_name}"
|
echo " systemctl enable ${app_name}"
|
||||||
|
if [ $app_dir ]; then
|
||||||
|
echo " chown -R ${app_name}:${app_name} ${app_dir}"
|
||||||
|
fi
|
||||||
echo " systemctl start ${app_name}"
|
echo " systemctl start ${app_name}"
|
||||||
fi
|
fi
|
||||||
echo ''
|
echo ''
|
||||||
|
|
Loading…
Reference in New Issue