From 7aaf31c2312a98ae4dae5389d64c260ea21b1738 Mon Sep 17 00:00:00 2001 From: nachoparker Date: Wed, 29 Nov 2017 18:40:42 +0100 Subject: nc-import: fix ncp-web appearing to fail when activating options that restart httpd --- etc/nextcloudpi-config.d/letsencrypt.sh | 2 +- etc/nextcloudpi-config.d/modsecurity.sh | 2 +- etc/nextcloudpi-config.d/nc-httpsonly.sh | 2 +- etc/nextcloudpi-config.d/nc-import-ncp.sh | 10 ++++++++++ etc/nextcloudpi-config.d/nc-webui.sh | 2 +- 5 files changed, 14 insertions(+), 4 deletions(-) diff --git a/etc/nextcloudpi-config.d/letsencrypt.sh b/etc/nextcloudpi-config.d/letsencrypt.sh index 2129f818..0c7d3fa7 100644 --- a/etc/nextcloudpi-config.d/letsencrypt.sh +++ b/etc/nextcloudpi-config.d/letsencrypt.sh @@ -78,7 +78,7 @@ configure() sudo -u www-data php $OCC config:system:set overwrite.cli.url --value=https://$DOMAIN_ # delayed in bg so it does not kill the connection, and we get AJAX response - bash -c "sleep 2 && service apache2 restart" &>/dev/null & + bash -c "sleep 2 && service apache2 reload" &>/dev/null & rm -rf $NCDIR/.well-known return 0 } diff --git a/etc/nextcloudpi-config.d/modsecurity.sh b/etc/nextcloudpi-config.d/modsecurity.sh index 2a88dcf6..ec86bc38 100644 --- a/etc/nextcloudpi-config.d/modsecurity.sh +++ b/etc/nextcloudpi-config.d/modsecurity.sh @@ -102,7 +102,7 @@ EOF [[ $ACTIVE_ == "yes" ]] && a2enmod security2 &>/dev/null || a2dismod security2 &>/dev/null # delayed in bg so it does not kill the connection, and we get AJAX response - bash -c "sleep 2 && service apache2 restart" &>/dev/null & + bash -c "sleep 2 && service apache2 reload" &>/dev/null & } # License diff --git a/etc/nextcloudpi-config.d/nc-httpsonly.sh b/etc/nextcloudpi-config.d/nc-httpsonly.sh index f36f94f8..d015bc46 100644 --- a/etc/nextcloudpi-config.d/nc-httpsonly.sh +++ b/etc/nextcloudpi-config.d/nc-httpsonly.sh @@ -24,7 +24,7 @@ configure() echo "Forcing HTTPS $OPT" # delayed in bg so it does not kill the connection, and we get AJAX response - bash -c "sleep 2 && service apache2 restart" &>/dev/null & + bash -c "sleep 2 && service apache2 reload" &>/dev/null & } install() { :; } diff --git a/etc/nextcloudpi-config.d/nc-import-ncp.sh b/etc/nextcloudpi-config.d/nc-import-ncp.sh index 5fda3538..afec2072 100644 --- a/etc/nextcloudpi-config.d/nc-import-ncp.sh +++ b/etc/nextcloudpi-config.d/nc-import-ncp.sh @@ -24,6 +24,10 @@ configure() mkdir -p "$TMP" tar -xf "$FILE_" -C "$TMP" + # UGLY workaround to prevent apache from restarting upon activating some extras + # which leads to the operation appearing to fail in ncp-web + echo "invalid_op" >> /etc/apache2/sites-available/000-default.conf + # restore configuration and activate for file in /"$TMP"/*; do local SCRIPT="$( basename "$file" .cfg ).sh" @@ -41,9 +45,15 @@ configure() grep -q "^ACTIVE_=yes" "$SCRIPT" && echo && activate_script "$SCRIPT" done + # Fix invalid configuration + sed -i "/^invalid_op/d" /etc/apache2/sites-available/000-default.conf + # cleanup rm -rf "$TMP" echo -e "\nconfiguration restored" + + # delayed in bg so it does not kill the connection, and we get AJAX response + bash -c "sleep 2 && service apache2 reload" &>/dev/null & } install() { :; } diff --git a/etc/nextcloudpi-config.d/nc-webui.sh b/etc/nextcloudpi-config.d/nc-webui.sh index 346f6833..e9709cdc 100644 --- a/etc/nextcloudpi-config.d/nc-webui.sh +++ b/etc/nextcloudpi-config.d/nc-webui.sh @@ -27,7 +27,7 @@ configure() fi # delayed in bg so it does not kill the connection, and we get AJAX response - bash -c "sleep 2 && service apache2 restart" &>/dev/null & + bash -c "sleep 2 && service apache2 reload" &>/dev/null & } install() { :; } -- cgit v1.2.3