Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --[ Boot Manager
- ver = "v3"
- local handle = assert(fs.open("osros/system/config.osc", "r"), "Couldn't load the configuration!")
- local input = handle.readAll()
- handle.close()
- local conf = textutils.unserialize(input)
- desktopBarColor = conf.dBarC
- safeBoot = conf.safeBoot
- if safeBoot == "true" then
- local function missing()
- term.setBackgroundColor(colors.red)
- term.clear()
- term.setCursorPos(1,1)
- term.setTextColor(1)
- print("One of the system files are missing!")
- print("The operating system will not boot without one.")
- print("Reinstall? [y/n]")
- write("> ")
- local reinstall = read()
- if reinstall == "y" then
- term.clear()
- term.setCursorPos(1,1)
- print("Reinstalling... (NOTHING HAPPENS, COMING IN NEXT VERSION)")
- --COMING SOON
- sleep(1)
- print("Complete.")
- sleep(2)
- os.reboot()
- elseif reinstall == "n" then
- print("Aborting boot.")
- sleep(1)
- shell.run("shell")
- else
- write("> ")
- end
- end
- term.clear()
- term.setCursorPos(1,1)
- print("SafeBoot is enabled.")
- print("Veryfying system files...")
- sleep(0.2)
- if fs.exists("osros") then
- else
- missing()
- end
- if fs.exists("osros/system") then
- else
- missing()
- end
- if fs.exists("osros/system/desktop.ossf") then
- else
- missing()
- end
- if fs.exists("osros/system/filemang.ossf") then
- else
- missing()
- end
- if fs.exists("osros/system/progMang.ossf") then
- else
- missing()
- end
- if fs.exists("osros/system/settings.ossf") then
- else
- missing()
- end
- if fs.exists("osros/system/shell.trm") then
- else
- missing()
- end
- print("Creating session file..")
- sleep(0.6)
- if fs.exists("osros/system/session.sesf") then
- term.setBackgroundColor(colors.blue)
- term.clear()
- term.setCursorPos(1,1)
- term.setTextColor(colors.red)
- print("Woops! It's already there...")
- print("If you shutdown your computer with")
- print("CRTL+S then ignore this message, otherwise")
- print("your computer may have shutdown in a bad")
- print("way.")
- print("Press any key to boot normally (Booting SHELL)")
- local timer1 = os.startTimer(5)
- while true do
- event, parameter = os.pullEvent()
- if event == "timer" and parameter == timer1 then
- pressedAKey = false
- break
- elseif event == "key" then
- pressedAKey = true
- break
- end
- end
- if pressedAKey then
- shell.run("osros/system/desktop.ossf")
- else
- term.clear()
- term.setCursorPos(1,1)
- term.setTextColor(colors.yellow)
- print("> Loading SHELL")
- term.setBackgroundColor(colors.black)
- term.clear()
- term.setCursorPos(1,1)
- sleep(0.3)
- shell.run("shell")
- end
- else
- local session = fs.open("osros/system/session.sesf", "w")
- session.write("Loaded")
- session.close()
- shell.run("osros/system/desktop.ossf")
- end
- elseif safeBoot == "false" then
- term.clear()
- term.setCursorPos(1,1)
- print("SafeBoot is NOT enabled!")
- print("Loading OSROS")
- sleep(1)
- shell.run("osros/system/desktop.ossf")
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement