minif

startup

Jan 21st, 2020
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.36 KB | None | 0 0
  1. --startup
  2. term.clear()
  3. term.setCursorPos(1,1)
  4.  
  5. --define functions
  6. osScreenSizeX, osScreenSizeY = term.getSize()
  7. function osFillBG(selColor)
  8. paintutils.drawFilledBox(1,1,osScreenSizeX,osScreenSizeY,selColor)
  9. term.setCursorPos(1,1)
  10. term.setBackgroundColor(selColor)
  11. if selColor == colors.white then
  12. term.setTextColor(colors.black)
  13. else
  14. term.setTextColor(colors.white)
  15. end
  16. end
  17.  
  18. function osBSOD(message, cause, tips)
  19. osFillBG(colors.blue)
  20. print("Critical System Error!")
  21. print(message)
  22. print(cause)
  23. print(tips)
  24. print("")
  25. print("Press any key to continue.")
  26. sleep(2)
  27. local blank1, blank2 = os.pullEvent()
  28. end
  29.  
  30. --check if on advanced
  31. if term.isColor() then else
  32. print("Incompatible Computer!")
  33. print("Continuing into CraftOS...")
  34. return
  35. end
  36.  
  37. --boot to craftos recovery
  38. osFillBG(colors.cyan)
  39. os.sleep(2)
  40.  
  41. --login script
  42. if fs.exists("system/login") then
  43. osFillBG(colors.black)
  44. shell.run("system/login")
  45. else
  46. if fs.exists("disk/system/login") then
  47. print("Found login file on disk.")
  48. print("Copying from disk...")
  49. fs.copy("disk/system/login","system/login")
  50. print("Copy complete! Shutting Down...")
  51. sleep(3)
  52. else
  53. osBSOD("Critical file missing.","/system/login is missing, and is needed to run.","Please re-install this file")
  54. end
  55. end
  56.  
  57. --os shutdown
  58. --os.shutdown()
Add Comment
Please, Sign In to add comment