From b575517317dc74003efc34b0f174bfbf15c3e47e Mon Sep 17 00:00:00 2001 From: Benedikt Ziemons Date: Sat, 1 Jun 2024 03:27:12 +0200 Subject: [PATCH] Fix keeping update.lua.old --- update.lua | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/update.lua b/update.lua index a65b279..c60bb80 100644 --- a/update.lua +++ b/update.lua @@ -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