Optional install directory
This commit is contained in:
parent
cc6ffc6c41
commit
a7e550ebc5
|
@ -41,6 +41,7 @@ app_node=
|
|||
app_onion_only=
|
||||
app_port=''
|
||||
app_daemon=
|
||||
app_dir=
|
||||
your_name=''
|
||||
your_email=''
|
||||
SHOW_ON_ABOUT=1
|
||||
|
@ -65,6 +66,7 @@ function show_help {
|
|||
echo $' -p --php [yes|no] Is this a PHP app?'
|
||||
echo $' -s --daemon [yes|no] Add a daemon'
|
||||
echo $' -d --database [mariadb|postgresql] Type of database'
|
||||
echo $' --dir [directory] Where to install to'
|
||||
echo ''
|
||||
exit 0
|
||||
}
|
||||
|
@ -128,6 +130,10 @@ do
|
|||
shift
|
||||
app_port="$1"
|
||||
;;
|
||||
--dir)
|
||||
shift
|
||||
app_dir="$1"
|
||||
;;
|
||||
*)
|
||||
# unknown option
|
||||
;;
|
||||
|
@ -340,8 +346,13 @@ echo " ${app_name_upper}_DOMAIN_NAME=\$(get_completion_param \"${app_name
|
|||
echo ' fi'
|
||||
echo ''
|
||||
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"
|
||||
echo " chown -R www-data:www-data /var/www/\${${app_name_upper}_DOMAIN_NAME}/htdocs"
|
||||
if [ ! $app_dir ]; then
|
||||
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 "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 ' fi'
|
||||
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 " suspend_site \${${app_name_upper}_DOMAIN_NAME}"
|
||||
echo ''
|
||||
|
@ -376,7 +391,11 @@ echo ' fi'
|
|||
echo " ${app_name_upper}_DOMAIN_NAME=\$(get_completion_param \"${app_name} domain\")"
|
||||
echo " if [ \$${app_name_upper}_DOMAIN_NAME ]; then"
|
||||
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 ''
|
||||
if [[ "$database_type" == "mariadb" || "$database_type" == "mysql" ]]; then
|
||||
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 ' fi'
|
||||
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 " suspend_site \${${app_name_upper}_DOMAIN_NAME}"
|
||||
echo ''
|
||||
|
@ -446,7 +469,11 @@ echo ' fi'
|
|||
echo " ${app_name_upper}_DOMAIN_NAME=\$(get_completion_param \"${app_name} domain\")"
|
||||
echo " if [ \$${app_name_upper}_DOMAIN_NAME ]; then"
|
||||
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 ''
|
||||
if [[ "$database_type" == "mariadb" || "$database_type" == "mysql" ]]; then
|
||||
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 /repos/${app_name} ]; then"
|
||||
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"
|
||||
echo " cd /var/www/\$${app_name_upper}_DOMAIN_NAME/htdocs"
|
||||
if [ ! $app_dir ]; then
|
||||
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 ' 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 ''
|
||||
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 ' exit 87525'
|
||||
echo ' fi'
|
||||
echo ' fi'
|
||||
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 " set_completion_param \"${app_name} commit\" \"\$${app_name_upper}_COMMIT\""
|
||||
echo ''
|
||||
|
@ -684,7 +728,11 @@ if [ $app_daemon ]; then
|
|||
echo " echo 'Type=simple' >> /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"
|
||||
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 'Restart=always' >> /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 'WantedBy=multi-user.target' >> /etc/systemd/system/${app_name}.service"
|
||||
echo " systemctl enable ${app_name}"
|
||||
if [ $app_dir ]; then
|
||||
echo " chown -R ${app_name}:${app_name} ${app_dir}"
|
||||
fi
|
||||
echo " systemctl start ${app_name}"
|
||||
fi
|
||||
echo ''
|
||||
|
|
Loading…
Reference in New Issue