2019-06-29 02:44:30 -04:00
|
|
|
local fs = _G.fs
|
2017-09-25 22:49:44 -04:00
|
|
|
|
2017-10-20 04:23:17 -04:00
|
|
|
local sandboxEnv = setmetatable({ }, { __index = _G })
|
|
|
|
for k,v in pairs(_ENV) do
|
2018-01-24 17:39:38 -05:00
|
|
|
sandboxEnv[k] = v
|
2017-10-20 04:23:17 -04:00
|
|
|
end
|
2018-01-13 15:17:26 -05:00
|
|
|
|
2019-06-29 02:44:30 -04:00
|
|
|
local function run(file, ...)
|
2018-01-24 17:39:38 -05:00
|
|
|
local env = setmetatable({ }, { __index = _G })
|
|
|
|
for k,v in pairs(sandboxEnv) do
|
|
|
|
env[k] = v
|
|
|
|
end
|
2016-12-11 14:24:52 -05:00
|
|
|
|
2019-06-29 02:44:30 -04:00
|
|
|
local s, m = loadfile(file, env)
|
2018-01-24 17:39:38 -05:00
|
|
|
if s then
|
|
|
|
return s(...)
|
|
|
|
end
|
|
|
|
error('Error loading ' .. file .. '\n' .. m)
|
2016-12-11 14:24:52 -05:00
|
|
|
end
|
|
|
|
|
2019-06-29 02:44:30 -04:00
|
|
|
_G._syslog = function() end
|
|
|
|
_G.OPUS_BRANCH = 'develop-1.8'
|
2017-09-25 22:49:44 -04:00
|
|
|
|
2018-01-20 07:18:13 -05:00
|
|
|
-- Install require shim
|
2019-06-29 02:44:30 -04:00
|
|
|
_G.requireInjector = run('sys/modules/opus/injector.lua')
|
2017-05-20 18:27:26 -04:00
|
|
|
|
2019-02-12 17:03:50 -05:00
|
|
|
local s, m = pcall(run, 'sys/apps/shell.lua', 'sys/kernel.lua', ...)
|
2018-01-11 20:53:32 -05:00
|
|
|
|
|
|
|
if not s then
|
2018-01-24 17:39:38 -05:00
|
|
|
print('\nError loading Opus OS\n')
|
|
|
|
_G.printError(m .. '\n')
|
2018-01-11 20:53:32 -05:00
|
|
|
end
|
2017-09-25 22:49:44 -04:00
|
|
|
|
2018-01-13 15:17:26 -05:00
|
|
|
if fs.restore then
|
2018-01-24 17:39:38 -05:00
|
|
|
fs.restore()
|
2018-01-13 15:17:26 -05:00
|
|
|
end
|