From 7cf2e6f10f3c671313847e722eab88fe05eaf16b Mon Sep 17 00:00:00 2001 From: Leonmmcoset Date: Sun, 31 Aug 2025 17:27:00 +0800 Subject: [PATCH] =?UTF-8?q?feat(installer):=20=E6=B7=BB=E5=8A=A0=E5=AE=89?= =?UTF-8?q?=E8=A3=85=E6=AD=A5=E9=AA=A4=E7=9A=84=E8=B0=83=E8=AF=95=E6=89=93?= =?UTF-8?q?=E5=8D=B0=E4=BF=A1=E6=81=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 添加了多个print语句来跟踪安装过程中的各个步骤,便于调试安装流程 --- installer.lua | 38 +++++++++++++++++++------------------- 1 file changed, 19 insertions(+), 19 deletions(-) diff --git a/installer.lua b/installer.lua index 548e8fc..c7da4fd 100644 --- a/installer.lua +++ b/installer.lua @@ -1,48 +1,48 @@ -- LeonOS installer local DEFAULT_ROM_DIR = "/rc" --- print("Downloading required libraries...") +print("Downloading required libraries...") +print("Run installer step 1") +local function dl(f) + local hand, err = http.get(f, nil, true) + if not hand then + error(err, 0) + end --- local function dl(f) --- local hand, err = http.get(f, nil, true) --- if not hand then --- error(err, 0) --- end - --- local data = hand.readAll() --- hand.close() - --- return data --- end + local data = hand.readAll() + hand.close() + return data +end +print("Run installer step 2") -- set up package.loaded for LeonOS libs package.loaded.rc = { expect = require("cc.expect").expect, write = write, sleep = sleep } - +print("Run installer step 3") package.loaded.term = term package.loaded.colors = colors _G.require = require - +print("Run installer step 4") function term.at(x, y) term.setCursorPos(x, y) return term end - +print("Run installer step 5") local function ghload(f, c) return assert(load(dl("https://raw.githubusercontent.com/"..f), "="..(c or f), "t", _G))() end - +print("Run installer step 6") local json = ghload("rxi/json.lua/master/json.lua", "ghload(json)") package.loaded["rc.json"] = json - +print("Run installer step 7") local function rcload(f) return ghload( "Leonmmcoset/LeonOS/refs/heads/main/data/computercraft/lua/rom/"..f, f) end - +print("Run installer step 8") -- get LeonOS's textutils with its extra utilities local tu = rcload("apis/textutils.lua") @@ -56,7 +56,7 @@ local function progress(y, a, b) {fg=colors.white, bg=colors.black}, (" "):rep((w-2)-#bar), colors.yellow, "]") end - +print("Run installer step 9") term.at(1,1).clear() tu.coloredPrint(colors.yellow, "LeonOS Installer 1.0\n=======================")