Marlingaming

Heimbriech Tablet OS - Boot Loader

Sep 8th, 2021 (edited)
104
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.78 KB | None | 0 0
  1. local oldPull = os.pullEvent
  2. os.pullEvent = os.pullEventRaw
  3. --this file is the Boot Loader Handler, and deals with the starting Directions of the OS, checks for updates, and ensures security
  4. UpdateManagerFile = nil
  5. DefiningFile = nil
  6. SecurityFile = nil
  7. Errors = "n"
  8. start()
  9.  
  10. function start()
  11. if settings.get("SystemState") == "Locked" then
  12. shell.run(".LockedScreen")
  13. else
  14. print("Starting Step 1")
  15. Boot_1()
  16. end
  17. end
  18.  
  19. function Boot_1()
  20. print("Grabbing Major File Paths")
  21. DefiningFile = settings.get("SystemDefiner")
  22. local h = fs.open(DefiningFile,"r")
  23. UpdateManagerFile = h.readLine(8)
  24. SecurityFile = h.readLine(12)
  25. h.close()
  26. print("Task Completed")
  27. print("Proceeding to next Step")
  28. Boot_2()
  29. end
  30.  
  31. function Boot_2()
  32. print("Starting Step 2")
  33. print("Checking Account Information")
  34. AccountChecker()
  35. print("Proceeding to next Step")
  36. Boot_3()
  37. end
  38.  
  39. function Boot_3()
  40. print("Starting Step 3")
  41. if Errors == " " then
  42. print("Proceeding to next Step")
  43. Boot_End()
  44. else
  45. print("ERRORS WERE DETECTED, SHOW THEM NOW")
  46. print(Errors)
  47. print("to be able to run your Device, all errors must be fixed")
  48. print("to fix them, bring your tablet to the nearest Gov Office")
  49. sleep(2)
  50. settings.set("SystemState","Locked")
  51. sleep(10)
  52. os.shutdown
  53. end
  54. end
  55.  
  56. function Boot_End()
  57. print("Boot Process Complete! Starting UpdateManager to check for Any new Updates")
  58. shell.run(UpdateManagerFile)
  59. end
  60.  
  61. function AccountChecker()
  62. Errors = ""
  63. if fs.exists(".BankDetails") == false then
  64. Errors = Errors.."Missing Bank Details,"
  65. end
  66. if fs.exists(".ClientData") == false then
  67. Errors = Errors.."Missing Client Data,"
  68. end
  69. if fs.exists(".AccountDetails") == false then
  70. Errors = Errors.."Missing Account,"
  71. end
  72. end
  73. os.pullEvent = oldPull
Add Comment
Please, Sign In to add comment