From f8ced914cfa27f6130fc56e2bfdea4c5852ee464 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Linus=20L=C3=BCssing?= Date: Sat, 27 Jul 2019 07:40:26 +0200 Subject: [PATCH] gluon-mesh-batman-adv: introduce "BATMAN_IV_LEGACY" site setting This allows to set BATMAN_IV_LEGACY in the site.conf. --- package/gluon-mesh-batman-adv/check_site.lua | 23 +++++++++++++++++++- scripts/check_site.lua | 4 ++++ 2 files changed, 26 insertions(+), 1 deletion(-) diff --git a/package/gluon-mesh-batman-adv/check_site.lua b/package/gluon-mesh-batman-adv/check_site.lua index f5ea9fb4..9714cd57 100644 --- a/package/gluon-mesh-batman-adv/check_site.lua +++ b/package/gluon-mesh-batman-adv/check_site.lua @@ -2,4 +2,25 @@ need_boolean(in_domain({'mesh', 'vxlan'}), not this_domain()) need_number({'mesh', 'batman_adv', 'gw_sel_class'}, false) -need_one_of({'mesh', 'batman_adv', 'routing_algo'}, {'BATMAN_IV', 'BATMAN_V'}, false) +need_one_of({'mesh', 'batman_adv', 'routing_algo'}, {'BATMAN_IV', 'BATMAN_IV_LEGACY', 'BATMAN_V'}, false) + +local has_batman_adv = (os.execute('ls "$IPKG_INSTROOT"/lib/modules/*/batman-adv.ko >/dev/null 2>&1') == 0) +local has_batman_adv_legacy = (os.execute('ls "$IPKG_INSTROOT"/lib/modules/*/batman-adv-legacy.ko >/dev/null 2>&1') == 0) +local routing_algo = need_string({'mesh', 'batman_adv', 'routing_algo'}, false) +local path = conf_src({'mesh', 'batman_adv', 'routing_algo'}) + +if routing_algo == 'BATMAN_IV_LEGACY' then + if not has_batman_adv_legacy then + error(path .. " error: BATMAN_IV_LEGACY selected, but package 'gluon-mesh-batman-adv-14' was not", 0) + end +elseif routing_algo == 'BATMAN_V' then + if not has_batman_adv then + error(path .. " error: BATMAN_V selected, but package 'gluon-mesh-batman-adv-15' was not", 0) + end +else -- BATMAN_IV + if not has_batman_adv and has_batman_adv_legacy then + error(path .. " error: BATMAN_IV selected, but package 'gluon-mesh-batman-adv-15' was not (did you mean 'BATMAN_IV_LEGACY'?)", 0) + elseif not has_batman_adv then + error(path .. " error: BATMAN_IV selected, but package 'gluon-mesh-batman-adv-15' was not", 0) + end +end diff --git a/scripts/check_site.lua b/scripts/check_site.lua index 4e78437a..a13eccd1 100644 --- a/scripts/check_site.lua +++ b/scripts/check_site.lua @@ -121,6 +121,10 @@ local function conf_src(path) return src end +function M.conf_src(path) + return conf_src(path) +end + local function var_error(path, val, msg) local found = 'unset' if val ~= nil then