Advertisement
DOGGYWOOF

Untitled

Jul 11th, 2024
11
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.21 KB | None | 0 0
  1. local function displayLegacyBootloader()
  2. -- Clear the terminal screen
  3. term.clear()
  4.  
  5. -- Set cursor position to the top-left corner
  6. term.setCursorPos(1, 1)
  7.  
  8. -- Print the bootloader title
  9. print("Doggy OS Legacy Bootloader")
  10. print("") -- Empty line for spacing
  11.  
  12. -- Print the bootloader ASCII art
  13. print(" _________________")
  14. print(" | | ___________ |o|")
  15. print(" | | ___________ | |")
  16. print(" | | ___________ | |")
  17. print(" | | ___________ | |")
  18. print(" | |_____________| |")
  19. print(" | _______ |")
  20. print(" | | | ||")
  21. print(" | DD | | V|")
  22. print(" |____|_______|____|")
  23. print("") -- Empty line for spacing
  24. end
  25.  
  26. local function promptUser()
  27. -- Display options to the user
  28. print("Please insert a Doggy OS disk.")
  29. print("Press 1 to copy over /disk2/ as recovery.")
  30. print("Press 2 to copy over /disk/ as recovery.")
  31. print("Press q to quit.")
  32. end
  33.  
  34. local function copyDisk(source, destination)
  35. -- Copy contents from source to destination
  36. fs.delete(destination) -- Ensure the destination is empty
  37. fs.copy(source, destination)
  38. print("Recovery files copied successfully to " .. destination)
  39. end
  40.  
  41. local function main()
  42. -- Display the bootloader menu
  43. displayLegacyBootloader()
  44.  
  45. -- Prompt the user for action
  46. promptUser()
  47.  
  48. -- Wait for user input
  49. local event, key
  50. repeat
  51. event, key = os.pullEvent("key")
  52. until key == keys.one or key == keys.two or key == keys.q
  53.  
  54. -- Perform the appropriate action based on user input
  55. if key == keys.one then
  56. if disk.isPresent("left") then
  57. copyDisk("/disk", "/disk2")
  58. else
  59. print("No disk found in the left drive.")
  60. end
  61. elseif key == keys.two then
  62. if disk.isPresent("left") then
  63. copyDisk("/disk", "/disk")
  64. else
  65. print("No disk found in the left drive.")
  66. end
  67. elseif key == keys.q then
  68. print("Exiting bootloader.")
  69. return
  70. end
  71.  
  72. -- Reboot the system
  73. os.reboot()
  74. end
  75.  
  76. -- Run the main function
  77. main()
  78.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement