Skip to content
Snippets Groups Projects
Commit aefb0b8c authored by Matthias Schiffer's avatar Matthias Schiffer Committed by David Bauer
Browse files

scripts/copy_output.lua: delete images from OpenWrt dir after copying them

We don't move the images directly, as multiple images of the same device
may have the same source image (on x86), but only delete them after a
whole device has been handled (multiple devices using the same images
must be handled using aliases or manifest aliases instead).
parent e993f222
No related branches found
No related tags found
No related merge requests found
......@@ -31,6 +31,12 @@ mkdir(env.GLUON_IMAGEDIR..'/other')
lib.include(target)
local function image_source(image)
return string.format(
'openwrt/bin/targets/%s/openwrt-%s-%s%s%s',
bindir, openwrt_target, image.name, image.in_suffix, image.extension)
end
local function clean(image, name)
local dir, file = image:dest_name(name, '\0', '\0')
lib.exec {'rm', '-f', dir..'/'..file}
......@@ -41,8 +47,7 @@ for _, images in pairs(lib.images) do
clean(image, image.image)
local destdir, destname = image:dest_name(image.image)
local source = string.format('openwrt/bin/targets/%s/openwrt-%s-%s%s%s',
bindir, openwrt_target, image.name, image.in_suffix, image.extension)
local source = image_source(image)
lib.exec {'cp', source, destdir..'/'..destname}
......@@ -53,6 +58,11 @@ for _, images in pairs(lib.images) do
lib.exec {'ln', '-s', destname, destdir..'/'..aliasname}
end
end
for _, image in ipairs(images) do
local source = image_source(image)
lib.exec {'rm', '-f', source}
end
end
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment