mirror of
https://github.com/kepler155c/opus
synced 2025-01-17 19:02:53 +00:00
TLCO fix & boot file extension change (#37)
This commit fixes the TLCO boot option (which hasn't been working for a while now), and also changes boot file extensions from .boot to .lua.
This commit is contained in:
parent
b45cd45bcb
commit
816ea366ab
21
startup.lua
21
startup.lua
@ -29,9 +29,10 @@ local function loadBootOptions()
|
|||||||
preload = { },
|
preload = { },
|
||||||
menu = {
|
menu = {
|
||||||
{ prompt = os.version() },
|
{ prompt = os.version() },
|
||||||
{ prompt = 'Opus' , args = { '/sys/boot/opus.boot' } },
|
{ prompt = 'Opus' , args = { '/sys/boot/opus.lua' } },
|
||||||
{ prompt = 'Opus Shell' , args = { '/sys/boot/opus.boot', 'sys/apps/shell.lua' } },
|
{ prompt = 'Opus Shell' , args = { '/sys/boot/opus.lua', '/sys/apps/shell.lua' } },
|
||||||
{ prompt = 'Opus Kiosk' , args = { '/sys/boot/kiosk.boot' } },
|
{ prompt = 'Opus Kiosk' , args = { '/sys/boot/kiosk.lua' } },
|
||||||
|
{ prompt = 'Opus TLCO' , args = { '/sys/boot/tlco.lua' } },
|
||||||
},
|
},
|
||||||
}))
|
}))
|
||||||
f.close()
|
f.close()
|
||||||
@ -41,6 +42,20 @@ local function loadBootOptions()
|
|||||||
local options = textutils.unserialize(f.readAll())
|
local options = textutils.unserialize(f.readAll())
|
||||||
f.close()
|
f.close()
|
||||||
|
|
||||||
|
-- Backwards compatibility for .startup.boot files created before sys/boot files' extensions were changed
|
||||||
|
local changed = false
|
||||||
|
for _, item in pairs(options.menu) do
|
||||||
|
if item.args and item.args[1]:match("/?sys/boot/%l+%.boot") then
|
||||||
|
item.args[1] = item.args[1]:gsub("%.boot", "%.lua")
|
||||||
|
changed = true
|
||||||
|
end
|
||||||
|
end
|
||||||
|
if changed then
|
||||||
|
local f = fs.open(".startup.boot", "w")
|
||||||
|
f.write(textutils.serialize(options))
|
||||||
|
f.close()
|
||||||
|
end
|
||||||
|
|
||||||
return options
|
return options
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -1,15 +0,0 @@
|
|||||||
local pullEvent = os.pullEventRaw
|
|
||||||
local shutdown = os.shutdown
|
|
||||||
|
|
||||||
os.pullEventRaw = function()
|
|
||||||
error('')
|
|
||||||
end
|
|
||||||
|
|
||||||
os.shutdown = function()
|
|
||||||
os.pullEventRaw = pullEvent
|
|
||||||
os.shutdown = shutdown
|
|
||||||
|
|
||||||
os.run(getfenv(1), 'sys/boot/opus.boot')
|
|
||||||
end
|
|
||||||
|
|
||||||
os.queueEvent('modem_message')
|
|
30
sys/boot/tlco.lua
Normal file
30
sys/boot/tlco.lua
Normal file
@ -0,0 +1,30 @@
|
|||||||
|
local run = os.run
|
||||||
|
local shutdown = os.shutdown
|
||||||
|
|
||||||
|
local args = {...} -- keep the args so that they can be passed to opus.lua
|
||||||
|
|
||||||
|
os.run = function()
|
||||||
|
os.run = run
|
||||||
|
end
|
||||||
|
|
||||||
|
os.shutdown = function()
|
||||||
|
os.shutdown = shutdown
|
||||||
|
|
||||||
|
_ENV.multishell = nil -- prevent sys/apps/shell.lua erroring for odd reasons
|
||||||
|
|
||||||
|
local success, err = pcall(function()
|
||||||
|
run(_ENV, 'sys/boot/opus.lua', table.unpack(args))
|
||||||
|
end)
|
||||||
|
term.redirect(term.native())
|
||||||
|
if success then
|
||||||
|
print("Opus OS abruptly stopped.")
|
||||||
|
else
|
||||||
|
printError("Opus OS errored.")
|
||||||
|
printError(err)
|
||||||
|
end
|
||||||
|
print("Press any key to continue.")
|
||||||
|
os.pullEvent("key")
|
||||||
|
shutdown()
|
||||||
|
end
|
||||||
|
|
||||||
|
shell.exit()
|
Loading…
Reference in New Issue
Block a user