1
0
mirror of https://github.com/kepler155c/opus synced 2024-11-19 23:24:50 +00:00
opus/sys/boot/multishell.boot

51 lines
1.0 KiB
Plaintext
Raw Normal View History

2017-07-28 23:01:59 +00:00
print('\nStarting Opus..')
2016-12-11 19:24:52 +00:00
2017-09-25 21:00:02 +00:00
local function run(file, ...)
local env = setmetatable({
LUA_PATH = '/sys/apis:/usr/apis'
}, { __index = _G })
for k,v in pairs(getfenv(1)) do
env[k] = v
end
2016-12-11 19:24:52 +00:00
2017-09-25 21:00:02 +00:00
local s, m = loadfile(file, env)
if s then
local args = { ... }
s, m = pcall(function()
return s(table.unpack(args))
end)
end
2016-12-11 19:24:52 +00:00
2017-09-25 21:00:02 +00:00
if not s then
error(m or ('Error running ' .. file))
2016-12-11 19:24:52 +00:00
end
2017-09-25 21:00:02 +00:00
return m
2016-12-11 19:24:52 +00:00
end
2017-09-25 21:00:02 +00:00
_G.requireInjector = run('sys/apis/injector.lua')
2017-09-15 05:08:04 +00:00
2017-05-20 22:27:26 +00:00
-- user environment
if not fs.exists('usr/apps') then
fs.makeDir('usr/apps')
end
if not fs.exists('usr/autorun') then
fs.makeDir('usr/autorun')
end
2017-09-25 21:00:02 +00:00
if not fs.exists('usr/etc/fstab') then
Util.writeFile('usr/etc/fstab', 'usr gitfs kepler155c/opus-apps/master')
end
local dir = 'sys/extensions'
for _,file in ipairs(fs.list(dir)) do
run('sys/apps/shell', fs.combine(dir, file))
end
2017-05-20 22:27:26 +00:00
2017-09-25 21:00:02 +00:00
fs.loadTab('usr/etc/fstab')
local args = { ... }
if #args == 0 then
args = { 'sys/apps/shell', 'sys/apps/multishell' }
end
2016-12-11 19:24:52 +00:00
2017-09-25 21:00:02 +00:00
run(table.unpack(args))