From efc34e8501800158908ab1e73f66751b61571286 Mon Sep 17 00:00:00 2001 From: Rob White Date: Thu, 26 Apr 2018 11:51:23 +0100 Subject: [PATCH] nodogsplash2: Add NDS Restart Hook for Firewall nodogsplash2: Add NDS Restart Hook for Firewall NodogSplash iptables entries are overwritten if the OpenWrt Firewall is restarted. This change adds a restart hook to firewall.user to restart NodogSplash if Firewall is restarted. Author-name: Rob White Signed-off-by: Rob White rob@blue-wave.net --- nodogsplash2/files/nodogsplash.init | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/nodogsplash2/files/nodogsplash.init b/nodogsplash2/files/nodogsplash.init index 32dc1eb..168007f 100755 --- a/nodogsplash2/files/nodogsplash.init +++ b/nodogsplash2/files/nodogsplash.init @@ -251,6 +251,26 @@ create_instance() { start_service() { include /lib/functions + if ! uci get firewall.nodogsplash2.path &> /dev/null ; then + if [ -f '/etc/nodogsplash/ndshook.sh' ] ; then + rm /etc/nodogsplash/ndshook.sh + fi + uci delete firewall.nodogsplash2 2> /dev/null + uci set firewall.nodogsplash2=include + uci set firewall.nodogsplash2.type=script + uci set firewall.nodogsplash2.path='/etc/nodogsplash/ndshook.sh' + uci commit firewall + /etc/init.d/firewall restart 2>&1 | logger + fi + + if [ ! -f '/etc/nodogsplash/ndshook.sh' ] ; then + printf "#NDS Restart Hook Created by Nodogsplash. Do not modify.\n" > /etc/nodogsplash/ndshook.sh + printf " if /usr/bin/ndsctl status > /dev/null; then\n" >> /etc/nodogsplash/ndshook.sh + printf " echo \" * Restarting NodogSplash \"\n" >> /etc/nodogsplash/ndshook.sh + printf " /etc/init.d/nodogsplash restart\n fi\n" >> /etc/nodogsplash/ndshook.sh + chmod +x /etc/nodogsplash/ndshook.sh + fi + mkdir -p /tmp/etc/ config_load nodogsplash