major directory reorganize

This commit is contained in:
kepler155c@gmail.com 2017-05-20 18:27:26 -04:00
parent 7954c79d66
commit c8147ef9e8
85 changed files with 67 additions and 59 deletions

View File

@ -68,7 +68,7 @@ function blockDB:seedDB(dir)
return res return res
end end
local f = fs.open(fs.combine(dir, 'blockIds.csv'), "r") local f = fs.open(fs.combine('sys/etc', 'blockIds.csv'), "r")
if not f then if not f then
error('unable to read blockIds.csv') error('unable to read blockIds.csv')

View File

@ -3,10 +3,10 @@ local Util = require('util')
local Config = { } local Config = { }
Config.load = function(fname, data) Config.load = function(fname, data)
local filename = '/config/' .. fname local filename = 'usr/config/' .. fname
if not fs.exists('/config') then if not fs.exists('usr/config') then
fs.makeDir('/config') fs.makeDir('usr/config')
end end
if not fs.exists(filename) then if not fs.exists(filename) then
@ -17,7 +17,7 @@ Config.load = function(fname, data)
end end
Config.update = function(fname, data) Config.update = function(fname, data)
local filename = '/config/' .. fname local filename = 'usr/config/' .. fname
Util.writeTable(filename, data) Util.writeTable(filename, data)
end end

View File

@ -146,7 +146,7 @@ local function trusted(msg, port)
return true return true
end end
local trustList = Util.readTable('.known_hosts') or { } local trustList = Util.readTable('usr/.known_hosts') or { }
local pubKey = trustList[msg.shost] local pubKey = trustList[msg.shost]
if pubKey then if pubKey then

View File

@ -202,7 +202,7 @@ function Manager:configure(appName, ...)
textScale = { arg = 't', type = 'number', textScale = { arg = 't', type = 'number',
desc = 'Text scale' }, desc = 'Text scale' },
} }
local defaults = Util.loadTable('/config/' .. appName) or { } local defaults = Util.loadTable('usr/config/' .. appName) or { }
if not defaults.device then if not defaults.device then
defaults.device = { } defaults.device = { }
end end
@ -3321,7 +3321,7 @@ function UI.NftImage:setImage(image)
self.image = image self.image = image
end end
UI:loadTheme('config/ui.theme') UI:loadTheme('usr/config/ui.theme')
if os.getVersion() >= 1.79 then if os.getVersion() >= 1.79 then
UI:loadTheme('sys/etc/ext.theme') UI:loadTheme('sys/etc/ext.theme')
end end

View File

@ -4,5 +4,5 @@
\030 \031f \0310o \031f \0310o\031f ", \030 \031f \0310o \031f \0310o\031f ",
category = "System", category = "System",
title = "AppStore", title = "AppStore",
run = "/apps/Appstore.lua", run = "Appstore.lua",
} }

View File

@ -4,5 +4,5 @@
\030f\031f \0304 \030 \0311e\031f ", \030f\031f \0304 \030 \0311e\031f ",
title = "Events", title = "Events",
category = "System", category = "System",
run = "apps/Events.lua", run = "Events.lua",
} }

View File

@ -4,5 +4,5 @@
\0300\0317====", \0300\0317====",
title = "Files", title = "Files",
category = "Apps", category = "Apps",
run = "/apps/Files.lua", run = "Files.lua",
} }

View File

@ -4,5 +4,5 @@
\031d?", \031d?",
title = "Help", title = "Help",
category = "Apps", category = "Apps",
run = "/apps/Help.lua", run = "Help.lua",
} }

View File

@ -4,5 +4,5 @@
\030f ", \030f ",
title = "Lua", title = "Lua",
category = "Apps", category = "Apps",
run = "/apps/Lua.lua", run = "Lua.lua",
} }

View File

@ -5,5 +5,5 @@
icon = "\0304 \030 \ icon = "\0304 \030 \
\030f \0304 \0307 \030 \031 \031f)\ \030f \0304 \0307 \030 \031 \031f)\
\030f \0304 \0307 \030 \031f)", \030f \0304 \0307 \030 \031f)",
run = "/apps/Network.lua", run = "Network.lua",
} }

View File

@ -4,5 +4,5 @@
\030f \0304 \0307 \030 \031f/", \030f \0304 \0307 \030 \031f/",
title = "Devices", title = "Devices",
category = "System", category = "System",
run = "/apps/Peripherals.lua", run = "Peripherals.lua",
} }

View File

@ -5,5 +5,5 @@
icon = "\0300\0317if\031 \0307 \ icon = "\0300\0317if\031 \0307 \
\0300\0317turt\ \0300\0317turt\
\0300\0317retu", \0300\0317retu",
run = "/apps/Script.lua", run = "Script.lua",
} }

View File

@ -4,5 +4,5 @@
\0307\031f| ", \0307\031f| ",
title = "System", title = "System",
category = "System", category = "System",
run = "/apps/System.lua", run = "System.lua",
} }

View File

@ -4,5 +4,5 @@
\0303 ", \0303 ",
title = "Tabs", title = "Tabs",
category = "System", category = "System",
run = "/apps/Tabs.lua", run = "Tabs.lua",
} }

View File

@ -1,5 +1,5 @@
{ {
category = "Apps", category = "Apps",
title = "Turtles", title = "Turtles",
run = "apps/Turtles.lua", run = "Turtles.lua",
} }

View File

@ -4,5 +4,5 @@
\030f\0314?\031f \031 \030 ", \030f\0314?\031f \031 \030 ",
title = "Adventure", title = "Adventure",
category = "Games", category = "Games",
run = "/rom/programs/fun/adventure", run = "rom/programs/fun/adventure",
} }

View File

@ -4,5 +4,5 @@
\030e\031c#\0307\031f.\030e\031c###", \030e\031c#\0307\031f.\030e\031c###",
title = "Builder", title = "Builder",
category = "Apps", category = "Apps",
run = "/apps/builder.lua", run = "builder.lua",
} }

View File

@ -4,5 +4,5 @@
\030e \0309 \0301 ", \030e \0309 \0301 ",
title = "Falling", title = "Falling",
category = "Games", category = "Games",
run = "/rom/programs/pocket/falling", run = "rom/programs/pocket/falling",
} }

View File

@ -4,5 +4,5 @@
\0304\031f - ", \0304\031f - ",
title = "Reboot", title = "Reboot",
category = "System", category = "System",
run = "/rom/programs/reboot", run = "rom/programs/reboot",
} }

View File

@ -4,5 +4,5 @@
\030 \031b \030e \030 \031f\\", \030 \031b \030e \030 \031f\\",
category = "Apps", category = "Apps",
title = "Recorder", title = "Recorder",
run = "/apps/recorder.lua", run = "recorder.lua",
} }

View File

@ -4,5 +4,5 @@
\0307 ", \0307 ",
title = "Redirection", title = "Redirection",
category = "Games", category = "Games",
run = "/rom/programs/fun/advanced/redirection", run = "rom/programs/fun/advanced/redirection",
} }

View File

@ -4,5 +4,5 @@
\0304 \030f \030 ", \0304 \030f \030 ",
title = "Shell", title = "Shell",
category = "Apps", category = "Apps",
run = "/apps/shell", run = "shell",
} }

View File

@ -4,5 +4,5 @@
\0304 ", \0304 ",
title = "Miner", title = "Miner",
category = "Apps", category = "Apps",
run = "/apps/simpleMiner.lua", run = "simpleMiner.lua",
} }

View File

@ -4,5 +4,5 @@
\0318\\\030f\031 \030 \0318/", \0318\\\030f\031 \030 \0318/",
title = "Activity", title = "Activity",
category = "Apps", category = "Apps",
run = "/apps/storageActivity.lua", run = "storageActivity.lua",
} }

View File

@ -4,5 +4,5 @@
\0307 ", \0307 ",
title = "Storage", title = "Storage",
category = "Apps", category = "Apps",
run = "/apps/storageManager.lua", run = "storageManager.lua",
} }

View File

@ -4,5 +4,5 @@
\0314>\0310_\031 ", \0314>\0310_\031 ",
title = "Telnet", title = "Telnet",
category = "Apps", category = "Apps",
run = "/apps/telnet.lua", run = "telnet.lua",
} }

View File

@ -4,5 +4,5 @@
\0301\03170\03180\03171\0307\031f>", \0301\03170\03180\03171\0307\031f>",
title = "Update", title = "Update",
category = "System", category = "System",
run = "/apps/update.lua", run = "update.lua",
} }

View File

@ -4,5 +4,5 @@
\031e\\/\031 \0319c", \031e\\/\031 \0319c",
title = "VNC", title = "VNC",
category = "Apps", category = "Apps",
run = "/apps/vnc.lua", run = "vnc.lua",
} }

View File

@ -14,7 +14,7 @@ multishell.setTitle(multishell.getCurrent(), 'Lua')
UI:configure('Lua', ...) UI:configure('Lua', ...)
local command = '' local command = ''
local history = History.load('.lua_history', 25) local history = History.load('usr/.lua_history', 25)
local page = UI.Page({ local page = UI.Page({
menuBar = UI.MenuBar({ menuBar = UI.MenuBar({

View File

@ -21,11 +21,11 @@ Config.load('Overview', config)
local function loadApplications() local function loadApplications()
Util.clear(applications) Util.clear(applications)
local apps = fs.list('apps/.overview') local apps = fs.list('sys/apps/.overview')
for _,app in pairs(apps) do for _,app in pairs(apps) do
local data = Util.readTable('apps/.overview/' .. app) local data = Util.readTable('sys/apps/.overview/' .. app)
if data then if data then
data.filename = 'apps/.overview/' .. app data.filename = 'sys/apps/.overview/' .. app
table.insert(applications, data) table.insert(applications, data)
end end
end end
@ -275,20 +275,20 @@ function page:eventHandler(event)
end end
Config.update('Overview', config) Config.update('Overview', config)
multishell.openTab({ multishell.openTab({
path = '/apps/shell', path = 'sys/apps/shell',
args = { event.button.app.run }, args = { event.button.app.run },
focused = true, focused = true,
}) })
elseif event.type == 'shell' then elseif event.type == 'shell' then
multishell.openTab({ multishell.openTab({
path = '/apps/shell', path = 'sys/apps/shell',
focused = true, focused = true,
}) })
elseif event.type == 'lua' then elseif event.type == 'lua' then
multishell.openTab({ multishell.openTab({
path = '/apps/Lua.lua', path = 'sys/apps/Lua.lua',
focused = true, focused = true,
}) })
@ -396,7 +396,7 @@ end
function editor:updateApplications(app) function editor:updateApplications(app)
if not app.filename then if not app.filename then
app.filename = 'apps/.overview/' .. app.title app.filename = 'sys/apps/.overview/' .. app.title
end end
Util.writeTable(app.filename, app) Util.writeTable(app.filename, app)
loadApplications() loadApplications()

View File

@ -4,8 +4,8 @@ local UI = require('ui')
local Socket = require('socket') local Socket = require('socket')
local Config = require('config') local Config = require('config')
local GROUPS_PATH = '/apps/groups' local GROUPS_PATH = 'usr/groups'
local SCRIPTS_PATH = '/apps/scripts' local SCRIPTS_PATH = 'usr/scripts'
multishell.setTitle(multishell.getCurrent(), 'Script') multishell.setTitle(multishell.getCurrent(), 'Script')
UI:configure('script', ...) UI:configure('script', ...)

View File

@ -28,7 +28,7 @@ else
Logger.setDaemonLogging() Logger.setDaemonLogging()
end end
local BUILDER_DIR = '.builder' local BUILDER_DIR = 'usr/builder'
local schematic = Schematic() local schematic = Schematic()
local blocks = Blocks({ dir = BUILDER_DIR }) local blocks = Blocks({ dir = BUILDER_DIR })

View File

@ -45,7 +45,7 @@ local config = {
tabBarBackgroundColor = colors.brown, tabBarBackgroundColor = colors.brown,
}, },
-- path = '.:/apps:' .. shell.path():sub(3), -- path = '.:/apps:' .. shell.path():sub(3),
path = '/apps:' .. shell.path(), path = 'usr/apps:sys/apps:' .. shell.path(),
} }
Config.load('multishell', config) Config.load('multishell', config)
@ -474,18 +474,19 @@ local function startup()
end end
end end
runDir('/sys/extensions', '[ ext ] ', shell.run) runDir('sys/extensions', '[ ext ] ', shell.run)
local overviewId = multishell.openTab({ local overviewId = multishell.openTab({
path = '/apps/Overview.lua', path = 'sys/apps/Overview.lua',
focused = true, focused = true,
hidden = true, hidden = true,
isOverview = true, isOverview = true,
}) })
overviewTab = tabs[overviewId] overviewTab = tabs[overviewId]
runDir('/sys/services', '[ svc ] ', shell.openHiddenTab) runDir('sys/services', '[ svc ] ', shell.openHiddenTab)
runDir('/autorun', '[ aut ] ', shell.run) runDir('sys/autorun', '[ aut ] ', shell.run)
runDir('usr/autorun', '[ aut ] ', shell.run)
if hasError then if hasError then
error('An autorun program has errored') error('An autorun program has errored')

View File

@ -592,7 +592,7 @@ local function shellRead(_tHistory )
return sLine return sLine
end end
local history = History.load('.shell_history', 25) local history = History.load('usr/.shell_history', 25)
while not bExit do while not bExit do
if config.displayDirectory then if config.displayDirectory then

View File

@ -2,22 +2,20 @@ print('\nStarting multishell..')
LUA_PATH = '/sys/apis' LUA_PATH = '/sys/apis'
-- math.randomseed(os.clock()) -- totally broken _G.Util = dofile('sys/apis/util.lua')
_G.Util = dofile('/sys/apis/util.lua')
_G.debug = function(...) Util.print(...) end _G.debug = function(...) Util.print(...) end
_G.requireInjector = dofile('/sys/apis/injector.lua') _G.requireInjector = dofile('sys/apis/injector.lua')
os.run(Util.shallowCopy(getfenv(1)), '/sys/extensions/device.lua') os.run(Util.shallowCopy(getfenv(1)), 'sys/extensions/device.lua')
-- vfs -- vfs
local s, m = os.run(Util.shallowCopy(getfenv(1)), '/sys/extensions/vfs.lua') local s, m = os.run(Util.shallowCopy(getfenv(1)), 'sys/extensions/vfs.lua')
if not s then if not s then
error(m) error(m)
end end
-- process fstab -- process fstab
local mounts = Util.readFile('config/fstab') local mounts = Util.readFile('usr/config/fstab')
if mounts then if mounts then
for _,l in ipairs(Util.split(mounts)) do for _,l in ipairs(Util.split(mounts)) do
if l:sub(1, 1) ~= '#' then if l:sub(1, 1) ~= '#' then
@ -27,8 +25,16 @@ if mounts then
end end
end end
-- user environment
if not fs.exists('usr/apps') then
fs.makeDir('usr/apps')
end
if not fs.exists('usr/autorun') then
fs.makeDir('usr/autorun')
end
local env = Util.shallowCopy(getfenv(1)) local env = Util.shallowCopy(getfenv(1))
env.multishell = { } env.multishell = { }
local _, m = os.run(env, '/apps/shell', '/apps/multishell') local _, m = os.run(env, 'sys/apps/shell', 'sys/apps/multishell')
printError(m or 'Multishell aborted') printError(m or 'Multishell aborted')

View File

@ -41,6 +41,7 @@ function nativefs.list(node, dir, full)
end end
if not files then if not files then
print(dir)
error('Not a directory') error('Not a directory')
end end

View File

@ -18,9 +18,9 @@ process:newThread('trust_server', function()
else else
data = Crypto.decrypt(data, password) data = Crypto.decrypt(data, password)
if data and data.pk and data.dh == socket.dhost then if data and data.pk and data.dh == socket.dhost then
local trustList = Util.readTable('.known_hosts') or { } local trustList = Util.readTable('usr/.known_hosts') or { }
trustList[data.dh] = data.pk trustList[data.dh] = data.pk
Util.writeTable('.known_hosts', trustList) Util.writeTable('usr/.known_hosts', trustList)
socket:write({ success = true, msg = 'Trust accepted' }) socket:write({ success = true, msg = 'Trust accepted' })
else else