gluon-core: add platform utility module
This commit is contained in:
parent
1a52c6bdf2
commit
6f1777b072
31
package/gluon-core/files/usr/lib/lua/gluon/platform.lua
Normal file
31
package/gluon-core/files/usr/lib/lua/gluon/platform.lua
Normal file
@ -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
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user