From 5208ecb081fdbb382a56c03aee168a18f93f5c0d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Maciej=20Kr=C3=BCger?= Date: Sun, 19 Dec 2021 10:32:56 +0100 Subject: [PATCH] static-ip: properly get if things are enabled --- .../luasrc/lib/gluon/upgrade/240-static-ip | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/package/gluon-static-ip/luasrc/lib/gluon/upgrade/240-static-ip b/package/gluon-static-ip/luasrc/lib/gluon/upgrade/240-static-ip index 440f5c46..da097f02 100755 --- a/package/gluon-static-ip/luasrc/lib/gluon/upgrade/240-static-ip +++ b/package/gluon-static-ip/luasrc/lib/gluon/upgrade/240-static-ip @@ -85,10 +85,19 @@ local function apply_network(name, use, mac) static_ip_4(name, uci:get('network', name, 'ifname'), macaddr, use) end --- TODO: get actual enabled value from options -apply_network('mesh_wan', nil, 10) -apply_network('mesh_lan', nil, 11) -apply_network('mesh_vpn', nil, 7) +if pcall(function() require 'gluon.mesh-vpn' end) then + local vpn_core = require 'gluon.mesh-vpn' + + apply_network('mesh_vpn', vpn_core.enabled(), 7) +end + +local wan_mesh = not uci:get_bool('network', 'mesh_wan', 'disabled') +apply_network('mesh_wan', wan_mesh, 10) + +if uci:get('network', 'mesh_lan', 'proto') then + local lan_mesh = not uci:get_bool('network', 'mesh_lan', 'disabled') + apply_network('mesh_lan', lan_mesh, 11) +end uci:save('gluon-static-ip') uci:save('network')