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