Fix keeping update.lua.old

This commit is contained in:
Ben 2024-06-01 03:27:12 +02:00
parent 4a06da1233
commit b575517317
Signed by: ben
GPG key ID: 1353F41CF1CFF2D3

View file

@ -6,10 +6,14 @@ function update_update()
fs.move("update.lua", "update.lua.old")
end
shell.execute("wget", "https://gitea.rs485.network/ben/cc/raw/branch/main/update.lua", "update.lua")
if fs.exists("update.lua.old") and fs.getSize("update.lua.old") ~= fs.getSize("update.lua") then
shell.run("update")
-- re-ran update, don't continue in this instance
return false
if fs.exists("update.lua.old") then
if fs.getSize("update.lua.old") ~= fs.getSize("update.lua") then
shell.run("update")
-- re-ran update, don't continue in this instance
return false
else
fs.delete("update.lua.old")
end
end
end
return true