polish up installer

This commit is contained in:
Kodi Craft 2025-03-25 19:20:04 +01:00
parent c7d7f9be98
commit 6cf175e5f0
Signed by: kodi
GPG Key ID: 69D9EED60B242822

View File

@ -64,6 +64,7 @@ local function main()
end end
end end
if #toDownload > 0 then
log.info(#toDownload .. " files to download") log.info(#toDownload .. " files to download")
for k, v in ipairs(toDownload) do for k, v in ipairs(toDownload) do
if not fs.exists("/tmp") then if not fs.exists("/tmp") then
@ -82,15 +83,19 @@ local function main()
tempfile.close() tempfile.close()
if filehash ~= v.hash then if filehash ~= v.hash then
log.error("File " .. v.dest .. " (from " .. v.src .. ") has a mismatched hash.") log.error("File " .. v.dest .. " (from " .. v.src .. ") has a mismatched hash.")
log.error("Installation aborted.") log.error("Installation aborted. Remember to clean /tmp manually.")
return return
end end
end end
log.info("Installing") log.info("Installing")
for k, v in ipairs(toDownload) do for k, v in ipairs(toDownload) do
fs.delete(v.dest)
fs.move("/tmp/" .. v.hash .. ".lua", v.dest) fs.move("/tmp/" .. v.hash .. ".lua", v.dest)
end end
else
log.info("Nothing to do")
end
log.info("Installation complete!") log.info("Installation complete!")
end end