From b016cf18b495f451cbdef5bb512fc40a02cad085 Mon Sep 17 00:00:00 2001 From: Matthias Schiffer Date: Fri, 10 Mar 2017 19:10:01 +0100 Subject: [PATCH] gluon-mesh-vpn-core: add code for migration of enabled state between fastd and tunneldigger Based-on-patch-by: Cyrus Fox --- .../luasrc/lib/gluon/upgrade/400-mesh-vpn | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/package/gluon-mesh-vpn-core/luasrc/lib/gluon/upgrade/400-mesh-vpn b/package/gluon-mesh-vpn-core/luasrc/lib/gluon/upgrade/400-mesh-vpn index 36929b95..7d4b0b2c 100755 --- a/package/gluon-mesh-vpn-core/luasrc/lib/gluon/upgrade/400-mesh-vpn +++ b/package/gluon-mesh-vpn-core/luasrc/lib/gluon/upgrade/400-mesh-vpn @@ -58,3 +58,19 @@ uci:section('firewall', 'include', 'mesh_vpn_dns', { }) uci:save('firewall') + + +-- VPN migration +local has_fastd = fs.access('/lib/gluon/mesh-vpn/fastd') +local fastd_enabled = has_fastd and uci:get_bool("fastd", "mesh_vpn", "enabled") + +local has_tunneldigger = fs.access('/lib/gluon/mesh-vpn/tunneldigger') +local tunneldigger_enabled = has_fastd and uci:get_bool("tunneldigger", "mesh_vpn", "enabled") + +local enabled = fastd_enabled or tunneldigger_enabled or false + +uci:set("fastd", "mesh_vpn", "enabled", has_fastd and enabled) +uci:save("fastd") + +uci:set("tunneldigger", "mesh_vpn", "enabled", has_tunneldigger and enabled) +uci:save("tunneldigger")