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
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
error('unable to read blockIds.csv')

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -2,22 +2,20 @@ print('\nStarting multishell..')
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.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
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
error(m)
end
-- process fstab
local mounts = Util.readFile('config/fstab')
local mounts = Util.readFile('usr/config/fstab')
if mounts then
for _,l in ipairs(Util.split(mounts)) do
if l:sub(1, 1) ~= '#' then
@ -27,8 +25,16 @@ if mounts then
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))
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')

View File

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

View File

@ -18,9 +18,9 @@ process:newThread('trust_server', function()
else
data = Crypto.decrypt(data, password)
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
Util.writeTable('.known_hosts', trustList)
Util.writeTable('usr/.known_hosts', trustList)
socket:write({ success = true, msg = 'Trust accepted' })
else