cc/update.lua
2024-06-01 04:39:41 +02:00

37 lines
1.1 KiB
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") 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
end
function download_file(filename)
if fs.exists(filename) then
fs.delete(filename)
end
shell.execute("wget", "https://gitea.rs485.network/ben/cc/raw/branch/main/" .. filename, filename)
end
if update_update() then
download_file("permset.lua")
download_file("requests.lua")
download_file("orders.lua")
download_file("test.lua")
shell.run("test")
end