From 4a06da1233eddfb446d6bcc12d4e509f24ac1d1b Mon Sep 17 00:00:00 2001 From: Benedikt Ziemons Date: Sat, 1 Jun 2024 03:19:54 +0200 Subject: [PATCH] Update update update --- update.lua | 34 +++++++++++++++++++++++++++------- 1 file changed, 27 insertions(+), 7 deletions(-) diff --git a/update.lua b/update.lua index 74871cb..a65b279 100644 --- a/update.lua +++ b/update.lua @@ -1,9 +1,29 @@ -if fs.exists("permset.lua") then - fs.delete("permset.lua") +function update_update() + if fs.exists("update.lua.old") then + fs.delete("update.lua.old") + else + if fs.exists("update.lua") then + 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 + end + end + return true end -shell.execute("wget", "https://gitea.rs485.network/ben/cc/raw/branch/main/permset.lua", "permset.lua") -if fs.exists("test.lua") then - fs.delete("test.lua") + + +if update_update() then + if fs.exists("permset.lua") then + fs.delete("permset.lua") + end + shell.execute("wget", "https://gitea.rs485.network/ben/cc/raw/branch/main/permset.lua", "permset.lua") + if fs.exists("test.lua") then + fs.delete("test.lua") + end + shell.execute("wget", "https://gitea.rs485.network/ben/cc/raw/branch/main/test.lua", "test.lua") + shell.run("test") end -shell.execute("wget", "https://gitea.rs485.network/ben/cc/raw/branch/main/test.lua", "test.lua") -shell.run("test")