Advertisement
DOGGYWOOF

Bootloader repair

Aug 25th, 2024 (edited)
13
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.70 KB | None | 0 0
  1. -- Clear the screen and set up colors
  2. term.clear()
  3. term.setBackgroundColor(colors.black)
  4. term.setTextColor(colors.white)
  5. term.clear()
  6.  
  7. -- Define the width and height of the screen
  8. local width, height = term.getSize()
  9.  
  10. -- Helper function to center text on the screen
  11. local function centerText(y, text, textColor)
  12. local x = math.floor((width - #text) / 2)
  13. term.setCursorPos(x, y)
  14. term.setTextColor(textColor)
  15. term.write(text)
  16. end
  17.  
  18. -- Define the dog ASCII art with white color and @ for eyes
  19. local dogArt = {
  20. " |\\_/| ",
  21. " | @ @ ",
  22. " | <> _ ",
  23. " | _/\\------____ ((| |))",
  24. " | `--' | ",
  25. " _____|_ ___| |___. ",
  26. "/_/_____/____/_______| "
  27. }
  28.  
  29. local startLine = math.floor((height - #dogArt) / 2) - 2
  30.  
  31. -- Display the dog ASCII art with white color
  32. term.setTextColor(colors.white)
  33. for i, line in ipairs(dogArt) do
  34. centerText(startLine + i, line, colors.white)
  35. end
  36.  
  37. -- Display the "Repairing System Bootloader..." message in white
  38. centerText(startLine + #dogArt + 2, "Repairing System Bootloader...", colors.white)
  39.  
  40. -- Wait for 10 seconds to simulate the repair process
  41. sleep(10)
  42.  
  43. -- Delete existing startup and no-os files
  44. fs.delete("/startup")
  45. fs.delete("/no-os")
  46.  
  47. -- Copy the recovery files to the root directory
  48. fs.copy("/recovery/boot/error", "/startup")
  49. fs.copy("/recovery/bootloader/no-os.lua", "/no-os")
  50.  
  51. -- Display the "Repair Completed. Rebooting..." message in white
  52. centerText(startLine + #dogArt + 4, "Repair Completed. Rebooting...", colors.white)
  53.  
  54. -- Wait for 3 seconds before rebooting
  55. sleep(3)
  56.  
  57. -- Reboot the system
  58. os.reboot()
  59.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement