2019-06-17 23:33:12 +00:00
|
|
|
local lib = dofile('scripts/target_lib.lua')
|
|
|
|
local env = lib.env
|
2019-06-14 17:20:15 +00:00
|
|
|
|
|
|
|
assert(env.GLUON_IMAGEDIR)
|
|
|
|
|
|
|
|
|
|
|
|
local target = arg[1]
|
|
|
|
|
2019-06-17 23:33:12 +00:00
|
|
|
lib.include(target)
|
2019-06-14 17:20:15 +00:00
|
|
|
|
|
|
|
|
|
|
|
local function strip(s)
|
|
|
|
return string.gsub(s, '\n$', '')
|
|
|
|
end
|
|
|
|
|
|
|
|
local function generate_line(model, dir, filename, filesize)
|
2019-06-17 23:33:12 +00:00
|
|
|
local exists = pcall(lib.exec, {'test', '-e', dir..'/'..filename})
|
2019-06-14 17:20:15 +00:00
|
|
|
if not exists then
|
|
|
|
return
|
|
|
|
end
|
|
|
|
|
2019-06-17 23:33:12 +00:00
|
|
|
local file256sum = strip(lib.exec_capture {'scripts/sha256sum.sh', dir..'/'..filename})
|
|
|
|
local file512sum = strip(lib.exec_capture {'scripts/sha512sum.sh', dir..'/'..filename})
|
2019-06-14 17:20:15 +00:00
|
|
|
|
|
|
|
io.stdout:write(string.format('%s %s %s %s %s\n', model, env.GLUON_RELEASE, file256sum, filesize, filename))
|
|
|
|
io.stdout:write(string.format('%s %s %s %s\n', model, env.GLUON_RELEASE, file256sum, filename))
|
|
|
|
io.stdout:write(string.format('%s %s %s %s\n', model, env.GLUON_RELEASE, file512sum, filename))
|
|
|
|
end
|
|
|
|
|
|
|
|
local function generate(image)
|
|
|
|
local dir, filename = image:dest_name(image.image)
|
2019-06-17 23:33:12 +00:00
|
|
|
local exists = pcall(lib.exec, {'test', '-e', dir..'/'..filename})
|
2019-06-14 17:20:15 +00:00
|
|
|
if not exists then
|
|
|
|
return
|
|
|
|
end
|
|
|
|
|
2019-06-17 23:33:12 +00:00
|
|
|
local filesize = strip(lib.exec_capture {'scripts/filesize.sh', dir..'/'..filename})
|
2019-06-14 17:20:15 +00:00
|
|
|
|
|
|
|
generate_line(image.image, dir, filename, filesize)
|
|
|
|
|
|
|
|
for _, alias in ipairs(image.aliases) do
|
|
|
|
local aliasdir, aliasname = image:dest_name(alias)
|
|
|
|
generate_line(alias, aliasdir, aliasname, filesize)
|
|
|
|
end
|
|
|
|
|
|
|
|
for _, alias in ipairs(image.manifest_aliases) do
|
|
|
|
generate_line(alias, dir, filename, filesize)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2020-04-24 21:09:05 +00:00
|
|
|
for _, images in pairs(lib.images) do
|
|
|
|
for _, image in ipairs(images) do
|
|
|
|
if image.subdir == 'sysupgrade' then
|
|
|
|
generate(image)
|
|
|
|
end
|
2019-06-14 17:20:15 +00:00
|
|
|
end
|
|
|
|
end
|