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
|
2017-09-25 21:07:18 +00:00
|
|
|
printError('Error loading ' .. file)
|
|
|
|
error(m)
|
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-25 21:14:08 +00:00
|
|
|
shell.setPath('usr/apps:sys/apps:' .. shell.path())
|
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
|
2017-09-25 21:02:28 +00:00
|
|
|
local file = io.open('usr/etc/fstab', "w")
|
|
|
|
file:write('usr gitfs kepler155c/opus-apps/master')
|
|
|
|
file:close()
|
2017-09-25 21:00:02 +00:00
|
|
|
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 = { ... }
|
2017-09-25 21:10:24 +00:00
|
|
|
args[1] = args[1] or 'sys/apps/multishell'
|
2016-12-11 19:24:52 +00:00
|
|
|
|
2017-09-25 21:10:24 +00:00
|
|
|
run('sys/apps/shell', table.unpack(args))
|