remove alternates - add ccemux peripherals upon system startup
This commit is contained in:
@@ -21,11 +21,4 @@ Restorable history
|
|||||||
Partial CCKernel2 support
|
Partial CCKernel2 support
|
||||||
Full compatibility with CraftOS shell.lua]],
|
Full compatibility with CraftOS shell.lua]],
|
||||||
license = 'MIT',
|
license = 'MIT',
|
||||||
install = [[
|
|
||||||
require('opus.alternate').set('shell', 'packages/cash/cash.lua')
|
|
||||||
require('opus.util').writeFile('.cashrc', 'set TERMINATE_QUIT=yes')
|
|
||||||
]],
|
|
||||||
uninstall = [[
|
|
||||||
require('opus.alternate').remove('shell', 'packages/cash/cash.lua')
|
|
||||||
]],
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,20 +1,11 @@
|
|||||||
local ccemux = _G.ccemux
|
local ccemux = _G.ccemux
|
||||||
local fs = _G.fs
|
local fs = _G.fs
|
||||||
local peripheral = _G.peripheral
|
|
||||||
local textutils = _G.textutils
|
local textutils = _G.textutils
|
||||||
|
|
||||||
if ccemux then
|
if ccemux then
|
||||||
-- add a System setup tab
|
-- add a System setup tab
|
||||||
fs.mount('sys/apps/system/ccemux.lua', 'linkfs', 'packages/ccemux/system/ccemux.lua')
|
fs.mount('sys/apps/system/ccemux.lua', 'linkfs', 'packages/ccemux/system/ccemux.lua')
|
||||||
|
|
||||||
local Config = require('opus.config')
|
|
||||||
|
|
||||||
for k,v in pairs(Config.load('ccemux')) do
|
|
||||||
if not peripheral.getType(k) then
|
|
||||||
ccemux.attach(k, v.type, v.args)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
_G.kernel.hook('clipboard_copy', function(_, args)
|
_G.kernel.hook('clipboard_copy', function(_, args)
|
||||||
local data = args[1]
|
local data = args[1]
|
||||||
if type(data) == 'table' then
|
if type(data) == 'table' then
|
||||||
|
|||||||
20
ccemux/bin/emustartup.lua
Normal file
20
ccemux/bin/emustartup.lua
Normal file
@@ -0,0 +1,20 @@
|
|||||||
|
local ccemux
|
||||||
|
ccemux = _G.ccemux
|
||||||
|
local fs
|
||||||
|
fs = _G.fs
|
||||||
|
local peripheral
|
||||||
|
peripheral = _G.peripheral
|
||||||
|
local unserialize
|
||||||
|
unserialize = _G.textutils.unserialize
|
||||||
|
local CONFIG = 'usr/config/ccemux'
|
||||||
|
if ccemux and fs.exists(CONFIG) then
|
||||||
|
local f = fs.open(CONFIG, 'r')
|
||||||
|
local c = unserialize(f.readAll())
|
||||||
|
f.close()
|
||||||
|
for k, v in pairs(c) do
|
||||||
|
if not peripheral.getType(k) then
|
||||||
|
ccemux.attach(k, v.type, v.args)
|
||||||
|
print(k)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
16
ccemux/bin/emustartup.moon
Normal file
16
ccemux/bin/emustartup.moon
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
import ccemux from _G
|
||||||
|
import fs from _G
|
||||||
|
import peripheral from _G
|
||||||
|
import unserialize from _G.textutils
|
||||||
|
|
||||||
|
CONFIG = 'usr/config/ccemux'
|
||||||
|
|
||||||
|
if ccemux and fs.exists CONFIG
|
||||||
|
f = fs.open(CONFIG, 'r')
|
||||||
|
c = unserialize(f.readAll())
|
||||||
|
f.close()
|
||||||
|
|
||||||
|
for k,v in pairs c
|
||||||
|
if not peripheral.getType(k)
|
||||||
|
ccemux.attach(k, v.type, v.args)
|
||||||
|
print k
|
||||||
@@ -1,5 +1,6 @@
|
|||||||
local Config = require('opus.config')
|
local Config = require('opus.config')
|
||||||
local UI = require('opus.ui')
|
local UI = require('opus.ui')
|
||||||
|
local Util = require('opus.util')
|
||||||
|
|
||||||
local ccemux = _G.ccemux
|
local ccemux = _G.ccemux
|
||||||
|
|
||||||
@@ -62,7 +63,23 @@ function tab:updatePeripherals(config)
|
|||||||
self.grid:update()
|
self.grid:update()
|
||||||
end
|
end
|
||||||
|
|
||||||
|
function tab.bootCheck()
|
||||||
|
local startupFile = 'packages/ccemux/bin/emustartup.lua'
|
||||||
|
|
||||||
|
local c = Util.readTable('.startup.boot')
|
||||||
|
if c then
|
||||||
|
for _,v in pairs(c.preload) do
|
||||||
|
if v == startupFile then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
table.insert(c.preload, startupFile)
|
||||||
|
Util.writeTable('.startup.boot', c)
|
||||||
|
end
|
||||||
|
|
||||||
function tab:enable()
|
function tab:enable()
|
||||||
|
self:bootCheck()
|
||||||
local config = Config.load('ccemux')
|
local config = Config.load('ccemux')
|
||||||
|
|
||||||
local choices = { }
|
local choices = { }
|
||||||
|
|||||||
11
mbs/.package
11
mbs/.package
@@ -8,15 +8,4 @@ https://github.com/SquidDev-CC/mbs
|
|||||||
MBS is a series of utilities for improving the default CraftOS experience.
|
MBS is a series of utilities for improving the default CraftOS experience.
|
||||||
]],
|
]],
|
||||||
license = 'MIT',
|
license = 'MIT',
|
||||||
install = [[
|
|
||||||
local Alt = require('opus.alternate')
|
|
||||||
Alt.set('shell', '.mbs/bin/shell.lua')
|
|
||||||
Alt.add('lua', '.mbs/bin/lua.lua')
|
|
||||||
]],
|
|
||||||
uninstall = [[
|
|
||||||
local Alt = require('opus.alternate')
|
|
||||||
Alt.remove('shell', '.mbs/bin/shell.lua')
|
|
||||||
Alt.remove('lua', '.mbs/bin/lua.lua')
|
|
||||||
fs.delete('.mbs')
|
|
||||||
]],
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
local Alt = require('opus.alternate')
|
|
||||||
local Terminal = require('opus.terminal')
|
local Terminal = require('opus.terminal')
|
||||||
local trace = require('opus.trace')
|
local trace = require('opus.trace')
|
||||||
local Util = require('opus.util')
|
local Util = require('opus.util')
|
||||||
@@ -496,7 +495,7 @@ local function addShell()
|
|||||||
process.co = coroutine.create(function()
|
process.co = coroutine.create(function()
|
||||||
print('To run a program on the monitor, type "fg <program>"')
|
print('To run a program on the monitor, type "fg <program>"')
|
||||||
print('To quit, type "exit"')
|
print('To quit, type "exit"')
|
||||||
os.run(shell.makeEnv(_ENV), Alt.get('shell'))
|
os.run(shell.makeEnv(_ENV), shell.resolveProgram('shell'))
|
||||||
multishell.stop()
|
multishell.stop()
|
||||||
end)
|
end)
|
||||||
|
|
||||||
|
|||||||
@@ -4,4 +4,5 @@ packages/moonscript/moonc linkfs packages/moonscript/repo/bin/moonc
|
|||||||
rom/modules/main/moonscript linkfs packages/moonscript/repo/moonscript
|
rom/modules/main/moonscript linkfs packages/moonscript/repo/moonscript
|
||||||
rom/modules/main/moon linkfs packages/moonscript/repo/moon
|
rom/modules/main/moon linkfs packages/moonscript/repo/moon
|
||||||
#rom/modules/main/moonutil gitfs natnat-mc/moonutil/master/moonutil
|
#rom/modules/main/moonutil gitfs natnat-mc/moonutil/master/moonutil
|
||||||
rom/modules/main/argparse urlfs https://raw.githubusercontent.com/mpeterv/argparse/master/src/argparse.lua
|
#rom/modules/main/argparse urlfs https://raw.githubusercontent.com/mpeterv/argparse/master/src/argparse.lua
|
||||||
|
rom/modules/main/argparse urlfs https://raw.githubusercontent.com/luarocks/argparse/master/src/argparse.lua
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
[ 'builder' ] = 'https://raw.githubusercontent.com/kepler155c/opus-apps/develop-1.8/builder/.package',
|
[ 'builder' ] = 'https://raw.githubusercontent.com/kepler155c/opus-apps/develop-1.8/builder/.package',
|
||||||
[ 'busted' ] = 'https://raw.githubusercontent.com/kepler155c/opus-apps/develop-1.8/busted/.package',
|
-- [ 'busted' ] = 'https://raw.githubusercontent.com/kepler155c/opus-apps/develop-1.8/busted/.package',
|
||||||
[ 'cash' ] = 'https://raw.githubusercontent.com/kepler155c/opus-apps/develop-1.8/cash/.package',
|
[ 'cash' ] = 'https://raw.githubusercontent.com/kepler155c/opus-apps/develop-1.8/cash/.package',
|
||||||
[ 'ccemux' ] = 'https://raw.githubusercontent.com/kepler155c/opus-apps/develop-1.8/ccemux/.package',
|
[ 'ccemux' ] = 'https://raw.githubusercontent.com/kepler155c/opus-apps/develop-1.8/ccemux/.package',
|
||||||
[ 'common' ] = 'https://raw.githubusercontent.com/kepler155c/opus-apps/develop-1.8/common/.package',
|
[ 'common' ] = 'https://raw.githubusercontent.com/kepler155c/opus-apps/develop-1.8/common/.package',
|
||||||
@@ -10,7 +10,6 @@
|
|||||||
[ 'farms' ] = 'https://raw.githubusercontent.com/kepler155c/opus-apps/develop-1.8/farms/.package',
|
[ 'farms' ] = 'https://raw.githubusercontent.com/kepler155c/opus-apps/develop-1.8/farms/.package',
|
||||||
-- [ 'forestry' ] = 'https://raw.githubusercontent.com/kepler155c/opus-apps/develop-1.8/forestry/.package',
|
-- [ 'forestry' ] = 'https://raw.githubusercontent.com/kepler155c/opus-apps/develop-1.8/forestry/.package',
|
||||||
[ 'games' ] = 'https://raw.githubusercontent.com/kepler155c/opus-apps/develop-1.8/games/.package',
|
[ 'games' ] = 'https://raw.githubusercontent.com/kepler155c/opus-apps/develop-1.8/games/.package',
|
||||||
-- [ 'glasses' ] = 'https://raw.githubusercontent.com/kepler155c/opus-apps/develop-1.8/glasses/.package',
|
|
||||||
[ 'gps' ] = 'https://raw.githubusercontent.com/kepler155c/opus-apps/develop-1.8/gps/.package',
|
[ 'gps' ] = 'https://raw.githubusercontent.com/kepler155c/opus-apps/develop-1.8/gps/.package',
|
||||||
[ 'lfs' ] = 'https://raw.githubusercontent.com/kepler155c/opus-apps/develop-1.8/lfs/.package',
|
[ 'lfs' ] = 'https://raw.githubusercontent.com/kepler155c/opus-apps/develop-1.8/lfs/.package',
|
||||||
[ 'lpeg' ] = 'https://raw.githubusercontent.com/kepler155c/opus-apps/develop-1.8/lpeg/.package',
|
[ 'lpeg' ] = 'https://raw.githubusercontent.com/kepler155c/opus-apps/develop-1.8/lpeg/.package',
|
||||||
|
|||||||
Reference in New Issue
Block a user