Commit e505e3c9 authored by Jan-Tarek Butt's avatar Jan-Tarek Butt

firmware-bot: fix ecdsa check

parent 86d4f63f
......@@ -6,7 +6,7 @@
local PID_PART="/var/run/firmware-bot.pid"
-- Root dir of the firmware images
local FIRMWARE_DIR="/home/tata/firmware"
local FIRMWARE_DIR="<part to firmware dir>"
-- Gluon reposetory for singe script
local GLUON_GIT="https://github.com/freifunk-gluon/gluon.git"
......@@ -169,7 +169,7 @@ end
local function check_manifest_signature(signscript, pub_keys, firmware_dir)
local ret = {}
if io.open(signscript, "r") ~= nil then
for dir in io.popen(string.format("find %s -mindepth 1 -type d", firmware_dir), 'r'):lines() do
for dir in io.popen(string.format("find %s -mindepth 1 -type d | sort -r", firmware_dir), 'r'):lines() do
local version = {}
-- Get firmware version
for v in string.gmatch(dir, "([^%%/]+)") do
......@@ -185,17 +185,29 @@ local function check_manifest_signature(signscript, pub_keys, firmware_dir)
break
end
end
-- signed persons
version["sgigned"] = 0
local signed_person = {}
for k, p in pairs(pub_keys[version["branch"]]) do
if os.execute(signscript.." " .. k .. " " ..dir.."/".. version["branch"]..".manifest\n") then
version["sgigned"] = version["sgigned"] +1
table.insert(signed_person,p)
if version["branch"] ~= nil then
-- signed persons
version["sgigned"] = 0
local signed_person = {}
for k, p in pairs(pub_keys[version["branch"]]) do
local f = io.popen(signscript.." " .. k .. " " ..dir.."/".. version["branch"]..".manifest 2>&1 \necho $?\n")
local sigtest = f.read(f,'*a*')
f.close(f)
if not sigtest:match("Error while reading signature") then
-- Manifest not broken
if sigtest:match("0") then
version["sgigned"] = version["sgigned"] +1
table.insert(signed_person,p)
end
else
-- Manifest broken
table.insert(signed_person,"error")
break
end
end
version["persons"] = signed_person
table.insert(ret,version)
end
version["persons"] = signed_person
table.insert(ret,version)
end
end
return ret
......@@ -230,6 +242,9 @@ local function genertate_html(content, dir)
-- fill kontent
for i,t in pairs(content) do
local content = {}
if t["branch"] == nil then
t["branch"] = ""
end
content["version"] = "\t\t<td>"..t["version"].."</td>\n"
content["branch"] = "\t\t<td>"..t["branch"].."</td>\n"
content["sgigned"] = "\t\t<td>"..t["sgigned"].."</td>\n"
......@@ -238,7 +253,9 @@ local function genertate_html(content, dir)
content["persons"] = content["persons"]..v.."\n"
end
content["persons"] = content["persons"].."</td>\n"
html_table = html_table.."\t<tr>\n"..content["branch"]..content["version"]..content["sgigned"]..content["persons"].."\t</tr>\n"
if content["branch"] ~= "" then
html_table = html_table.."\t<tr>\n"..content["branch"]..content["version"]..content["sgigned"]..content["persons"].."\t</tr>\n"
end
end
html_table = html_table.."</table>"
-- Prepare hpml file and write it
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment