strongswan: add openwrt hotplug script handling
authorFlorian Eckert <fe@dev.tdt.de>
Thu, 5 Jul 2018 10:57:27 +0000 (12:57 +0200)
committerFlorian Eckert <fe@dev.tdt.de>
Mon, 16 Jul 2018 09:34:57 +0000 (11:34 +0200)
Ipsec user script (/etc/ipsec.user) now get called indirectly by openwrt
"/sbin/hotplug-call". So other packages could also install their scripts
in "/etc/hotplug.d/ipsec".

Signed-off-by: Florian Eckert <fe@dev.tdt.de>
net/strongswan/Makefile
net/strongswan/files/etc/hotplug.d/ipsec/01-user [new file with mode: 0644]
net/strongswan/patches/300-include-ipsec-hotplug.patch [new file with mode: 0644]
net/strongswan/patches/300-include-ipsec-user-script.patch [deleted file]

index 9ce093bf28b3d39d207d1c6e6d1ae97ebfe8b6fd..b770648d5dce3baf98ba58797fe7d0adfc3b66cd 100644 (file)
@@ -561,7 +561,9 @@ define Plugin/updown/install
        $(INSTALL_DIR) $(1)/usr/lib/ipsec/plugins
        $(CP) $(PKG_INSTALL_DIR)/usr/lib/ipsec/_updown $(1)/usr/lib/ipsec/
        $(CP) $(PKG_INSTALL_DIR)/usr/lib/ipsec/plugins/libstrongswan-updown.so $(1)/usr/lib/ipsec/plugins/
-       $(INSTALL_DIR) $(1)/etc
+       $(INSTALL_DIR) $(1)/etc/hotplug.d/ipsec
+       $(CP) ./files/etc/hotplug.d/ipsec/01-user \
+               $(1)/etc/hotplug.d/ipsec/01-user
 endef
 
 define Plugin/vici/install
diff --git a/net/strongswan/files/etc/hotplug.d/ipsec/01-user b/net/strongswan/files/etc/hotplug.d/ipsec/01-user
new file mode 100644 (file)
index 0000000..3d485c8
--- /dev/null
@@ -0,0 +1,7 @@
+#!/bin/sh
+
+[ -e "/etc/ipsec.user" ] && {
+       . /etc/ipsec.user "$2"
+}
+
+exit 0
diff --git a/net/strongswan/patches/300-include-ipsec-hotplug.patch b/net/strongswan/patches/300-include-ipsec-hotplug.patch
new file mode 100644 (file)
index 0000000..8e54050
--- /dev/null
@@ -0,0 +1,16 @@
+--- a/src/_updown/_updown.in
++++ b/src/_updown/_updown.in
+@@ -22,6 +22,13 @@
+ # that, and use the (left/right)updown parameters in ipsec.conf to make
+ # strongSwan use yours instead of this default one.
++# Add your custom commands to the file "/etc/ipsec.user". Other packages could
++# also install their scripts in the directory "/etc/hotplug.d/ipsec".
++# This files/scripts are executed by the openwrt hotplug functionality on
++# ipsec events.
++
++exec /sbin/hotplug-call ipsec "$1"
++
+ #      PLUTO_VERSION
+ #              indicates  what  version of this interface is being
+ #              used.  This document describes version  1.1.   This
diff --git a/net/strongswan/patches/300-include-ipsec-user-script.patch b/net/strongswan/patches/300-include-ipsec-user-script.patch
deleted file mode 100644 (file)
index 6835e02..0000000
+++ /dev/null
@@ -1,17 +0,0 @@
---- a/src/_updown/_updown.in
-+++ b/src/_updown/_updown.in
-@@ -16,11 +16,9 @@
- # or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- # for more details.
--# CAUTION:  Installing a new version of strongSwan will install a new
--# copy of this script, wiping out any custom changes you make.  If
--# you need changes, make a copy of this under another name, and customize
--# that, and use the (left/right)updown parameters in ipsec.conf to make
--# strongSwan use yours instead of this default one.
-+# Add your custom ip rules to the /etc/ipsec.user file if you need that functionality.
-+
-+[ -e /etc/ipsec.user ] && . /etc/ipsec.user "$1"
- #      PLUTO_VERSION
- #              indicates  what  version of this interface is being