formating better for spm packages
This commit is contained in:
1 parent
22b5021e9d
commit
ab0a10105c
193 files changed
+4228
-464
No files matched your search
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
+3
-3
@@ -106,7 +106,7 @@ local ok, err = xpcall(function()
|
||||
|
||||
local file = {}
|
||||
|
||||
function file:read(n)
|
||||
function file.read(n)
|
||||
assert(not closed, "file is closed")
|
||||
|
||||
local s = content()
|
||||
@@ -123,7 +123,7 @@ local ok, err = xpcall(function()
|
||||
return out
|
||||
end
|
||||
|
||||
function file:write(data)
|
||||
function file.write(data)
|
||||
assert(not closed, "file is closed")
|
||||
|
||||
local s = content()
|
||||
@@ -136,7 +136,7 @@ local ok, err = xpcall(function()
|
||||
return true
|
||||
end
|
||||
|
||||
function file:seek(whence, offset)
|
||||
function file.seek(whence, offset)
|
||||
assert(not closed, "file is closed")
|
||||
|
||||
local s = content()
|
||||
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
+65
-49
@@ -1,9 +1,8 @@
|
||||
--:Minify:--
|
||||
local BOOT_DRIVE_PATH = ({...})[1] or "/$"
|
||||
---@diagnostic disable-next-line: undefined-global
|
||||
local term = term
|
||||
local os = os
|
||||
local function write(text)
|
||||
local lterm = term
|
||||
local function write(text, term)
|
||||
local x, y = term.getCursorPos()
|
||||
local w, h = term.getSize()
|
||||
|
||||
@@ -49,13 +48,13 @@ local function write(text)
|
||||
end
|
||||
|
||||
local function displaySuperBadError(err)
|
||||
term.setBackgroundColor(0x1)
|
||||
term.setTextColor(0x4)
|
||||
term.clear()
|
||||
term.setCursorPos(1, 1)
|
||||
term.write("A critical error occurred while loading the system:")
|
||||
term.setCursorPos(1, 3)
|
||||
write(err)
|
||||
lterm.setBackgroundColor(0x1)
|
||||
lterm.setTextColor(0x4)
|
||||
lterm.clear()
|
||||
lterm.setCursorPos(1, 1)
|
||||
lterm.write("A critical error occurred while loading the system:")
|
||||
lterm.setCursorPos(1, 3)
|
||||
write(err, lterm)
|
||||
while true do end
|
||||
end
|
||||
|
||||
@@ -117,18 +116,18 @@ local ok, err = xpcall(function()
|
||||
while stoptime > apis.os.clock() do end
|
||||
end
|
||||
|
||||
apis.term.setPaletteColor(0x1, 0xFFFFFF) -- #000000
|
||||
apis.term.setPaletteColor(0x2, 0xFF0000) -- #FFFFFF
|
||||
apis.term.setPaletteColor(0x4, 0x00FF00) -- #FF0000
|
||||
apis.term.setPaletteColor(0x8, 0x0000FF) -- #00FF00
|
||||
apis.term.setPaletteColor(0x10, 0x00FFFF) -- #0000FF
|
||||
apis.term.setPaletteColor(0x20, 0xFF00FF) -- #00FFFF
|
||||
apis.term.setPaletteColor(0x40, 0xFFFF00) -- #FF00FF
|
||||
apis.term.setPaletteColor(0x80, 0xFF6D00) -- #FFFF00
|
||||
apis.term.setPaletteColor(0x100, 0x6DFF55) -- #FF6D00
|
||||
apis.term.setPaletteColor(0x200, 0x24FFFF) -- #6DFF55
|
||||
apis.term.setPaletteColor(0x400, 0x924900) -- #24FFFF
|
||||
apis.term.setPaletteColor(0x800, 0x6D6D55) -- #924900
|
||||
apis.term.setPaletteColor(0x1, 0xFFFFFF) -- #000000
|
||||
apis.term.setPaletteColor(0x2, 0xFF0000) -- #FFFFFF
|
||||
apis.term.setPaletteColor(0x4, 0x00FF00) -- #FF0000
|
||||
apis.term.setPaletteColor(0x8, 0x0000FF) -- #00FF00
|
||||
apis.term.setPaletteColor(0x10, 0x00FFFF) -- #0000FF
|
||||
apis.term.setPaletteColor(0x20, 0xFF00FF) -- #00FFFF
|
||||
apis.term.setPaletteColor(0x40, 0xFFFF00) -- #FF00FF
|
||||
apis.term.setPaletteColor(0x80, 0xFF6D00) -- #FFFF00
|
||||
apis.term.setPaletteColor(0x100, 0x6DFF55) -- #FF6D00
|
||||
apis.term.setPaletteColor(0x200, 0x24FFFF) -- #6DFF55
|
||||
apis.term.setPaletteColor(0x400, 0x924900) -- #24FFFF
|
||||
apis.term.setPaletteColor(0x800, 0x6D6D55) -- #924900
|
||||
apis.term.setPaletteColor(0x1000, 0xDBDBAA) -- #6D6D55
|
||||
apis.term.setPaletteColor(0x2000, 0x6D00FF) -- #DBDBAA
|
||||
apis.term.setPaletteColor(0x4000, 0xB6FF00) -- #6D00FF
|
||||
@@ -172,22 +171,22 @@ local ok, err = xpcall(function()
|
||||
end
|
||||
|
||||
local colors = {
|
||||
[0x000000]=0x0001,
|
||||
[0xFFFFFF]=0x0002,
|
||||
[0xFF0000]=0x0004,
|
||||
[0x00FF00]=0x0008,
|
||||
[0x0000FF]=0x0010,
|
||||
[0x00FFFF]=0x0020,
|
||||
[0xFF00FF]=0x0040,
|
||||
[0xFFFF00]=0x0080,
|
||||
[0xFF6D00]=0x0100,
|
||||
[0x6DFF55]=0x0200,
|
||||
[0x24FFFF]=0x0400,
|
||||
[0x924900]=0x0800,
|
||||
[0x6D6D55]=0x1000,
|
||||
[0xDBDBAA]=0x2000,
|
||||
[0x6D00FF]=0x4000,
|
||||
[0xB6FF00]=0x8000
|
||||
[0xFFFFFF]=0x0001,
|
||||
[0xFF0000]=0x0002,
|
||||
[0x00FF00]=0x0004,
|
||||
[0x0000FF]=0x0008,
|
||||
[0x00FFFF]=0x0010,
|
||||
[0xFF00FF]=0x0020,
|
||||
[0xFFFF00]=0x0040,
|
||||
[0xFF6D00]=0x0080,
|
||||
[0x6DFF55]=0x0100,
|
||||
[0x24FFFF]=0x0200,
|
||||
[0x924900]=0x0400,
|
||||
[0x6D6D55]=0x0800,
|
||||
[0xDBDBAA]=0x1000,
|
||||
[0x6D00FF]=0x2000,
|
||||
[0xB6FF00]=0x4000,
|
||||
[0x000000]=0x8000
|
||||
}
|
||||
|
||||
local fg,bg=0x6D6D55,0x000000
|
||||
@@ -401,9 +400,10 @@ local ok, err = xpcall(function()
|
||||
allscreens[i].setTextScale(.5)
|
||||
allscreens[i].clear()
|
||||
allscreens[i].setCursorPos(1,1)
|
||||
allscreens[i].write("Initializing...")
|
||||
end
|
||||
|
||||
allscreens[#allscreens+1] = apis.term
|
||||
|
||||
local EFI = {
|
||||
getEpochMs = function() return apis.os.epoch("utc") end,
|
||||
getUptime = function() return apis.os.clock() * 1000 end,
|
||||
@@ -424,22 +424,38 @@ local ok, err = xpcall(function()
|
||||
initfs=fs,
|
||||
disks=initFs,
|
||||
screenCtl={
|
||||
print = function(_, text) write(text .. "\n") end,
|
||||
printInline = function(_, text) write(text) end,
|
||||
print = function(_, text)
|
||||
for i=1, #allscreens do
|
||||
write(text.."\n", allscreens[i])
|
||||
end
|
||||
end,
|
||||
printInline = function(_, text)
|
||||
for i=1, #allscreens do
|
||||
write(text, allscreens[i])
|
||||
end
|
||||
end,
|
||||
clear = function()
|
||||
apis.term.clear()
|
||||
apis.term.setCursorPos(1, 1)
|
||||
for i=1, #allscreens do
|
||||
allscreens[i].clear()
|
||||
allscreens[i].setCursorPos(1, 1)
|
||||
end
|
||||
end,
|
||||
setCursorPos = function(_, x, y)
|
||||
apis.term.setCursorPos(x, y)
|
||||
resetCursor = function()
|
||||
for i=1, #allscreens do
|
||||
allscreens[i].setCursorPos(1, 1)
|
||||
end
|
||||
end,
|
||||
getCursorPos = function() return apis.term.getCursorPos() end,
|
||||
getSize = function() return apis.term.getSize() end,
|
||||
setBackgroundColor = function(_, color)
|
||||
apis.term.setBackgroundColor(aprox(color))
|
||||
bg=color
|
||||
for i=1, #allscreens do
|
||||
allscreens[i].setBackgroundColor(aprox(color))
|
||||
end
|
||||
end,
|
||||
setTextColor = function(_, color)
|
||||
apis.term.setTextColor(aprox(color))
|
||||
fg=color
|
||||
for i=1, #allscreens do
|
||||
allscreens[i].setTextColor(aprox(color))
|
||||
end
|
||||
end,
|
||||
getBackgroundColor = function()
|
||||
return bg
|
||||
File renamed without changes.
File renamed without changes.
File renamed without changes.
@@ -0,0 +1 @@
|
||||
--:Minify:--
|
||||
-2
@@ -246,7 +246,5 @@ kernel.cct.fifo=fifo
|
||||
newtty(kernel.apis.term, "1", fifo.pop)
|
||||
|
||||
for i,v in ipairs({peripheral.find("monitor")}) do
|
||||
v.setTextScale(.5)
|
||||
v.write("Initializing...")
|
||||
newtty(v,tostring(i+1),function () end)
|
||||
end
|
||||
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
@@ -7,7 +7,8 @@ local disks=EFI.disks
|
||||
local arch=EFI.architecture
|
||||
local kernel = {}
|
||||
kernel.LOG_Text=""
|
||||
kernel.version="HyperionOS V1.2.4"
|
||||
kernel.version="HyperionOS V1.2.4-dev_5"
|
||||
kernel.tag="1.2.4-dev_5"
|
||||
kernel.process = "Kernel"
|
||||
kernel.users={[0]="root",[1]="User"}
|
||||
kernel.hostname = "hyperion"
|
||||
@@ -22,7 +23,7 @@ kernel._G=_G
|
||||
kernel.sleep=sleep
|
||||
|
||||
_G.sleep=nil
|
||||
local windowsExp = false
|
||||
local windowsExp = true
|
||||
|
||||
function kernel.log(msg, level, c)
|
||||
c=c or 0x6D6D6D
|
||||
@@ -51,7 +52,7 @@ function kernel.PANIC(msg)
|
||||
screen:setTextColor(0xFF0000)
|
||||
screen:setBackgroundColor(0x000000)
|
||||
screen:clear()
|
||||
screen:setCursorPos(1,1)
|
||||
screen:resetCursor()
|
||||
screen:print(kernel.LOG_Text)
|
||||
screen:print("KERNEL PANIC!\n"..msg.."\nSystem halted.")
|
||||
screen:print("Press any key to continue...")
|
||||
@@ -72,17 +73,11 @@ if windowsExp then
|
||||
screen:setTextColor(0xFFFFFF)
|
||||
screen:setBackgroundColor(0x0000FF)
|
||||
screen:clear()
|
||||
local w,h = screen:getSize()
|
||||
screen:setCursorPos(3,5)
|
||||
screen:print(":(")
|
||||
screen:setCursorPos(3,7)
|
||||
screen:print("Your PC ran into a problem and needs to restart. We're just collecting some error")
|
||||
screen:setCursorPos(3,8)
|
||||
screen:print("info, and then we'll restart for you.\n")
|
||||
screen:setCursorPos(3,h-5)
|
||||
screen:print("Stop code: average windows experience")
|
||||
screen:setCursorPos(1,h)
|
||||
screen:print("Press any key to continue... jk reboot it yourself lazy")
|
||||
screen:resetCursor()
|
||||
screen:print("\n\n\n\n\n :(")
|
||||
screen:print("\n Your PC ran into a problem and needs to restart. We're just collecting some error")
|
||||
screen:print(" info, and then we'll restart for you.\n")
|
||||
screen:print("\n\n\n Stop code: average windows experience")
|
||||
while true do end
|
||||
end
|
||||
|
||||
@@ -254,6 +249,7 @@ end
|
||||
kernel.syscalls["time"]=function() return kernel.EFI:getEpochMs() end
|
||||
kernel.syscalls["date"]=function() return kernel.EFI:date() end
|
||||
kernel.syscalls["log"]=kernel.log
|
||||
kernel.syscalls["tag"]=function() return kernel.tag end
|
||||
kernel.syscalls["getUptime"]=function() return kernel.EFI:getUptime() end
|
||||
kernel.syscalls["getUsername"]=function(uid) return kernel.users[uid or kernel.uid] end
|
||||
kernel.syscalls["getHostname"]=function() return kernel.hostname end
|
||||
@@ -7,6 +7,5 @@ return {
|
||||
initPath = "/sbin/init",
|
||||
maxOpenFiles = 128,
|
||||
maxFilesPerTask = 16,
|
||||
preempt=true,
|
||||
logTaskExit=true
|
||||
preempt=true
|
||||
}
|
||||
File renamed without changes.
File renamed without changes.
File renamed without changes.
+21
-16
@@ -129,6 +129,8 @@ local function validateComponent(comp)
|
||||
end
|
||||
if lower == ".meta" then
|
||||
error("EINVAL: reserved path component: .meta", 3)
|
||||
elseif lower:sub(#lower) == "." then
|
||||
error("Cannot have empty name extention: " .. comp, 3)
|
||||
end
|
||||
end
|
||||
|
||||
@@ -397,6 +399,10 @@ end
|
||||
local function getFileMeta(path, noFollow)
|
||||
local real = namei(path, noFollow)
|
||||
|
||||
if kernel.unixSockets[real] then
|
||||
return kernel.unixSockets[real].meta
|
||||
end
|
||||
|
||||
if real == "/" then
|
||||
return { etype = 0x00, owner = 0, group = 0, perms = 62, cmeta = "" }
|
||||
end
|
||||
@@ -596,8 +602,8 @@ function vfs.open(path, mode)
|
||||
if not disk then error("NODISK") end
|
||||
if (mode=="w" or mode=="a") and disk:isReadOnly() then error("ERDONLY") end
|
||||
|
||||
if kernel.unixSockets[normalizePath(path)] then
|
||||
local meta = kernel.unixSockets[normalizePath(path)].meta
|
||||
if kernel.unixSockets[namei(path)] then
|
||||
local meta = kernel.unixSockets[namei(path)].meta
|
||||
if kernel.uid~=0 or kernel.uid~=meta.owner then
|
||||
local groups = (task and task.groups) or kernel.groups or {}
|
||||
local access=false
|
||||
@@ -606,7 +612,7 @@ function vfs.open(path, mode)
|
||||
end
|
||||
if not access then error("EACCES") end
|
||||
end
|
||||
task[fd]=kernel.unixSockets[normalizePath(path)]
|
||||
task[fd]=kernel.unixSockets[namei(path)]
|
||||
return fd
|
||||
end
|
||||
|
||||
@@ -711,12 +717,11 @@ end
|
||||
|
||||
function vfs.stat(path)
|
||||
local attrs
|
||||
local meta
|
||||
local disk, diskPath = resolvePath(path)
|
||||
local meta = getFileMeta(path)
|
||||
if meta.etype == 0x02 then
|
||||
attrs = { size=0, modified=0, created=0 }
|
||||
else
|
||||
local disk, diskPath = resolvePath(path)
|
||||
meta = getFileMeta(path)
|
||||
local ok
|
||||
ok, attrs = pcall(disk.attributes, disk, diskPath)
|
||||
if not ok then attrs = { size=0, modified=0, created=0 } end
|
||||
@@ -856,13 +861,13 @@ function vfs.remove(path)
|
||||
|
||||
local meta = getFileMeta(path, true)
|
||||
|
||||
if kernel.unixSockets and kernel.unixSockets[normalizePath(path)] then
|
||||
if kernel.unixSockets[namei(path)] then
|
||||
if kernel.uid ~= 0 then
|
||||
if kernel.unixSockets[normalizePath(path)].meta.owner~=kernel.uid then
|
||||
if kernel.unixSockets[namei(path)].meta.owner~=kernel.uid then
|
||||
error("EACCES")
|
||||
end
|
||||
end
|
||||
kernel.unixSockets[normalizePath(path)] = nil
|
||||
kernel.unixSockets[namei(path)] = nil
|
||||
end
|
||||
|
||||
if meta.etype == 0x01 then
|
||||
@@ -973,7 +978,7 @@ local function updateMeta(path, fn, noFollow)
|
||||
end
|
||||
|
||||
function vfs.chmod(path, perms)
|
||||
if kernel.unixSockets[normalizePath(path)] then error("EINVAL") end
|
||||
if kernel.unixSockets[namei(path)] then error("EINVAL") end
|
||||
local disk = resolveMount(path)
|
||||
if disk:isReadOnly() then error("ERDONLY") end
|
||||
local meta = getFileMeta(path)
|
||||
@@ -985,12 +990,12 @@ end
|
||||
function vfs.fchmod(fd, perms)
|
||||
local file = kernel.currentTask.fd[fd]
|
||||
if not file then error("EBADF") end
|
||||
if file.etype==0x02 then error("EINVAL") end
|
||||
if file.meta.etype==0x02 then error("EINVAL") end
|
||||
vfs.chmod(file.path, perms)
|
||||
end
|
||||
|
||||
function vfs.chown(path, uid, gid)
|
||||
if kernel.unixSockets[normalizePath(path)] then error("EINVAL") end
|
||||
if kernel.unixSockets[namei(path)] then error("EINVAL") end
|
||||
local disk = resolveMount(path)
|
||||
if disk:isReadOnly() then error("ERDONLY") end
|
||||
local _euid = (kernel.currentTask and (kernel.currentTask.euid or kernel.currentTask.uid)) or kernel.uid
|
||||
@@ -1001,14 +1006,14 @@ end
|
||||
function vfs.fchown(fd, uid, gid)
|
||||
local file = kernel.currentTask.fd[fd]
|
||||
if not file then error("EBADF") end
|
||||
if file.etype==0x02 then error("EINVAL") end
|
||||
if file.meta.etype==0x02 then error("EINVAL") end
|
||||
vfs.chown(file.path, uid, gid)
|
||||
end
|
||||
|
||||
function vfs.exists(path)
|
||||
if kernel.unixSockets[normalizePath(path)] then return true end
|
||||
if kernel.unixSockets[namei(path)] then return true end
|
||||
local meta = getFileMeta(path, true)
|
||||
if meta.etype == 0x01 then return true end
|
||||
if meta.etype == 0x01 or meta.etype == 0x02 then return true end
|
||||
local ok, disk, diskPath = pcall(resolvePath, path)
|
||||
if not ok then return false end
|
||||
if disk:type(diskPath) then
|
||||
@@ -1021,7 +1026,7 @@ end
|
||||
function vfs.type(path)
|
||||
local meta = getFileMeta(path, true)
|
||||
if meta.etype == 0x01 then return "symlink" end
|
||||
if kernel.unixSockets[normalizePath(path)] then
|
||||
if kernel.unixSockets[namei(path)] then
|
||||
return "socket"
|
||||
end
|
||||
local ok, disk, diskPath = pcall(resolvePath, path)
|
||||
File renamed without changes.
+1
-1
@@ -50,7 +50,7 @@ function proxy:type(path, mode)
|
||||
if type(step[steps[#steps]]) == "table" then
|
||||
return "directory"
|
||||
end
|
||||
error(type(step[steps[#steps]]))
|
||||
error("ENOENT")
|
||||
end
|
||||
|
||||
function proxy:list(path)
|
||||
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
+16
-7
@@ -28,15 +28,15 @@ function socket.socket()
|
||||
local P=kernel.vfs.P
|
||||
local data=kernel.newFifo()
|
||||
local isClosed=false
|
||||
kernel.vfs.newfd({
|
||||
return kernel.vfs.newfd({
|
||||
handle={
|
||||
read=function() if isClosed then error("ECCON") end return data.read() end,
|
||||
write=function() if isClosed then error("ECCON") end return data.write() end,
|
||||
read=function() if isClosed then error("ECCON") end return data.pop() end,
|
||||
write=function(data) if isClosed then error("ECCON") end return data.push(data) end,
|
||||
close=function() isClosed = true end
|
||||
},
|
||||
type="socket",
|
||||
refcount=1,
|
||||
|
||||
socket={},
|
||||
meta={
|
||||
owner=kernel.currentTask.uid,
|
||||
group=kernel.currentTask.uid,
|
||||
@@ -48,11 +48,20 @@ function socket.socket()
|
||||
end
|
||||
|
||||
function socket.connect(fd, address)
|
||||
|
||||
local handler
|
||||
for k, v in pairs(socket.handlers) do
|
||||
if string.hasPrefix(address, k) then
|
||||
handler=v
|
||||
end
|
||||
end
|
||||
handler.connect(kernel.currentTask.fd[fd], address)
|
||||
end
|
||||
|
||||
function socket.listen(fd, backlog)
|
||||
|
||||
error("Not Implemented")
|
||||
end
|
||||
|
||||
kernel.log("Loaded socket module")
|
||||
local sys=kernel.syscalls
|
||||
sys["socket"]=socket.socket
|
||||
|
||||
kernel.log("Loaded socket module")
|
||||
@@ -0,0 +1,4 @@
|
||||
--:Minify:--
|
||||
local kernel=...
|
||||
kernel.unixSockets={}
|
||||
local socket=kernel.socket
|
||||
File renamed without changes.
File renamed without changes.
+29
-9
@@ -203,12 +203,14 @@ function sys.collect(pid)
|
||||
end
|
||||
end
|
||||
|
||||
function sys.kill(pid)
|
||||
function sys.kill(pid, force)
|
||||
local task = tasks[tostring(pid)]
|
||||
if not task then
|
||||
return false, "Task does not exist"
|
||||
elseif task.status == "Z" then
|
||||
return false, "Task is already dead"
|
||||
elseif task.status == "D" and not force then
|
||||
return false, "Cannot kill task waiting for IO"
|
||||
end
|
||||
local caller = kernel.currentTask
|
||||
local ceuid = caller and (caller.euid or caller.uid) or kernel.uid
|
||||
@@ -223,10 +225,14 @@ function sys.stop(pid)
|
||||
local task = tasks[tostring(pid)]
|
||||
if not task then
|
||||
return false, "Task does not exist"
|
||||
elseif task.status ~= "R" then
|
||||
elseif task.status ~= "R" and task.status ~= "S" then
|
||||
return false, "Cannot stop non-running task"
|
||||
else
|
||||
task.status = "T"
|
||||
if task.status == "S" then
|
||||
task.status = "ST"
|
||||
else
|
||||
task.status = "T"
|
||||
end
|
||||
return true
|
||||
end
|
||||
end
|
||||
@@ -235,10 +241,14 @@ function sys.continue(pid)
|
||||
local task = tasks[tostring(pid)]
|
||||
if not task then
|
||||
return false, "Task does not exist"
|
||||
elseif task.status ~= "T" then
|
||||
elseif task.status ~= "T" and task.status ~= "ST" then
|
||||
return false, "Task is not stopped"
|
||||
else
|
||||
task.status = "R"
|
||||
if task.status == "ST" then
|
||||
task.status = "S"
|
||||
else
|
||||
task.status = "R"
|
||||
end
|
||||
return true
|
||||
end
|
||||
end
|
||||
@@ -351,6 +361,11 @@ function kernel.main()
|
||||
task.sleep = 0
|
||||
end
|
||||
|
||||
if task.status == "ST" and kernel.EFI:getEpochMs() >= task.sleep then
|
||||
task.status = "T"
|
||||
task.sleep = 0
|
||||
end
|
||||
|
||||
if task.status == "D" then
|
||||
if task.ksh then
|
||||
coroutine.resume(task.ksh)
|
||||
@@ -364,14 +379,19 @@ function kernel.main()
|
||||
|
||||
if task.sigq and #task.sigq ~= 0 and task.sigh then
|
||||
local coro = coroutine.create(task.sigh)
|
||||
local status,err=coroutine.resumeWithTimeout(coro, 100, table.remove(task.sigq, 1))
|
||||
if status=="error" then
|
||||
task.sigd.error=err
|
||||
local status,err
|
||||
if kernel.config.preempt then
|
||||
status,err=coroutine.resumeWithTimeout(coro, 100, table.remove(task.sigq, 1))
|
||||
else
|
||||
status,err=coroutine.resume(coro, table.remove(task.sigq, 1))
|
||||
end
|
||||
if status=="error" or status==false then
|
||||
task.sigd.error=err or "Unknown"
|
||||
task.sigd.active=false
|
||||
task.sigh=nil
|
||||
task.sigq=nil
|
||||
task.sigd=nil
|
||||
elseif status=="success" then
|
||||
elseif status=="success" or status==true then
|
||||
if err=="syscall" then
|
||||
task.sigd.error="Cannot execute syscalls from signals"
|
||||
task.sigd.active=false
|
||||
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
@@ -1,3 +0,0 @@
|
||||
--:Minify:--
|
||||
local kernel=...
|
||||
kernel.unixSockets={}
|
||||
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
@@ -827,6 +827,12 @@ builtinCmds.df = function(...)
|
||||
end
|
||||
end
|
||||
|
||||
builtinCmds.ops = function()
|
||||
for i,v in pairs(math) do
|
||||
print(i)
|
||||
end
|
||||
end
|
||||
|
||||
local function listDir(dir, prefix)
|
||||
local ok, entries = pcall(syscall.listdir, dir)
|
||||
if not ok or not entries then return {} end
|
||||
@@ -981,6 +987,7 @@ local function doTabComplete(input, cursorPos)
|
||||
end
|
||||
end
|
||||
|
||||
local lastghost=""
|
||||
local function getUserInput()
|
||||
syscall.devctl(1,"sfgc",0x00FF00)
|
||||
syscall.write(1, userhost)
|
||||
@@ -1147,7 +1154,7 @@ end
|
||||
|
||||
local function runCommand(command)
|
||||
do
|
||||
local func = load("return "..command, "@equation", "t", {})
|
||||
local func = load("return "..command, "@equation", "t", math)
|
||||
if func then
|
||||
local ok, result = pcall(func)
|
||||
if ok and type(result)=="number" then print(result); return end
|
||||
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
@@ -95,6 +95,8 @@ local screenSizeStr = syscall.devctl(1, "size")
|
||||
local sizeX = tonumber(screenSizeStr:match("^(%d+)")) or 80
|
||||
|
||||
local list = fs.list(dir)
|
||||
list[#list+1] = "."
|
||||
list[#list+1] = ".."
|
||||
if not cloptions.a then
|
||||
for i = #list, 1, -1 do
|
||||
if list[i]:sub(1, 1) == "." then table.remove(list, i) end
|
||||
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
+5
-1
@@ -4,5 +4,9 @@
|
||||
"hysh",
|
||||
"lua",
|
||||
"micro",
|
||||
"sysinit"
|
||||
"sysinit",
|
||||
"bit32",
|
||||
"json",
|
||||
"muxzcat",
|
||||
"spm"
|
||||
]
|
||||
File renamed without changes.
@@ -300,6 +300,7 @@ local function getUserInput(prompt, history)
|
||||
end
|
||||
|
||||
c(C_PROMPT); w("HyperionOS " .. _VERSION .. "\n")
|
||||
w("Type \"exit()\" to exit.")
|
||||
c(C_NIL)
|
||||
w("Interactive Lua REPL. exit() to quit.\n\n")
|
||||
c(1)
|
||||
File renamed without changes.
File renamed without changes.
@@ -1 +0,0 @@
|
||||
[symlinks]
|
||||
File renamed without changes.
File renamed without changes.
+1973
File diff suppressed because it is too large.
Load diff
@@ -27,6 +27,7 @@ import sys
|
||||
import shutil
|
||||
import argparse
|
||||
import subprocess
|
||||
import json
|
||||
from pathlib import Path
|
||||
from typing import Union
|
||||
|
||||
@@ -92,22 +93,24 @@ def process_root(src_root: Path, out_root: Path, minify: bool, micro: bool, arch
|
||||
for pkg_dir in sorted(src_root.iterdir()):
|
||||
if not pkg_dir.is_dir():
|
||||
continue
|
||||
|
||||
|
||||
if pkg_dir.name[:18] == "Hyperion-firmware-":
|
||||
if pkg_dir.name != f"Hyperion-firmware-{arch}":
|
||||
if prod != True:
|
||||
continue
|
||||
|
||||
data_dir=pkg_dir / "data"
|
||||
|
||||
if not data_dir.is_dir():
|
||||
continue
|
||||
|
||||
print(f"== Package: {pkg_dir.name} ==")
|
||||
|
||||
for src in sorted(pkg_dir.rglob("*")):
|
||||
for src in sorted(data_dir.rglob("*")):
|
||||
if not src.is_file():
|
||||
continue
|
||||
|
||||
rel = src.relative_to(pkg_dir)
|
||||
|
||||
if rel.name=="$PKGCONFIG.ini":
|
||||
continue
|
||||
rel = src.relative_to(data_dir)
|
||||
|
||||
dst = out_root / rel
|
||||
if prod:
|
||||
|
||||
@@ -48,7 +48,6 @@ local function printTitle()
|
||||
print("DESCLAIMER: This will wipe your system on install...")
|
||||
term.write("Bspc: Back | Enter: execute | Tab: description")
|
||||
end
|
||||
printTitle()
|
||||
|
||||
local function pc(text, y, c)
|
||||
local x=(w/2)-#text/2
|
||||
@@ -110,9 +109,7 @@ end
|
||||
|
||||
local releases,page={},1
|
||||
while true do
|
||||
local handle=http.get("https://git.astronand.dev/api/v1/repos/Hyperion/HyperionOS/releases?page="..tostring(page).."&limit=1")
|
||||
local raw=handle.readAll()
|
||||
handle.close()
|
||||
local raw=download("https://git.astronand.dev/api/v1/repos/Hyperion/HyperionOS/releases?page="..tostring(page).."&limit=1")
|
||||
if raw=="[]\n" then
|
||||
break
|
||||
end
|
||||
@@ -130,6 +127,8 @@ local function makePage(start, num)
|
||||
desc=release.body,
|
||||
color=release.prerelease and colors.orange or colors.white,
|
||||
func=function()
|
||||
term.clear()
|
||||
term.setCursorPos(1,1)
|
||||
local data=download("https://git.astronand.dev/Hyperion/HyperionOS/raw/tag/"..release.tag_name.."/Src/install.json")
|
||||
if not data then
|
||||
term.clear()
|
||||
@@ -158,7 +157,9 @@ local function makePage(start, num)
|
||||
return m
|
||||
end
|
||||
|
||||
printTitle()
|
||||
menu(makePage(1,5))
|
||||
if not exitall then error("Exited") end
|
||||
term.clear()
|
||||
term.setCursorPos(1,1)
|
||||
term.setTextColor(colors.white)
|
||||
@@ -187,8 +188,9 @@ local function delDir(dir)
|
||||
fs.delete(dir..list[i])
|
||||
printc(colors.gray, "[ ", colors.red, " DELET ", colors.gray, " ] ", colors.white, dir..list[i])
|
||||
end
|
||||
sleep(.1)
|
||||
sleep(.01)
|
||||
end
|
||||
sleep(.15)
|
||||
end
|
||||
|
||||
delDir("/")
|
||||
@@ -210,7 +212,9 @@ local function installdir(path, dir, pkg)
|
||||
else
|
||||
error("Uh Oh: unknown entrytype "..entry.path)
|
||||
end
|
||||
sleep(.01)
|
||||
end
|
||||
sleep(.15)
|
||||
end
|
||||
|
||||
local function installpkg(pkg)
|
||||
|
||||
@@ -0,0 +1,55 @@
|
||||
local cloptions = {
|
||||
a = false,
|
||||
h = false,
|
||||
l = false,
|
||||
help = false,
|
||||
}
|
||||
local inpArgs = { ... }
|
||||
local args = {}
|
||||
|
||||
for _, v in pairs(inpArgs) do
|
||||
if v:sub(1, 2) == "--" then
|
||||
local opt = v:sub(3)
|
||||
if cloptions[opt] == nil then
|
||||
print("spm: unrecognized option '" .. v .. "'.")
|
||||
print("try 'spm --help' for more information.")
|
||||
return
|
||||
end
|
||||
cloptions[opt] = true
|
||||
elseif v:sub(1, 1) == "-" then
|
||||
for i = 2, #v do
|
||||
local opt = v:sub(i, i)
|
||||
if cloptions[opt] == nil then
|
||||
print("spm: invalid option '-" .. opt .. "'.")
|
||||
print("try 'spm --help' for more information.")
|
||||
return
|
||||
end
|
||||
cloptions[opt] = true
|
||||
end
|
||||
else
|
||||
table.insert(args, v)
|
||||
end
|
||||
end
|
||||
|
||||
local http=http or require("http")
|
||||
local json=json or require("json")
|
||||
local xz =xz or require("xz")
|
||||
|
||||
if cloptions.help then
|
||||
print("Usage: spm [COMMAND] [OPTION] [packages]")
|
||||
print("The Simple package Mannager.")
|
||||
print("")
|
||||
print("Commands:")
|
||||
print(" remove Remove package(s)")
|
||||
print(" update Updates package(s)")
|
||||
print(" install Install package(s)")
|
||||
print(" sync Syncs local registry with servers")
|
||||
print("")
|
||||
print("Options:")
|
||||
print(" --help display this help and exit")
|
||||
return
|
||||
end
|
||||
|
||||
local function getustar()
|
||||
|
||||
end
|
||||
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
@@ -0,0 +1,14 @@
|
||||
{
|
||||
"authors":[
|
||||
"Astronand"
|
||||
],
|
||||
"versions":{
|
||||
"1.0.0":{
|
||||
"dependencies":[
|
||||
"json",
|
||||
"xz"
|
||||
],
|
||||
"package":"https://git.astronand.dev/Hyperion/HyperionOS/raw/branch/main/packages/raw/spm.sp"
|
||||
}
|
||||
}
|
||||
}
|
||||
Loaded 100 of 193 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user