From f5362e957db67a5c04715387e556e99dbf521772 Mon Sep 17 00:00:00 2001 From: Claude Date: Wed, 8 Jul 2026 21:35:30 +0000 Subject: [PATCH] =?UTF-8?q?update.lua=20:=20updater=20MineOS=20(re-t=C3=A9?= =?UTF-8?q?l=C3=A9charge=20libs+apps=20corrig=C3=A9es=20+=20ic=C3=B4nes=20?= =?UTF-8?q?bureau)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-Authored-By: Claude Opus 4.8 Claude-Session: https://claude.ai/code/session_01UD7cRL4GJdermphho5rVXM --- update.lua | 55 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 55 insertions(+) create mode 100644 update.lua diff --git a/update.lua b/update.lua new file mode 100644 index 00000000..137ebe47 --- /dev/null +++ b/update.lua @@ -0,0 +1,55 @@ +-- update.lua — Met à jour les fichiers SecSite sur une installation MineOS existante : +-- re-télécharge libs + apps depuis ce dépôt et pose les icônes sur le bureau. +-- À lancer depuis Lua.app (voir le bootstrapper court fourni). + +local component = require("component") +local fs = require("Filesystem") +local system = require("System") +local paths = require("Paths") + +local BASE = "https://raw.githubusercontent.com/quentinthierry12/mineos/master/" +local inet = component.internet + +local function download(path) + local h = inet.request(BASE .. path) + local deadline = require("computer").uptime() + 10 + while true do + local ok, err = h.finishConnect() + if ok then break end + if err or require("computer").uptime() > deadline then h.close(); return false end + os.sleep(0.05) + end + local buf = "" + while true do + local chunk = h.read(math.huge) + if chunk then buf = buf .. chunk else break end + end + h.close() + local dir = path:match("^(.*)/[^/]+$") + if dir and not fs.exists("/" .. dir) then fs.makeDirectory("/" .. dir) end + local f = io.open("/" .. path, "w") + if not f then return false end + f:write(buf); f:close() + return true +end + +local LIBS = { + "shared/protocol", "shared/netsec", "shared/sha2", "shared/util", "shared/roles", + "shared/doors", "shared/site", "shared/protocols", "shared/reactors", "shared/defense", "shared/branding", + "mineos/lib/net", "mineos/lib/card", "mineos/lib/session", "mineos/lib/writer", "mineos/lib/blackout", + "mineos/login-fork/patch", "mineos/login-fork/autorun", +} +local APPS = { + "SecurityConsole", "Access", "Accounts", "Badges", "Logs", "Messages", + "Fleet", "Protocols", "Reactor", "Defense", "Config", "Map", "Setup", +} + +print("Mise a jour SecSite...") +local nlib, napp = 0, 0 +for _, l in ipairs(LIBS) do if download("Libraries/" .. l .. ".lua") then nlib = nlib + 1 end end +for _, a in ipairs(APPS) do + if download("Applications/" .. a .. ".app/Main.lua") then napp = napp + 1 end + pcall(system.createShortcut, paths.user.desktop .. a, "/Applications/" .. a .. ".app") +end +print("Libs: " .. nlib .. "/" .. #LIBS .. " Apps: " .. napp .. "/" .. #APPS .. " + icones bureau") +print("Termine - redemarre ou rafraichis le bureau.")