Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- if not term.isColor() then
- error("LEFI cannot run on non-advanced computers.")
- end
- -- Declare extended Lua attributes
- rawset(_G, "__declare", function(g, v)
- return rawset(_G, g, v)
- end)
- __declare("__declare_api", function(a, g, v)
- return rawset(_G[a], g, v)
- end)
- __declare("__try", function(f, e)
- local r = {pcall(f)}
- if table.remove(r, 1) == true then
- return unpack(r)
- else
- if e ~= nil then
- e(unpack(r))
- else
- return __kstop(0x0000FFFF, unpack(r))
- end
- end
- end)
- __declare("__kstruct", function(t)
- if t == _G then
- return setmetatable({}, {
- __index = t,
- __newindex = function(table, key, value)
- __kstop(0x00000004, table, key, value)
- end,
- __metatable = {}
- })
- else
- return setmetatable({}, {
- __index = t,
- __newindex = function(table, key, value)
- __kstop(0x00000005, table, key, value)
- end,
- __metatable = {}
- })
- end
- end)
- -- declare library persistence loader
- __declare("persist", function(n, c)
- local h = fs.open("/tmp/"..n, "w")
- h.writeLine(c)
- h.close()
- os.loadAPI("/tmp/"..n)
- fs.delete("/tmp/"..n)
- end)
- __declare("drawBootManager", function(opt)
- term.setBackgroundColor(colors.black)
- term.clear()
- term.setCursorPos(1,1)
- if not opt then
- boot_printColoredTextLine(2, " Orbital Boot Manager v1.0 ", colors.lightGray, colors.black)
- boot_printColoredTextLine(18, " F2=ESI Setup F10=Boot Menu ", colors.lightGray, colors.black)
- else
- boot_printColoredTextLine(2, " Orbital Boot Manager v2.1 ", colors.red, colors.black)
- boot_printColoredTextLine(18, " CTRL+R=Reboot ", colors.red, colors.black)
- end
- end)
- local sr = shell.run
- if not fs.isDir("/boot") or not loadfile("/boot/esi/esiboot.b") then
- drawBootManager(true)
- term.setBackgroundColor(colors.black)
- term.setTextColor(colors.red)
- term.setCursorPos(2,4)
- print("The Orbital Boot Manager was unable to boot the")
- term.setCursorPos(2,5)
- print("operating system.")
- term.setCursorPos(2,7)
- print("Status:")
- term.setCursorPos(2,8)
- print("ESI_BINARIES_INVALID (0x00000002)")
- term.setCursorPos(2,10)
- print("Information:")
- term.setCursorPos(2,11)
- print("One or more ESI files are missing.")
- term.setCursorPos(2,12)
- print("Please re-install the operating system.")
- while true do
- sleep(1)
- end
- end
- sr("/boot/esi/esiboot.b")
Advertisement
Add Comment
Please, Sign In to add comment