Blob Blame History Raw
From 490aaafc9593a150316ea500f6fe9888562f84e5 Mon Sep 17 00:00:00 2001
From: Lubomir Rintel <lkundrak@v3.sk>
Date: Thu, 22 Aug 2019 17:21:50 +0200
Subject: [PATCH] Move the NetworkManager dispatcher script out of /etc

It's not user configuration and shouldn't ever have been there. Except for that
it used to be the only location NetworkManager looked into. With NetworkManager
1.20 that is no longer the case and the dispatcher scripts can be moved to
/usr/lib.
---
 install.sh          | 8 ++++----
 shorewall-init.spec | 6 +++---
 uninstall.sh        | 2 +-
 3 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/install.sh b/install.sh
index d848ac5..1f8cd42 100755
--- a/install.sh
+++ b/install.sh
@@ -389,7 +389,7 @@ else
 		# Not implemented on OpenWRT
 		/bin/true
 	    else
-		make_parent_directory ${DESTDIR}/${ETC}/NetworkManager/dispatcher.d 0755
+		make_parent_directory ${DESTDIR}${PREFIX}/lib/NetworkManager/dispatcher.d 0755
 	    fi
 	fi
     fi
@@ -416,9 +416,9 @@ if [ $HOST != openwrt ]; then
     install_file ifupdown ${DESTDIR}${LIBEXECDIR}/$PRODUCT/ifupdown 0544
 fi
 
-if [ -d ${DESTDIR}/etc/NetworkManager ]; then
-    [ $configure -eq 1 ] || make_parent_directory ${DESTDIR}${CONFDIR}/NetworkManager/dispatcher.d 0755
-    install_file ifupdown ${DESTDIR}${ETC}/NetworkManager/dispatcher.d/01-shorewall 0544
+if [ -d ${DESTDIR}${PREFIX}/lib/NetworkManager ]; then
+    [ $configure -eq 1 ] || make_parent_directory ${DESTDIR}${PREFIX}/lib/NetworkManager/dispatcher.d 0755
+    install_file ifupdown ${DESTDIR}${PREFIX}/lib/NetworkManager/dispatcher.d/01-shorewall 0544
 fi
 
 case $HOST in
diff --git a/shorewall-init.spec b/shorewall-init.spec
index b2ef290..7f56648 100644
--- a/shorewall-init.spec
+++ b/shorewall-init.spec
@@ -92,8 +92,8 @@ else
 	fi
     fi
 
-    if [ -d /etc/NetworkManager/dispatcher.d/ ]; then
-	cp -pf %{_libexecdir}/shorewall-init/ifupdown /etc/NetworkManager/dispatcher.d/01-shorewall
+    if [ -d %{_prefix}/lib/NetworkManager/dispatcher.d/ ]; then
+	cp -pf %{_libexecdir}/shorewall-init/ifupdown %{_prefix}/lib/NetworkManager/dispatcher.d/01-shorewall
     fi
 fi
 
@@ -116,7 +116,7 @@ if [ $1 -eq 0 ]; then
     [ -f /etc/ppp/ip-up.local ]   && grep -q Shorewall-based /etc/ppp/ip-up.local   && rm -f /etc/ppp/ip-up.local
     [ -f /etc/ppp/ip-down.local ] && grep -q Shorewall-based /etc/ppp/ip-down.local && rm -f /etc/ppp/ip-down.local
 
-    rm -f /etc/NetworkManager/dispatcher.d/01-shorewall
+    rm -f %{_prefix}/lib/NetworkManager/dispatcher.d/01-shorewall
 fi
 
 %files
diff --git a/uninstall.sh b/uninstall.sh
index abd842e..f7ef628 100755
--- a/uninstall.sh
+++ b/uninstall.sh
@@ -177,7 +177,7 @@ fi
 remove_file ${CONFDIR}/default/$PRODUCT
 remove_file ${CONFDIR}/sysconfig/$PRODUCT
 
-remove_file ${CONFDIR}/NetworkManager/dispatcher.d/01-shorewall
+remove_file ${PREFIX}/lib/NetworkManager/dispatcher.d/01-shorewall
 
 remove_file ${CONFDIR}/network/if-up.d/shorewall
 remove_file ${CONFDIR}/network/if-down.d/shorewall
-- 
2.23.0