feat: 初始提交 LeonOS 实现
添加 LeonOS 的基本实现,包括:
- 核心 API 模块(colors, disk, gps, keys, multishell, parallel, rednet, redstone, settings, vector)
- 命令行程序(about, alias, bg, clear, copy, delete, edit, fg, help, list, lua, mkdir, move, paint, peripherals, programs, reboot, set, shutdown, threads)
- 系统启动脚本和包管理
- 文档(README.md, LICENSE)
- 开发工具(devbin)和更新程序
实现功能:
- 完整的线程管理系统
- 兼容 ComputerCraft 的 API 设计
- 改进的 shell 和命令补全系统
- 多标签终端支持
- 设置管理系统
2025-08-31 16:54:18 +08:00
-- update: download a new copy of LeonOS
local rc = require ( " rc " )
local term = require ( " term " )
local colors = require ( " colors " )
local textutils = require ( " textutils " )
if not package.loaded . http then
io.stderr : write ( " The HTTP API is disabled and the updater cannot continue. Please enable the HTTP API in the ComputerCraft configuration and try again. \n " )
return
end
2025-09-01 09:42:28 +08:00
term.at ( 1 , 1 ) . clear ( )
feat: 初始提交 LeonOS 实现
添加 LeonOS 的基本实现,包括:
- 核心 API 模块(colors, disk, gps, keys, multishell, parallel, rednet, redstone, settings, vector)
- 命令行程序(about, alias, bg, clear, copy, delete, edit, fg, help, list, lua, mkdir, move, paint, peripherals, programs, reboot, set, shutdown, threads)
- 系统启动脚本和包管理
- 文档(README.md, LICENSE)
- 开发工具(devbin)和更新程序
实现功能:
- 完整的线程管理系统
- 兼容 ComputerCraft 的 API 设计
- 改进的 shell 和命令补全系统
- 多标签终端支持
- 设置管理系统
2025-08-31 16:54:18 +08:00
2025-09-01 09:42:28 +08:00
-- 程序顶部名称栏
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 Updater === " )
-- 恢复颜色设置
term.setTextColor ( old_fg )
term.setBackgroundColor ( old_bg )
term.at ( 1 , 2 )
-- 只清除顶栏以下的区域
for y = 2 , term.getSize ( ) do
term.at ( 1 , y ) . clearLine ( )
end
term.at ( 1 , 2 )
feat: 初始提交 LeonOS 实现
添加 LeonOS 的基本实现,包括:
- 核心 API 模块(colors, disk, gps, keys, multishell, parallel, rednet, redstone, settings, vector)
- 命令行程序(about, alias, bg, clear, copy, delete, edit, fg, help, list, lua, mkdir, move, paint, peripherals, programs, reboot, set, shutdown, threads)
- 系统启动脚本和包管理
- 文档(README.md, LICENSE)
- 开发工具(devbin)和更新程序
实现功能:
- 完整的线程管理系统
- 兼容 ComputerCraft 的 API 设计
- 改进的 shell 和命令补全系统
- 多标签终端支持
- 设置管理系统
2025-08-31 16:54:18 +08:00
textutils.coloredPrint ( colors.yellow ,
2025-09-01 09:42:28 +08:00
" LeonOS Updater (Step 1) \n =========================== " )
feat: 初始提交 LeonOS 实现
添加 LeonOS 的基本实现,包括:
- 核心 API 模块(colors, disk, gps, keys, multishell, parallel, rednet, redstone, settings, vector)
- 命令行程序(about, alias, bg, clear, copy, delete, edit, fg, help, list, lua, mkdir, move, paint, peripherals, programs, reboot, set, shutdown, threads)
- 系统启动脚本和包管理
- 文档(README.md, LICENSE)
- 开发工具(devbin)和更新程序
实现功能:
- 完整的线程管理系统
- 兼容 ComputerCraft 的 API 设计
- 改进的 shell 和命令补全系统
- 多标签终端支持
- 设置管理系统
2025-08-31 16:54:18 +08:00
print ( " Checking for update... " )
local http = require ( " http " )
2025-09-09 20:03:32 +08:00
local base = " https://gh.catmak.name/https://raw.githubusercontent.com/CCLeonOS/LeonOS/refs/heads/main/ "
feat: 初始提交 LeonOS 实现
添加 LeonOS 的基本实现,包括:
- 核心 API 模块(colors, disk, gps, keys, multishell, parallel, rednet, redstone, settings, vector)
- 命令行程序(about, alias, bg, clear, copy, delete, edit, fg, help, list, lua, mkdir, move, paint, peripherals, programs, reboot, set, shutdown, threads)
- 系统启动脚本和包管理
- 文档(README.md, LICENSE)
- 开发工具(devbin)和更新程序
实现功能:
- 完整的线程管理系统
- 兼容 ComputerCraft 的 API 设计
- 改进的 shell 和命令补全系统
- 多标签终端支持
- 设置管理系统
2025-08-31 16:54:18 +08:00
local Bhandle , Berr = http.get ( base .. " data/computercraft/lua/bios.lua " )
if not Bhandle then
error ( Berr , 0 )
end
local first = Bhandle.readLine ( )
Bhandle.close ( )
local oldVersion = rc.version ( ) : gsub ( " LeonOS " , " " )
local newVersion = first : match ( " LeonOS v?(%d+.%d+.%d+) " )
if newVersion and ( oldVersion ~= newVersion ) or ( ... ) == " -f " then
textutils.coloredPrint ( colors.green , " Found " , colors.white , " : " ,
colors.red , oldVersion , colors.yellow , " -> " , colors.lime ,
newVersion or oldVersion )
2025-09-01 09:42:28 +08:00
io.write ( " Apply update? [y/n]: " )
feat: 初始提交 LeonOS 实现
添加 LeonOS 的基本实现,包括:
- 核心 API 模块(colors, disk, gps, keys, multishell, parallel, rednet, redstone, settings, vector)
- 命令行程序(about, alias, bg, clear, copy, delete, edit, fg, help, list, lua, mkdir, move, paint, peripherals, programs, reboot, set, shutdown, threads)
- 系统启动脚本和包管理
- 文档(README.md, LICENSE)
- 开发工具(devbin)和更新程序
实现功能:
- 完整的线程管理系统
- 兼容 ComputerCraft 的 API 设计
- 改进的 shell 和命令补全系统
- 多标签终端支持
- 设置管理系统
2025-08-31 16:54:18 +08:00
if io.read ( ) ~= " y " then
textutils.coloredPrint ( colors.red , " Not applying update. " )
return
end
textutils.coloredPrint ( colors.green , " Applying update. " )
local handle , err = http.get ( base .. " updater.lua " , nil , true )
if not handle then
2025-09-01 09:42:28 +08:00
error ( " Failed downloading step 2: " .. err , 0 )
feat: 初始提交 LeonOS 实现
添加 LeonOS 的基本实现,包括:
- 核心 API 模块(colors, disk, gps, keys, multishell, parallel, rednet, redstone, settings, vector)
- 命令行程序(about, alias, bg, clear, copy, delete, edit, fg, help, list, lua, mkdir, move, paint, peripherals, programs, reboot, set, shutdown, threads)
- 系统启动脚本和包管理
- 文档(README.md, LICENSE)
- 开发工具(devbin)和更新程序
实现功能:
- 完整的线程管理系统
- 兼容 ComputerCraft 的 API 设计
- 改进的 shell 和命令补全系统
- 多标签终端支持
- 设置管理系统
2025-08-31 16:54:18 +08:00
end
local data = handle.readAll ( )
handle.close ( )
local out = io.open ( " /.start_rc.lua " , " w " )
out : write ( data )
out : close ( )
textutils.coloredWrite ( colors.yellow , " Restarting... " )
rc.sleep ( 3 )
rc.reboot ( )
else
textutils.coloredPrint ( colors.red , " None found " )
end