Advertisement
DOGGYWOOF

Untitled

Nov 28th, 2024
5
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.90 KB | None | 0 0
  1. -- List of required files
  2. local requiredFiles = {
  3. "/disk/bootloader/VA11-ILLA.lua",
  4. "/disk/os/home.lua",
  5. "/disk/os/lock.lua",
  6. "/disk/boot/boot-animation",
  7. "/disk/error/BSOD.lua",
  8. -- Add more file names as needed
  9. }
  10.  
  11. -- Function to check if all required files exist
  12. local function checkFiles()
  13. local missingFiles = {}
  14.  
  15. for _, fileName in ipairs(requiredFiles) do
  16. if not fs.exists(fileName) then
  17. table.insert(missingFiles, fileName)
  18. end
  19. end
  20.  
  21. return missingFiles
  22. end
  23.  
  24. -- Function to display a boot UI
  25. local function displayBootScreen(stage)
  26. term.clear()
  27. term.setCursorPos(1, 1)
  28.  
  29. -- Draw a border
  30. local width, height = term.getSize()
  31. for x = 1, width do
  32. term.setCursorPos(x, 1)
  33. term.write("-")
  34. term.setCursorPos(x, height)
  35. term.write("-")
  36. end
  37. for y = 2, height - 1 do
  38. term.setCursorPos(1, y)
  39. term.write("|")
  40. term.setCursorPos(width, y)
  41. term.write("|")
  42. end
  43.  
  44. -- Centered title
  45. term.setCursorPos((width - #("VA11-ILLA Bootloader")) // 2, 2)
  46. term.write("VA11-ILLA Bootloader")
  47.  
  48. -- Display boot stage
  49. term.setCursorPos((width - #("Status: " .. stage)) // 2, height // 2)
  50. term.write("Status: " .. stage)
  51.  
  52. -- Footer
  53. term.setCursorPos((width - #("© Doggy OS")) // 2, height - 1)
  54. term.write("© Doggy OS")
  55. end
  56.  
  57. -- Function to simulate a loading bar
  58. local function loadingBar()
  59. local width, height = term.getSize()
  60. local barWidth = math.floor(width * 0.6)
  61. local barStartX = (width - barWidth) // 2
  62. local barY = height // 2 + 2
  63.  
  64. term.setCursorPos(barStartX, barY)
  65. term.write("[")
  66. term.setCursorPos(barStartX + barWidth + 1, barY)
  67. term.write("]")
  68.  
  69. for i = 1, barWidth do
  70. sleep(0.05)
  71. term.setCursorPos(barStartX + i, barY)
  72. term.write("=")
  73. end
  74. end
  75.  
  76. -- Main function to execute no-os.lua if files are missing
  77. local function main()
  78. displayBootScreen("Initializing")
  79. sleep(1)
  80.  
  81. local missing = checkFiles()
  82.  
  83. if #missing > 0 then
  84. displayBootScreen("Missing Files Detected")
  85. sleep(1)
  86.  
  87. -- Show missing files
  88. term.clear()
  89. term.setCursorPos(1, 1)
  90. print("The following files are missing:")
  91. for _, fileName in ipairs(missing) do
  92. print("- " .. fileName)
  93. end
  94. sleep(3)
  95.  
  96. -- Execute no-os.lua
  97. shell.run("no-os")
  98. else
  99. displayBootScreen("All Files Verified")
  100. loadingBar()
  101.  
  102. -- Continue with boot process
  103. term.clear()
  104. term.setCursorPos(1, 1)
  105. print("VA11-ILLA Bootloader")
  106. print("Loading...")
  107. sleep(2)
  108. shell.run("/disk/boot/check-recovery")
  109. -- Add your code to run if all files exist
  110. end
  111. end
  112.  
  113. -- Run the main function
  114. main()
  115.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement