1
0
mirror of https://github.com/kepler155c/opus synced 2025-02-06 04:00:03 +00:00
opus/sys/init/6.packages.lua

35 lines
911 B
Lua
Raw Normal View History

local Packages = require('opus.packages')
local Util = require('opus.util')
2018-10-20 20:35:48 -04:00
2018-12-22 22:11:16 -05:00
local fs = _G.fs
local help = _G.help
2018-10-20 20:35:48 -04:00
local shell = _ENV.shell
2018-12-27 03:05:12 -05:00
local appPaths = Util.split(shell.path(), '(.-):')
2018-12-23 17:32:06 -05:00
local helpPaths = Util.split(help.path(), '(.-):')
table.insert(helpPaths, '/sys/help')
2018-10-20 20:35:48 -04:00
2018-11-04 13:00:37 -05:00
for name in pairs(Packages:installed()) do
2018-11-03 18:13:41 -04:00
local packageDir = fs.combine('packages', name)
2018-10-20 20:35:48 -04:00
2019-07-20 16:23:48 -06:00
table.insert(appPaths, 1, '/' .. packageDir)
2019-03-06 11:48:09 -05:00
local apiPath = fs.combine(packageDir, 'apis')
2018-10-21 04:46:40 -04:00
if fs.exists(apiPath) then
fs.mount(fs.combine('rom/modules/main', name), 'linkfs', apiPath)
2018-10-21 04:46:40 -04:00
end
2018-12-22 22:11:16 -05:00
2019-03-06 11:48:09 -05:00
local helpPath = '/' .. fs.combine(packageDir, 'help')
2018-12-22 22:11:16 -05:00
if fs.exists(helpPath) then
table.insert(helpPaths, helpPath)
end
2019-07-01 17:22:19 -04:00
local fstabPath = fs.combine(packageDir, 'etc/fstab')
if fs.exists(fstabPath) then
fs.loadTab(fstabPath)
end
2018-10-20 20:35:48 -04:00
end
2018-12-22 22:11:16 -05:00
help.setPath(table.concat(helpPaths, ':'))
2018-10-20 20:35:48 -04:00
shell.setPath(table.concat(appPaths, ':'))