mirror of
https://github.com/kepler155c/opus
synced 2025-10-10 05:17:42 +00:00
Initial commit
This commit is contained in:
45
startup
Normal file
45
startup
Normal file
@@ -0,0 +1,45 @@
|
||||
local bootOptions = {
|
||||
{ prompt = 'Default Shell', file = '/sys/boot/default.boot' },
|
||||
{ prompt = 'Multishell' , file = '/sys/boot/multishell.boot' },
|
||||
{ prompt = 'TLCO' , file = '/sys/boot/tlco.boot' },
|
||||
}
|
||||
local bootOption = 2
|
||||
|
||||
local function startupMenu()
|
||||
while true do
|
||||
term.clear()
|
||||
term.setCursorPos(1, 1)
|
||||
print('Select startup mode')
|
||||
print()
|
||||
for k,option in pairs(bootOptions) do
|
||||
print(k .. ' : ' .. option.prompt)
|
||||
end
|
||||
print('')
|
||||
term.write('> ')
|
||||
local ch = tonumber(read())
|
||||
if ch and bootOptions[ch] then
|
||||
return ch
|
||||
end
|
||||
end
|
||||
term.clear()
|
||||
term.setCursorPos(1, 1)
|
||||
end
|
||||
|
||||
term.clear()
|
||||
term.setCursorPos(1, 1)
|
||||
print('Starting OS')
|
||||
print()
|
||||
print('Press any key for menu')
|
||||
local timerId = os.startTimer(.75)
|
||||
while true do
|
||||
local e, id = os.pullEvent()
|
||||
if e == 'timer' and id == timerId then
|
||||
break
|
||||
end
|
||||
if e == 'char' then
|
||||
bootOption = startupMenu()
|
||||
break
|
||||
end
|
||||
end
|
||||
|
||||
os.run(getfenv(1), bootOptions[bootOption].file)
|
Reference in New Issue
Block a user