Skip to content

Commit

Permalink
nc-import: fix ncp-web appearing to fail when activating options that…
Browse files Browse the repository at this point in the history
… restart httpd
  • Loading branch information
nachoparker committed Nov 29, 2017
1 parent 1e2de68 commit 7aaf31c
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 4 deletions.
2 changes: 1 addition & 1 deletion etc/nextcloudpi-config.d/letsencrypt.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down
2 changes: 1 addition & 1 deletion etc/nextcloudpi-config.d/modsecurity.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion etc/nextcloudpi-config.d/nc-httpsonly.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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() { :; }
Expand Down
10 changes: 10 additions & 0 deletions etc/nextcloudpi-config.d/nc-import-ncp.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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() { :; }
Expand Down
2 changes: 1 addition & 1 deletion etc/nextcloudpi-config.d/nc-webui.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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() { :; }
Expand Down

0 comments on commit 7aaf31c

Please sign in to comment.