Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local function dourl(env, url)
- local h = http.get(url)
- if h then
- local fn, m = load(h.readAll(), url, nil, getfenv(1))
- h.close()
- if fn then
- return fn()
- end
- end
- error('Failed to download ' .. url)
- end
- local args = { ... }
- local BASE = 'https://raw.githubusercontent.com/kepler155c/opus/develop/'
- local s, m = pcall(function()
- LUA_UPATH = BASE .. 'sys/apis'
- local env = { }
- for k,v in pairs(getfenv(1)) do
- env[k] = v
- end
- setmetatable(env, { __index = _G })
- _G.Util = dourl(env, BASE .. 'sys/apis/util.lua')
- _G.requireInjector = dourl(env, BASE .. 'sys/apis/injector.lua')
- -- install vfs
- local s, m = Util.runUrl(env, BASE .. 'sys/extensions/vfs.lua')
- if not s then
- error(m)
- end
- -- install filesystem
- fs.mount('', 'gitfs', args[2], args[3], args[4])
- -- start program
- local s, m = os.run(getfenv(1), args[1] or 'startup')
- if not s and m then
- error(m)
- end
- end)
- if not s and m then
- printError(m)
- end
- if fs.restore then
- fs.restore()
- end
- _G.Util = nil
- _G.requireInjector = nil
- print('press enter to continue')
- read()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement