mirror of
https://github.com/CCLeonOS/LeonOS.git
synced 2026-03-03 15:17:01 +00:00
feat(pkg): 更新包管理系统并升级至LeonOS 0.3.6
- 将包安装目录从/leonos/packages迁移至/packages - 更新版本号至0.3.6 - 修改installer.lua以正确处理packages目录 - 更新pkg.lua程序适配新的包路径 - 添加示例包文件到新位置
This commit is contained in:
@@ -1,4 +1,4 @@
|
|||||||
_G._HOST = _G._HOST .. " (LeonOS 0.3.5)"
|
_G._HOST = _G._HOST .. " (LeonOS 0.3.6)"
|
||||||
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"
|
||||||
@@ -31,8 +31,8 @@ local rc = {
|
|||||||
_NAME = "LeonOS",
|
_NAME = "LeonOS",
|
||||||
_VERSION = {
|
_VERSION = {
|
||||||
major = 0,
|
major = 0,
|
||||||
minor = 3,
|
minor = 3,
|
||||||
patch = 5
|
patch = 6
|
||||||
},
|
},
|
||||||
queueEvent = pull(os, "queueEvent"),
|
queueEvent = pull(os, "queueEvent"),
|
||||||
startTimer = pull(os, "startTimer"),
|
startTimer = pull(os, "startTimer"),
|
||||||
|
|||||||
@@ -26,9 +26,9 @@ term.at(1, 2)
|
|||||||
-- 包管理器配置
|
-- 包管理器配置
|
||||||
local pkg_config = {
|
local pkg_config = {
|
||||||
repo_url = "https://example.com/leonos/packages", -- 包仓库URL
|
repo_url = "https://example.com/leonos/packages", -- 包仓库URL
|
||||||
local_pkg_dir = "/leonos/packages", -- 本地包存储目录
|
local_pkg_dir = "/packages", -- 本地包存储目录
|
||||||
installed_db = "/leonos/packages/installed.json", -- 已安装包数据库
|
installed_db = "/packages/installed.json", -- 已安装包数据库
|
||||||
cache_dir = "/leonos/cache" -- 缓存目录
|
cache_dir = "/rom/cache" -- 缓存目录
|
||||||
}
|
}
|
||||||
|
|
||||||
-- 确保必要的目录存在
|
-- 确保必要的目录存在
|
||||||
@@ -136,7 +136,7 @@ local function install_package(pkg_name, options)
|
|||||||
print("Installing version: " .. latest_version)
|
print("Installing version: " .. latest_version)
|
||||||
for _, file_path in ipairs(meta.files or {}) do
|
for _, file_path in ipairs(meta.files or {}) do
|
||||||
local src = fs.combine(version_path, file_path)
|
local src = fs.combine(version_path, file_path)
|
||||||
local dest = fs.combine("/leonos", file_path)
|
local dest = fs.combine("/rom", file_path)
|
||||||
|
|
||||||
-- 确保目标目录存在
|
-- 确保目标目录存在
|
||||||
local dest_dir = fs.getDir(dest)
|
local dest_dir = fs.getDir(dest)
|
||||||
@@ -250,7 +250,7 @@ local function remove_package(pkg_name)
|
|||||||
if ok and meta then
|
if ok and meta then
|
||||||
-- 删除包文件
|
-- 删除包文件
|
||||||
for _, file_path in ipairs(meta.files or {}) do
|
for _, file_path in ipairs(meta.files or {}) do
|
||||||
local dest = fs.combine("/leonos", file_path)
|
local dest = fs.combine("/rom", file_path)
|
||||||
if fs.exists(dest) then
|
if fs.exists(dest) then
|
||||||
fs.delete(dest)
|
fs.delete(dest)
|
||||||
print("Removed: " .. file_path)
|
print("Removed: " .. file_path)
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
-- LeonOS installer
|
-- LeonOS installer
|
||||||
local INSTALLER_VERSION = "0.3.5"
|
local INSTALLER_VERSION = "0.3.6"
|
||||||
local DEFAULT_ROM_DIR = "/leonos"
|
local DEFAULT_ROM_DIR = "/leonos"
|
||||||
|
|
||||||
print("Start loading LeonOS installer ("..INSTALLER_VERSION..")...")
|
print("Start loading LeonOS installer ("..INSTALLER_VERSION..")...")
|
||||||
@@ -114,6 +114,7 @@ local function bullet(t)
|
|||||||
tu.coloredWrite(colors.red, "- ", colors.white, t)
|
tu.coloredWrite(colors.red, "- ", colors.white, t)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
-- Function for "xxx...OK"
|
||||||
local function ok()
|
local function ok()
|
||||||
tu.coloredPrint(colors.green, "OK", colors.white)
|
tu.coloredPrint(colors.green, "OK", colors.white)
|
||||||
end
|
end
|
||||||
@@ -132,7 +133,12 @@ local to_dl = {}
|
|||||||
for _, v in pairs(repodata.tree) do
|
for _, v in pairs(repodata.tree) do
|
||||||
if v.path and v.path:sub(1,#look) == look then
|
if v.path and v.path:sub(1,#look) == look then
|
||||||
v.path = v.path:sub(#look+1)
|
v.path = v.path:sub(#look+1)
|
||||||
v.real_path = v.path:gsub("^/?rom", ROM_DIR)
|
-- 特殊处理packages文件夹,将其放在根目录
|
||||||
|
if v.path:sub(1, 9) == "packages/" then
|
||||||
|
v.real_path = v.path
|
||||||
|
else
|
||||||
|
v.real_path = v.path:gsub("^/?rom", ROM_DIR)
|
||||||
|
end
|
||||||
to_dl[#to_dl+1] = v
|
to_dl[#to_dl+1] = v
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user