From 6c30d795fa2ed44e7b1cc2dd35fcbb1b196d26b4 Mon Sep 17 00:00:00 2001 From: Papa Dragon Date: Tue, 28 Feb 2023 19:22:07 +0100 Subject: [PATCH] We add a few variables to help clean things if the install fails --- contrib/autoinstall/autoinstall.sh | 4 ++++ contrib/autoinstall/scripts/debian.sh | 2 ++ 2 files changed, 6 insertions(+) diff --git a/contrib/autoinstall/autoinstall.sh b/contrib/autoinstall/autoinstall.sh index 6e50beeaf..721422e9b 100755 --- a/contrib/autoinstall/autoinstall.sh +++ b/contrib/autoinstall/autoinstall.sh @@ -142,6 +142,7 @@ function add_nginx_conf { print_info "adding nginx conf files" sed "s|SERVER_NAME|${domain_name}|g;s|INSTALL_PATH|${install_path}|g;s|SERVER_LOG|${domain_name}.log|;s|DOMAIN_CERT|${cert}|;s|CERT_KEY|${cert_key}|;" nginx-server.conf.template >> /etc/nginx/sites-available/${domain_name}.conf ln -s /etc/nginx/sites-available/${domain_name}.conf /etc/nginx/sites-enabled/ + nginx_conf=yes systemctl restart nginx } @@ -237,6 +238,7 @@ function create_website_db { Q4="FLUSH PRIVILEGES;" SQL="${Q1}${Q2}${Q3}${Q4}" mysql -uroot -e $opt_mysqlpass "$SQL" + db_installed=yes else die "database user named \"$website_db_user\" already exists..." fi @@ -328,6 +330,7 @@ function install_website { chown -R www-data:www-data $install_path chown root:www-data $install_path/ print_info "installed addons" + db_installed=yes } function configure_daily_update { @@ -344,6 +347,7 @@ function configure_daily_update { echo "chmod 0644 $install_path/.htaccess # www-data can read but not write it" >> /var/www/$daily_update fi chmod a+x /var/www/$daily_update + daily_update_exists=yes } function configure_cron_daily { diff --git a/contrib/autoinstall/scripts/debian.sh b/contrib/autoinstall/scripts/debian.sh index cdd2afa1a..2081f48b0 100644 --- a/contrib/autoinstall/scripts/debian.sh +++ b/contrib/autoinstall/scripts/debian.sh @@ -75,6 +75,7 @@ function add_vhost { echo " " >> "/etc/apache2/sites-available/${domain_name}.conf" echo "" >> "/etc/apache2/sites-available/${domain_name}.conf" a2ensite $domain_name + vhost_added=yes } function install_letsencrypt { @@ -103,6 +104,7 @@ function vhost_le { print_info "run certbot ..." certbot --apache -w $install_path -d $domain_name -m $le_email --agree-tos --non-interactive --redirect --hsts --uir service apache2 restart + vhost_le_confgured=yes } function install_mysql {