From 6f1777b07236c42e2303eae00382c05e4399bc2f Mon Sep 17 00:00:00 2001 From: Matthias Schiffer Date: Fri, 11 Jul 2014 11:36:53 +0200 Subject: [PATCH] gluon-core: add platform utility module --- .../files/usr/lib/lua/gluon/platform.lua | 31 +++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 package/gluon-core/files/usr/lib/lua/gluon/platform.lua diff --git a/package/gluon-core/files/usr/lib/lua/gluon/platform.lua b/package/gluon-core/files/usr/lib/lua/gluon/platform.lua new file mode 100644 index 00000000..3d56f081 --- /dev/null +++ b/package/gluon-core/files/usr/lib/lua/gluon/platform.lua @@ -0,0 +1,31 @@ +local platform_info = require 'platform_info' +local util = require 'luci.util' + +local setmetatable = setmetatable + + +module 'gluon.platform' + +setmetatable(_M, + { + __index = platform_info, + } +) + +function match(target, subtarget, boards) + if get_target() ~= target then + return false + end + + if get_subtarget() ~= subtarget then + return false + end + + if not util.contains(boards, get_board_name()) then + return false + end + + return true +end + +