mirror of
https://github.com/kepler155c/opus
synced 2026-06-02 10:42:10 +00:00
Initial commit
This commit is contained in:
@@ -0,0 +1,3 @@
|
||||
term.clear()
|
||||
term.setCursorPos(1, 1)
|
||||
print(os.version())
|
||||
@@ -0,0 +1,33 @@
|
||||
print('\nStarting multishell..')
|
||||
|
||||
LUA_PATH = '/sys/apis'
|
||||
|
||||
math.randomseed(os.clock())
|
||||
|
||||
_G.debug = function() end
|
||||
_G.Util = dofile('/sys/apis/util.lua')
|
||||
_G.requireInjector = dofile('/sys/apis/injector.lua')
|
||||
|
||||
os.run(Util.shallowCopy(getfenv(1)), '/sys/extensions/device.lua')
|
||||
|
||||
-- vfs
|
||||
local s, m = os.run(Util.shallowCopy(getfenv(1)), '/sys/extensions/vfs.lua')
|
||||
if not s then
|
||||
error(m)
|
||||
end
|
||||
|
||||
-- process fstab
|
||||
local mounts = Util.readFile('config/fstab')
|
||||
if mounts then
|
||||
for _,l in ipairs(Util.split(mounts)) do
|
||||
if l:sub(1, 1) ~= '#' then
|
||||
fs.mount(unpack(Util.matches(l)))
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
local env = Util.shallowCopy(getfenv(1))
|
||||
env.multishell = { }
|
||||
|
||||
local _, m = os.run(env, '/apps/shell', '/apps/multishell')
|
||||
printError(m or 'Multishell aborted')
|
||||
@@ -0,0 +1,37 @@
|
||||
local pullEvent = os.pullEventRaw
|
||||
local redirect = term.redirect
|
||||
local current = term.current
|
||||
local shutdown = os.shutdown
|
||||
|
||||
local cos = { }
|
||||
|
||||
os.pullEventRaw = function(...)
|
||||
local co = coroutine.running()
|
||||
if not cos[co] then
|
||||
cos[co] = true
|
||||
error('die')
|
||||
end
|
||||
return pullEvent(...)
|
||||
end
|
||||
|
||||
os.shutdown = function()
|
||||
end
|
||||
|
||||
term.current = function()
|
||||
term.redirect = function()
|
||||
os.pullEventRaw = pullEvent
|
||||
os.shutdown = shutdown
|
||||
term.current = current
|
||||
term.redirect = redirect
|
||||
|
||||
term.redirect(term.native())
|
||||
--for co in pairs(cos) do
|
||||
-- print(tostring(co) .. ' ' .. coroutine.status(co))
|
||||
--end
|
||||
os.run(getfenv(1), 'sys/boot/multishell.boot')
|
||||
os.run(getfenv(1), 'rom/programs/shell')
|
||||
end
|
||||
error('die')
|
||||
end
|
||||
|
||||
os.queueEvent('modem_message')
|
||||
Reference in New Issue
Block a user