diff --git a/BuildFiles/Packaging/templates/postinst-frontend.template b/BuildFiles/Packaging/templates/postinst-frontend.template index f76a32e9..da424d43 100644 --- a/BuildFiles/Packaging/templates/postinst-frontend.template +++ b/BuildFiles/Packaging/templates/postinst-frontend.template @@ -13,23 +13,22 @@ if [ ! -e /var/lib/swarmops/upload ]; then echo "Dialog branch was triggered (this is for debug purposes)" - dialog --menu "This seems to be a new installation of Swarmops Frontend on a newly installed Apache. Would you like to create the necessary site directives and make it the default Apache site?" 12 70 3 1 "No thanks, don't touch my Apache, that's for me alone" 2 "Yes please, make Swarmops the default site for port 80" 3 "Create a Swarmops config, please, but don't enable it" - dialog_return_value = $? + dialog_selection = $(dialog --title "Autoconfigure Apache?" --menu "This seems to be a new installation of Swarmops Frontend on a newly installed Apache. Would you like to create the necessary site directives and make it the default Apache site?" 0 0 3 1 "No thanks, don't touch my Apache, that's for me alone" 2 "Yes please, make Swarmops the default site for port 80" 3 "Create a Swarmops config, please, but don't enable it" 2>&1 1>&3) - case "$dialog_return_value" in - 1) echo "Neither reconfiguring Apache nor creating configuration file." - ;; - 2) echo "Disabling site 000-default; creating/enabling site 000-swarmops." - a2dissite 000-default - cp /usr/share/swarmops/frontend/apache-default-config.txt /etc/apache2/sites-available/000-swarmops.conf - a2ensite 000-swarmops - /etc/init.d/apache2 force-reload - ;; - 3) echo "Creating but not enabling 000-swarmops." - cp /usr/share/swarmops/frontend/apache-default-config.txt /etc/apache2/sites-available/000-swarmops.conf - ;; - *) echo "Unknown return code - $dialog_return_value" - ;; + case "$dialog_selection" in + 1 ) echo "Neither reconfiguring Apache nor creating configuration file." + ;; + 2 ) echo "Disabling site 000-default; creating/enabling site 000-swarmops." + a2dissite 000-default + cp /usr/share/swarmops/frontend/apache-default-config.txt /etc/apache2/sites-available/000-swarmops.conf + a2ensite 000-swarmops + /etc/init.d/apache2 force-reload + ;; + 3 ) echo "Creating but not enabling 000-swarmops." + cp /usr/share/swarmops/frontend/apache-default-config.txt /etc/apache2/sites-available/000-swarmops.conf + ;; + * ) echo "Unknown return code - $dialog_selection" + ;; esac