Advertisement
DOGGYWOOF

Doggy OS Firmware recovery and update tool

Nov 28th, 2024
11
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.54 KB | None | 0 0
  1. local function drawSeparator()
  2. print(string.rep("-", 30))
  3. end
  4.  
  5. local function showMenu()
  6. term.clear()
  7. term.setCursorPos(1, 1)
  8. print("=== VA11-ILLA Bootloader Tool ===")
  9. drawSeparator()
  10. print("1. Download file from Pastebin")
  11. print("2. Use a local file")
  12. print("3. Exit")
  13. drawSeparator()
  14. term.write("Enter your choice: ")
  15. end
  16.  
  17. local function downloadFromPastebin()
  18. term.clear()
  19. term.setCursorPos(1, 1)
  20. print("=== Download from Pastebin ===")
  21. drawSeparator()
  22. term.write("Enter Pastebin code: ")
  23. local code = read()
  24. local url = "https://pastebin.com/raw/" .. code
  25. local response = http.get(url)
  26.  
  27. if response then
  28. local file = fs.open("VA11-ILLA_DOSBL", "w")
  29. file.write(response.readAll())
  30. file.close()
  31. response.close()
  32. print("\nFile downloaded successfully as VA11-ILLA_DOSBL!")
  33. sleep(2)
  34. return true
  35. else
  36. print("\nFailed to download. Check the code or network connection.")
  37. sleep(2)
  38. return false
  39. end
  40. end
  41.  
  42. local function copyFromLocal()
  43. term.clear()
  44. term.setCursorPos(1, 1)
  45. print("=== Use Local File ===")
  46. drawSeparator()
  47. term.write("Enter the path to the local file: ")
  48. local path = read()
  49.  
  50. if fs.exists(path) then
  51. fs.copy(path, "VA11-ILLA_DOSBL")
  52. print("\nFile copied successfully as VA11-ILLA_DOSBL!")
  53. sleep(2)
  54. return true
  55. else
  56. print("\nFile not found. Check the path.")
  57. sleep(2)
  58. return false
  59. end
  60. end
  61.  
  62. local function runRepairScript()
  63. term.clear()
  64. term.setCursorPos(1, 1)
  65. print("Running FW-REPAIR...")
  66. drawSeparator()
  67.  
  68. if fs.exists("/disk/bootloader/FW-REPAIR.lua") then
  69. shell.run("/disk/bootloader/FW-REPAIR.lua")
  70. else
  71. print("\nError: Repair script not found at /disk/bootloader/FW-REPAIR.lua")
  72. sleep(2)
  73. end
  74. end
  75.  
  76. local function main()
  77. while true do
  78. showMenu()
  79. local choice = read()
  80.  
  81. if choice == "1" then
  82. if downloadFromPastebin() then
  83. runRepairScript()
  84. end
  85. elseif choice == "2" then
  86. if copyFromLocal() then
  87. runRepairScript()
  88. end
  89. elseif choice == "3" then
  90. print("\nExiting tool. Goodbye!")
  91. sleep(1)
  92. break
  93. else
  94. print("\nInvalid choice. Please try again.")
  95. sleep(2)
  96. end
  97. end
  98. end
  99.  
  100. main()
  101.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement