mirror of
https://github.com/kepler155c/opus
synced 2025-10-10 21:37:43 +00:00
format and installer branches
This commit is contained in:
@@ -1,3 +0,0 @@
|
||||
term.clear()
|
||||
term.setCursorPos(1, 1)
|
||||
print(os.version())
|
@@ -9,69 +9,69 @@ local BASE = 'https://raw.githubusercontent.com/' .. GIT_REPO
|
||||
|
||||
local sandboxEnv = setmetatable({ }, { __index = _G })
|
||||
for k,v in pairs(_ENV) do
|
||||
sandboxEnv[k] = v
|
||||
sandboxEnv[k] = v
|
||||
end
|
||||
sandboxEnv.BRANCH = BRANCH
|
||||
|
||||
_G.debug = function() end
|
||||
|
||||
local function makeEnv()
|
||||
local env = setmetatable({ }, { __index = _G })
|
||||
for k,v in pairs(sandboxEnv) do
|
||||
env[k] = v
|
||||
end
|
||||
return env
|
||||
local env = setmetatable({ }, { __index = _G })
|
||||
for k,v in pairs(sandboxEnv) do
|
||||
env[k] = v
|
||||
end
|
||||
return env
|
||||
end
|
||||
|
||||
local function run(file, ...)
|
||||
local s, m = loadfile(file, makeEnv())
|
||||
if s then
|
||||
return s(...)
|
||||
end
|
||||
error('Error loading ' .. file .. '\n' .. m)
|
||||
local s, m = loadfile(file, makeEnv())
|
||||
if s then
|
||||
return s(...)
|
||||
end
|
||||
error('Error loading ' .. file .. '\n' .. m)
|
||||
end
|
||||
|
||||
local function runUrl(file, ...)
|
||||
local url = BASE .. '/' .. file
|
||||
local url = BASE .. '/' .. file
|
||||
|
||||
local u = http.get(url)
|
||||
if u then
|
||||
local fn = load(u.readAll(), url, nil, makeEnv())
|
||||
u.close()
|
||||
if fn then
|
||||
return fn(...)
|
||||
end
|
||||
end
|
||||
error('Failed to download ' .. url)
|
||||
local u = http.get(url)
|
||||
if u then
|
||||
local fn = load(u.readAll(), url, nil, makeEnv())
|
||||
u.close()
|
||||
if fn then
|
||||
return fn(...)
|
||||
end
|
||||
end
|
||||
error('Failed to download ' .. url)
|
||||
end
|
||||
|
||||
function os.getenv(varname)
|
||||
return sandboxEnv[varname]
|
||||
return sandboxEnv[varname]
|
||||
end
|
||||
|
||||
function os.setenv(varname, value)
|
||||
sandboxEnv[varname] = value
|
||||
sandboxEnv[varname] = value
|
||||
end
|
||||
|
||||
-- Install require shim
|
||||
if fs.exists('sys/apis/injector.lua') then
|
||||
_G.requireInjector = run('sys/apis/injector.lua')
|
||||
_G.requireInjector = run('sys/apis/injector.lua')
|
||||
else
|
||||
-- not local, run the file system directly from git
|
||||
_G.requireInjector = runUrl('sys/apis/injector.lua')
|
||||
runUrl('sys/extensions/2.vfs.lua')
|
||||
-- not local, run the file system directly from git
|
||||
_G.requireInjector = runUrl('sys/apis/injector.lua')
|
||||
runUrl('sys/extensions/2.vfs.lua')
|
||||
|
||||
-- install file system
|
||||
fs.mount('', 'gitfs', GIT_REPO)
|
||||
-- install file system
|
||||
fs.mount('', 'gitfs', GIT_REPO)
|
||||
end
|
||||
|
||||
local s, m = pcall(run, 'sys/apps/shell', 'sys/kernel.lua', ...)
|
||||
|
||||
if not s then
|
||||
print('\nError loading Opus OS\n')
|
||||
_G.printError(m .. '\n')
|
||||
print('\nError loading Opus OS\n')
|
||||
_G.printError(m .. '\n')
|
||||
end
|
||||
|
||||
if fs.restore then
|
||||
fs.restore()
|
||||
fs.restore()
|
||||
end
|
||||
|
@@ -2,14 +2,14 @@ local pullEvent = os.pullEventRaw
|
||||
local shutdown = os.shutdown
|
||||
|
||||
os.pullEventRaw = function()
|
||||
error('')
|
||||
error('')
|
||||
end
|
||||
|
||||
os.shutdown = function()
|
||||
os.pullEventRaw = pullEvent
|
||||
os.shutdown = shutdown
|
||||
os.pullEventRaw = pullEvent
|
||||
os.shutdown = shutdown
|
||||
|
||||
os.run(getfenv(1), 'sys/boot/opus.boot')
|
||||
os.run(getfenv(1), 'sys/boot/opus.boot')
|
||||
end
|
||||
|
||||
os.queueEvent('modem_message')
|
||||
|
Reference in New Issue
Block a user