remove os api modifications

This commit is contained in:
kepler155c@gmail.com 2018-01-26 06:37:49 -05:00
parent 742d1337a8
commit 15a627f7e9
4 changed files with 12 additions and 22 deletions

View File

@ -1,7 +1,8 @@
local PASTEBIN_URL = 'http://pastebin.com/raw'
local GIT_URL = 'https://raw.githubusercontent.com'
local DEFAULT_PATH = 'sys/apis'
local DEFAULT_UPATH = GIT_URL .. '/kepler155c/opus/' .. _ENV.BRANCH .. '/sys/apis'
local PASTEBIN_URL = 'http://pastebin.com/raw'
local GIT_URL = 'https://raw.githubusercontent.com'
local DEFAULT_PATH = 'sys/apis'
local DEFAULT_BRANCH = _ENV.OPUS_BRANCH or _G.OPUS_BRANCH or 'master'
local DEFAULT_UPATH = GIT_URL .. '/kepler155c/opus/' .. DEFAULT_BRANCH .. '/sys/apis'
local fs = _G.fs
local http = _G.http
@ -129,8 +130,8 @@ local function requireWrapper(env)
-- place package and require function into env
env.package = {
path = env.LUA_PATH or (os.getenv and os.getenv('LUA_PATH')) or DEFAULT_PATH,
upath = env.LUA_UPATH or (os.getenv and os.getenv('LUA_UPATH')) or DEFAULT_UPATH,
path = env.LUA_PATH or _G.LUA_PATH or DEFAULT_PATH,
upath = env.LUA_UPATH or _G.LUA_UPATH or DEFAULT_UPATH,
config = '/\n:\n?\n!\n-',
loaded = {
math = math,

View File

@ -6,7 +6,7 @@ local os = _G.os
local injector
if not install.testing then
_ENV.BRANCH = 'develop-1.8'
_G.OPUS_BRANCH = 'develop-1.8'
local url ='https://raw.githubusercontent.com/kepler155c/opus/develop-1.8/sys/apis/injector.lua'
injector = load(http.get(url).readAll(), 'injector.lua', nil, _ENV)()
else

View File

@ -1,17 +1,15 @@
-- Loads the Opus environment regardless if the file system is local or not
local fs = _G.fs
local http = _G.http
local os = _G.os
local BRANCH = 'develop-1.8'
local GIT_REPO = 'kepler155c/opus/' .. BRANCH
_G.OPUS_BRANCH = 'develop-1.8'
local GIT_REPO = 'kepler155c/opus/' .. _G.OPUS_BRANCH
local BASE = 'https://raw.githubusercontent.com/' .. GIT_REPO
local sandboxEnv = setmetatable({ }, { __index = _G })
for k,v in pairs(_ENV) do
sandboxEnv[k] = v
end
sandboxEnv.BRANCH = BRANCH
_G.debug = function() end
@ -45,14 +43,6 @@ local function runUrl(file, ...)
error('Failed to download ' .. url)
end
function os.getenv(varname)
return sandboxEnv[varname]
end
function os.setenv(varname, value)
sandboxEnv[varname] = value
end
-- Install require shim
if fs.exists('sys/apis/injector.lua') then
_G.requireInjector = run('sys/apis/injector.lua')

View File

@ -3,7 +3,6 @@ _G.requireInjector(_ENV)
local Util = require('util')
local fs = _G.fs
local os = _G.os
local shell = _ENV.shell
if not fs.exists('usr/apps') then
@ -14,7 +13,7 @@ if not fs.exists('usr/autorun') then
end
if not fs.exists('usr/config/fstab') then
Util.writeFile('usr/config/fstab',
'usr gitfs kepler155c/opus-apps/' .. os.getenv('BRANCH'))
'usr gitfs kepler155c/opus-apps/' .. _G.OPUS_BRANCH)
end
if not fs.exists('usr/config/shell') then
@ -35,6 +34,6 @@ if config.aliases then
end
end
shell.setPath(config.path)
os.setenv('LUA_PATH', config.lua_path)
_G.LUA_PATH = config.lua_path
fs.loadTab('usr/config/fstab')