From 079bfd8362c7241c8b9f6ba28bd69bd1303764cb Mon Sep 17 00:00:00 2001 From: Leonmmcoset Date: Mon, 1 Sep 2025 16:49:13 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E6=9B=B4=E6=96=B0LeonOS=E7=89=88?= =?UTF-8?q?=E6=9C=AC=E8=87=B30.1.9=E5=B9=B6=E6=B7=BB=E5=8A=A0=E6=AC=A2?= =?UTF-8?q?=E8=BF=8E=E4=BF=A1=E6=81=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 将LeonOS版本从0.1.8升级至0.1.9 - 在shell启动时添加欢迎信息 - 改进ver程序界面,添加顶部名称栏 - 简化安装程序流程,默认使用/leonos目录 --- data/computercraft/lua/bios.lua | 4 ++-- data/computercraft/lua/rom/programs/shell.lua | 1 + data/computercraft/lua/rom/programs/ver.lua | 19 +++++++++++++++++++ installer.lua | 18 +++++++----------- 4 files changed, 29 insertions(+), 13 deletions(-) diff --git a/data/computercraft/lua/bios.lua b/data/computercraft/lua/bios.lua index ff923d9..26c9cd5 100644 --- a/data/computercraft/lua/bios.lua +++ b/data/computercraft/lua/bios.lua @@ -1,4 +1,4 @@ -_G._HOST = _G._HOST .. " (LeonOS 0.1.8)" +_G._HOST = _G._HOST .. " (LeonOS 0.1.9)" local fs = rawget(_G, "fs") _G._RC_ROM_DIR = _RC_ROM_DIR or (...) and fs.exists("/leonos") and "/leonos" or "/rom" @@ -32,7 +32,7 @@ local rc = { _VERSION = { major = 0, minor = 1, - patch = 8 + patch = 9 }, queueEvent = pull(os, "queueEvent"), startTimer = pull(os, "startTimer"), diff --git a/data/computercraft/lua/rom/programs/shell.lua b/data/computercraft/lua/rom/programs/shell.lua index 8881fd4..56306da 100644 --- a/data/computercraft/lua/rom/programs/shell.lua +++ b/data/computercraft/lua/rom/programs/shell.lua @@ -30,6 +30,7 @@ if os.version then else textutils.coloredPrint(colors.yellow, rc.version(), colors.white) end +textutils.coloredPrint(colors.yellow, "Welcome using the beta version of LeonOS!"colors.white) thread.vars().parentShell = thread.id() shell.init(_ENV) diff --git a/data/computercraft/lua/rom/programs/ver.lua b/data/computercraft/lua/rom/programs/ver.lua index fecf753..5fef072 100644 --- a/data/computercraft/lua/rom/programs/ver.lua +++ b/data/computercraft/lua/rom/programs/ver.lua @@ -2,5 +2,24 @@ local rc = require("rc") local textutils = require("textutils") +-- 程序顶部名称栏 +local term = require("term") +local colors = require("colors") + +-- 保存当前颜色设置 +local old_fg = term.getTextColor() +local old_bg = term.getBackgroundColor() + +-- 设置名称栏颜色并显示 +term.setTextColor(colors.white) +term.setBackgroundColor(colors.cyan) +term.at(1, 1).clearLine() +term.at(1, 1).write("=== LeonOS Version ===") + +-- 恢复颜色设置 +term.setTextColor(old_fg) +term.setBackgroundColor(old_bg) +term.at(1, 2) + -- Display LeonOS version textutils.coloredPrint(colors.yellow, rc.version(), colors.white) diff --git a/installer.lua b/installer.lua index f3273c6..b876255 100644 --- a/installer.lua +++ b/installer.lua @@ -1,5 +1,5 @@ -- LeonOS installer -local INSTALLER_VERSION = "0.1.8" +local INSTALLER_VERSION = "0.1.9" local DEFAULT_ROM_DIR = "/leonos" print("Start loading LeonOS installer...") @@ -88,8 +88,8 @@ end term.at(1, 2) tu.coloredPrint(colors.yellow, "LeonOS Installer (v"..INSTALLER_VERSION..")\n=======================") -tu.coloredPrint("You are going to install LeonOS to your computer.") -tu.coloredPrint("This will ",colors.red,"overwrite any existing files", colors.white, " in the installation directory.") +tu.coloredPrint("You are going to install LeonOS "..rc.version().." to your computer.") +tu.coloredPrint("This will ",colors.red,"OVERWRITE any existing files", colors.white, " in the installation directory.") tu.coloredPrint(colors.yellow, "Are you sure? (y/n)") local confirm = read() if confirm ~= "y" then @@ -98,20 +98,16 @@ if confirm ~= "y" then end local ROM_DIR -tu.coloredPrint("Enter installation directory ", colors.yellow, "[", - colors.lightBlue, DEFAULT_ROM_DIR, colors.yellow, "]") -tu.coloredWrite(colors.yellow, "$ installer >>>") - -ROM_DIR = read() -if #ROM_DIR == 0 then ROM_DIR = DEFAULT_ROM_DIR end +-- tu.coloredPrint("Enter installation directory ", colors.yellow, "[", +-- colors.lightBlue, DEFAULT_ROM_DIR, colors.yellow, "]") +ROM_DIR = DEFAULT_ROM_DIR ROM_DIR = "/"..shell.resolve(ROM_DIR) settings.set("LeonOS.rom_dir", ROM_DIR) settings.save() -tu.coloredPrint(colors.white, "Installing LeonOS to ", colors.lightBlue, - ROM_DIR, colors.white) +tu.coloredPrint(colors.white, "Installing LeonOS "..rc.version().."...", colors.white) local function bullet(t) tu.coloredWrite(colors.red, "- ", colors.white, t)