scripts/target_lib.lua: reorganize images into per-device lists
This commit is contained in:
parent
8bc602b021
commit
e993f22233
@ -36,20 +36,22 @@ local function clean(image, name)
|
|||||||
lib.exec {'rm', '-f', dir..'/'..file}
|
lib.exec {'rm', '-f', dir..'/'..file}
|
||||||
end
|
end
|
||||||
|
|
||||||
for _, image in ipairs(lib.images) do
|
for _, images in pairs(lib.images) do
|
||||||
clean(image, image.image)
|
for _, image in ipairs(images) do
|
||||||
|
clean(image, image.image)
|
||||||
|
|
||||||
local destdir, destname = image:dest_name(image.image)
|
local destdir, destname = image:dest_name(image.image)
|
||||||
local source = string.format('openwrt/bin/targets/%s/openwrt-%s-%s%s%s',
|
local source = string.format('openwrt/bin/targets/%s/openwrt-%s-%s%s%s',
|
||||||
bindir, openwrt_target, image.name, image.in_suffix, image.extension)
|
bindir, openwrt_target, image.name, image.in_suffix, image.extension)
|
||||||
|
|
||||||
lib.exec {'cp', source, destdir..'/'..destname}
|
lib.exec {'cp', source, destdir..'/'..destname}
|
||||||
|
|
||||||
for _, alias in ipairs(image.aliases) do
|
for _, alias in ipairs(image.aliases) do
|
||||||
clean(image, alias)
|
clean(image, alias)
|
||||||
|
|
||||||
local _, aliasname = image:dest_name(alias)
|
local _, aliasname = image:dest_name(alias)
|
||||||
lib.exec {'ln', '-s', destname, destdir..'/'..aliasname}
|
lib.exec {'ln', '-s', destname, destdir..'/'..aliasname}
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -48,8 +48,10 @@ local function generate(image)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
for _, image in ipairs(lib.images) do
|
for _, images in pairs(lib.images) do
|
||||||
if image.subdir == 'sysupgrade' then
|
for _, image in ipairs(images) do
|
||||||
generate(image)
|
if image.subdir == 'sysupgrade' then
|
||||||
|
generate(image)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -143,7 +143,9 @@ local image_mt = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
local function add_image(image)
|
local function add_image(image)
|
||||||
table.insert(M.images, setmetatable(image, image_mt))
|
local device = image.image
|
||||||
|
M.images[device] = M.images[device] or {}
|
||||||
|
table.insert(M.images[device], setmetatable(image, image_mt))
|
||||||
end
|
end
|
||||||
|
|
||||||
function F.try_config(...)
|
function F.try_config(...)
|
||||||
|
Loading…
Reference in New Issue
Block a user