lua-platform-info: x86-generic: add image type detection

This commit is contained in:
Matthias Schiffer 2015-03-15 19:39:35 +01:00
parent f221d17e1c
commit d9b982d5df
1 changed files with 22 additions and 5 deletions

View File

@ -8,30 +8,47 @@ for line in io.lines('/proc/cpuinfo') do
end end
local image_name = 'x86-generic'
local f = io.open('/sys/class/dmi/id/sys_vendor')
if f then
local vendor = f:read('*line')
f:close()
if vendor then
if vendor:match('^VMware') or vendor:match('^VMW') then
image_name = 'x86-vmware'
elseif vendor:match('^innotek GmbH') then
image_name = 'x86-virtualbox'
end
end
end
module 'platform_info' module 'platform_info'
-- The OpenWrt target -- The OpenWrt target
function get_target() function get_target()
return 'x86' return 'x86'
end end
-- The OpenWrt subtarget or nil -- The OpenWrt subtarget or nil
function get_subtarget() function get_subtarget()
return 'generic' return 'generic'
end end
-- The board name -- The board name
function get_board_name() function get_board_name()
return nil return nil
end end
-- The model name -- The model name
function get_model() function get_model()
return model return model
end end
-- The image name for sysupgrades -- The image name for sysupgrades
function get_image_name() function get_image_name()
return nil return image_name
end end