mirror of
https://github.com/CCLeonOS/LeonOS.git
synced 2026-03-03 15:17:01 +00:00
feat: 更新版本号至1.0.2并移除catos程序
更新LeonOS版本号至1.0.2,修改GitHub API基础URL为代理地址 移除不再使用的catos.lua安装程序 在安装器中添加下载启动文件的进度提示
This commit is contained in:
@@ -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")
|
local fs = rawget(_G, "fs")
|
||||||
|
|
||||||
_G._RC_ROM_DIR = _RC_ROM_DIR or (...) and fs.exists("/leonos") and "/leonos" or "/rom"
|
_G._RC_ROM_DIR = _RC_ROM_DIR or (...) and fs.exists("/leonos") and "/leonos" or "/rom"
|
||||||
@@ -32,7 +32,7 @@ local rc = {
|
|||||||
_VERSION = {
|
_VERSION = {
|
||||||
major = 1,
|
major = 1,
|
||||||
minor = 0,
|
minor = 0,
|
||||||
patch = 1
|
patch = 2
|
||||||
},
|
},
|
||||||
queueEvent = pull(os, "queueEvent"),
|
queueEvent = pull(os, "queueEvent"),
|
||||||
startTimer = pull(os, "startTimer"),
|
startTimer = pull(os, "startTimer"),
|
||||||
|
|||||||
@@ -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.")
|
|
||||||
@@ -29,7 +29,7 @@ local pkg_config = {
|
|||||||
local_pkg_dir = "/packages", -- 本地包存储目录
|
local_pkg_dir = "/packages", -- 本地包存储目录
|
||||||
installed_db = "/packages/installed.json", -- 已安装包数据库
|
installed_db = "/packages/installed.json", -- 已安装包数据库
|
||||||
cache_dir = "/packages/cache", -- 缓存目录
|
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
|
||||||
}
|
}
|
||||||
|
|
||||||
-- 创建新包
|
-- 创建新包
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
-- LeonOS installer
|
-- LeonOS installer
|
||||||
local INSTALLER_VERSION = "1.0.1"
|
local INSTALLER_VERSION = "1.0.2"
|
||||||
local DEFAULT_ROM_DIR = "/leonos"
|
local DEFAULT_ROM_DIR = "/leonos"
|
||||||
|
|
||||||
print("Start loading LeonOS installer ("..INSTALLER_VERSION..")...")
|
print("Start loading LeonOS installer ("..INSTALLER_VERSION..")...")
|
||||||
@@ -193,11 +193,13 @@ term.at(1, pby).write((" "):rep((term.getSize())))
|
|||||||
term.at(okx, oky)
|
term.at(okx, oky)
|
||||||
ok()
|
ok()
|
||||||
|
|
||||||
|
bullet("Downloading startup file...")
|
||||||
assert(io.open(
|
assert(io.open(
|
||||||
fs.exists("/startup.lua") and "/unbios-rc.lua" or "/startup.lua", "w"))
|
fs.exists("/startup.lua") and "/unbios-rc.lua" or "/startup.lua", "w"))
|
||||||
:write(dl(
|
:write(dl(
|
||||||
"https://gh.catmak.name/https://raw.githubusercontent.com/Leonmmcoset/LeonOS/refs/heads/main/unbios.lua"
|
"https://gh.catmak.name/https://raw.githubusercontent.com/Leonmmcoset/LeonOS/refs/heads/main/unbios.lua"
|
||||||
)):close()
|
)):close()
|
||||||
|
ok()
|
||||||
|
|
||||||
tu.coloredPrint(colors.yellow, "Your computer will restart in 3 seconds.")
|
tu.coloredPrint(colors.yellow, "Your computer will restart in 3 seconds.")
|
||||||
local _, y = term.getCursorPos()
|
local _, y = term.getCursorPos()
|
||||||
|
|||||||
Reference in New Issue
Block a user