diff --git a/data/computercraft/lua/bios.lua b/data/computercraft/lua/bios.lua index 5199833..59beb2d 100644 --- a/data/computercraft/lua/bios.lua +++ b/data/computercraft/lua/bios.lua @@ -1,4 +1,4 @@ -_G._HOST = _G._HOST .. " (LeonOS 1.0.1)" +_G._HOST = _G._HOST .. " (LeonOS 1.0.2)" 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 = 1, minor = 0, - patch = 1 + patch = 2 }, queueEvent = pull(os, "queueEvent"), startTimer = pull(os, "startTimer"), diff --git a/data/computercraft/lua/rom/programs/catos.lua b/data/computercraft/lua/rom/programs/catos.lua deleted file mode 100644 index 113aa5e..0000000 --- a/data/computercraft/lua/rom/programs/catos.lua +++ /dev/null @@ -1,68 +0,0 @@ --- CatOS web installer: wget run https://catos.cpolar.cn/install.lua --- This CatOS installer is for LeonOS --- Require -fs = require("fs") -http = require("http") -term = require("term") -colors = require("colors") -textutils = require("textutils") --- Main -local SITE = "https://catos.cpolar.cn" -textutils.coloredPrint("You are going to install CatOS to your computer.") -textutils.coloredPrint("We suggest you backup the files before install the CatOS.") -textutils.coloredPrint(colors.yellow, "Are you sure? (y/n)") -local confirm = term.read() -if confirm ~= "y" then - print("Installation cancelled.") - return -end -local function http_get(url) - local r = http.get(url) - if not r then error("request failed: " .. url) end - local s = r.readAll() or ""; r.close(); return s -end - -local function write_file(path, content) - local dir = fs.getDir(path) - if dir ~= "" and not fs.exists(dir) then fs.makeDir(dir) end - local h = fs.open(path, "w") - if not h then error("cannot write: " .. path) end - h.write(content or "") - h.close() -end - -term.setBackgroundColor(colors.black) -term.setTextColor(colors.white) -term.clear() -term.setCursorPos(1,1) -print("CatOS installer - fetching manifest...") -local manifest_json = http_get(SITE .. "/repo/catos-manifest.json") -local ok, manifest = pcall(textutils.unserializeJSON, manifest_json) -if not ok or type(manifest) ~= "table" then error("invalid manifest") end - -local base = manifest.base or "/root" -local files = manifest.files or {} -local total = #files -local i = 0 -for _, rel in ipairs(files) do - i = i + 1 - -- black overlay with progress - local w,h = term.getSize() - term.setBackgroundColor(colors.black) - term.setTextColor(colors.white) - term.setCursorPos(1,1); term.clearLine() - print(string.format("Installing CatOS [%d/%d] %s", i, total, rel)) - -- draw progress bar at line 3 - local pct = math.floor((i-1)/math.max(1,total) * (w-2)) - term.setCursorPos(1,3) - term.clearLine() - term.write("[") - term.write(string.rep("#", pct)) - term.write(string.rep("-", (w-2)-pct)) - term.write("]") - local content = http_get(SITE .. base .. "/" .. rel) - write_file(rel, content) -end - -term.setCursorPos(1,5) -print("CatOS installed. Type 'restart' to complete the installation.") diff --git a/data/computercraft/lua/rom/programs/pkg.lua b/data/computercraft/lua/rom/programs/pkg.lua index 9f9ac98..a66e2b4 100644 --- a/data/computercraft/lua/rom/programs/pkg.lua +++ b/data/computercraft/lua/rom/programs/pkg.lua @@ -29,7 +29,7 @@ local pkg_config = { local_pkg_dir = "/packages", -- 本地包存储目录 installed_db = "/packages/installed.json", -- 已安装包数据库 cache_dir = "/packages/cache", -- 缓存目录 - github_api_url = "https://raw.githubusercontent.com" -- GitHub API基础URL + github_api_url = "https://gh.catmak.name/https://raw.githubusercontent.com" -- GitHub API基础URL } -- 创建新包 diff --git a/installer.lua b/installer.lua index be0075a..51f9a64 100644 --- a/installer.lua +++ b/installer.lua @@ -1,5 +1,5 @@ -- LeonOS installer -local INSTALLER_VERSION = "1.0.1" +local INSTALLER_VERSION = "1.0.2" local DEFAULT_ROM_DIR = "/leonos" print("Start loading LeonOS installer ("..INSTALLER_VERSION..")...") @@ -193,11 +193,13 @@ term.at(1, pby).write((" "):rep((term.getSize()))) term.at(okx, oky) ok() +bullet("Downloading startup file...") assert(io.open( fs.exists("/startup.lua") and "/unbios-rc.lua" or "/startup.lua", "w")) :write(dl( "https://gh.catmak.name/https://raw.githubusercontent.com/Leonmmcoset/LeonOS/refs/heads/main/unbios.lua" )):close() +ok() tu.coloredPrint(colors.yellow, "Your computer will restart in 3 seconds.") local _, y = term.getCursorPos()