Yet^6 another bugfix to pre/postinst script

This commit is contained in:
Rick Falkvinge
2016-03-15 21:56:07 +01:00
parent a048e22218
commit 4c9be33d3f
2 changed files with 12 additions and 8 deletions
@@ -8,11 +8,13 @@ if [ ! -e /var/lib/swarmops/upload ]; then
chown www-data:www-data /var/lib/swarmops/upload
chmod 777 /var/lib/swarmops/upload
# If there's only 000-default in apache sites, assume new install
# # If there's only 000-default in apache sites, assume new install
if [ "$(ls -l /etc/apache2/sites-enabled/ | wc -l)" = "2" ]; then
if "$(ls -l /etc/apache2/sites-enabled/ | wc -l)" = "2" ; then
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)
exec 3>&1;
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);
exec 3>&-;
case "$dialog_selection" in
1 ) echo "Neither reconfiguring Apache nor creating configuration file."
@@ -22,7 +24,7 @@ if [ ! -e /var/lib/swarmops/upload ]; then
cp /usr/share/swarmops/frontend/apache-default-config.txt /etc/apache2/sites-available/000-swarmops.conf
a2ensite 000-swarmops
# Forcing a stop/start cycle because of install dependency fuckups
# # Forcing a stop/start cycle because of install dependency fuckups
/etc/init.d/apache2 stop
/etc/init.d/apache2 start
@@ -5,10 +5,12 @@
# installer to just bloody hang.)
if [ ! -e /etc/swarmops/database.config ]; then
if /etc/init.d/apache2 status > /dev/null; then
# Set a flag to postinst to restart Apache
echo foo > /tmp/swarmops-restart-apache.flag
/etc/init.d/apache2 stop
if [ ! -e /etc/init.d/apache2 ]; then
if /etc/init.d/apache2 status > /dev/null; then
# Set a flag to postinst to restart Apache
echo foo > /tmp/swarmops-restart-apache.flag
/etc/init.d/apache2 stop
fi
fi
fi