The UCI section 'ipsec' should only be available once, as these are
general settings for 'strongswan.conf'. It makes no sense to configure them
more than once. To ensure that the general settings can also be configured
via LuCI, this section must be present at least once.
For configurations already in the field, a uci-default script is added
that assigns the name 'globals' to the last ipsec section type.
Signed-off-by: Florian Eckert <redacted>
$(INSTALL_BIN) ./files/swanctl.init $(1)/etc/init.d/swanctl
$(INSTALL_DIR) $(1)/etc/config
$(INSTALL_CONF) ./files/ipsec.config $(1)/etc/config/ipsec
+
+ # Install migration from 'ipsec@ipsec[-1]' to 'ipsec.globals'
+ $(INSTALL_DIR) $(1)/etc/uci-defaults
+ $(INSTALL_DATA) ./files/etc/uci-defaults/strongswan \
+ $(1)/etc/uci-defaults/strongswan
endef
define Package/strongswan-gencerts/install
--- /dev/null
+#!/bin/sh
+
+main() {
+ # Skip migration if the 'globals' section already exists
+ uci show ipsec.globals 1>/dev/null 2>/dev/null
+ [ "$?" = "0" ] && return
+
+ # Rename last ipsec section to 'globals'
+ uci -q rename ipsec.@ipsec[-1]=globals
+ uci -q commit ipsec
+}
+
+main
+
+exit 0
# For strongSwan ipsec config documentation see
# https://openwrt.org/docs/guide-user/services/vpn/strongswan/start
+
+# This is the 'globals' config section for the 'strongswan.conf' file.
+# For LuCI the section type ipsec should only appear once. It must therefore
+# always be present and should not be added or removed manually.
+config ipsec 'globals'