Advertisement
DOGGYWOOF

Untitled

Mar 9th, 2024 (edited)
6
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.63 KB | None | 0 0
  1. -- Doggy OS Boot Failure Program
  2.  
  3. local function clearScreen()
  4. term.clear()
  5. term.setCursorPos(1, 1)
  6. end
  7.  
  8. local function displayMenu()
  9. clearScreen()
  10. print("Doggy OS failed to boot.")
  11. print("1. Shutdown")
  12. print("2. Enter Recovery")
  13. end
  14.  
  15. local function recoveryMenu()
  16. clearScreen()
  17. print("\nRecovery Options:")
  18. print("1. Factory Data Reset")
  19. print("2. Clear User Data")
  20. print("3. Install Doggy OS Configuration Data")
  21. print("4. Load Default Doggy OS Configuration Data")
  22. end
  23.  
  24. local function factoryDataReset()
  25. clearScreen()
  26. print("Factory Data Reset: Deleting /disk/ and copying over /recovery/ as /disk/")
  27. fs.delete("/disk/")
  28. fs.copy("/recovery/", "/disk/")
  29. print("Factory Data Reset complete.")
  30. end
  31.  
  32. local function clearUserData()
  33. clearScreen()
  34. print("Clear User Data: Deleting user data except for Root")
  35. local users = fs.list("/disk/users/")
  36. for _, user in ipairs(users) do
  37. if user ~= "Root" then
  38. fs.delete("/disk/users/" .. user)
  39. end
  40. end
  41. print("User data cleared.")
  42. end
  43.  
  44. local function installConfigData()
  45. clearScreen()
  46. print("Install Doggy OS Configuration Data")
  47. print("Choose the source of the configuration data:")
  48. print("1. From Device")
  49. print("2. From Pastebin")
  50.  
  51. local choice = tonumber(read())
  52.  
  53. if choice == 1 then
  54. print("Enter the file location:")
  55. local sourceFile = read()
  56. fs.delete("DOS.config")
  57. fs.copy(sourceFile, "DOS.config")
  58. print("Configuration data installed.")
  59. elseif choice == 2 then
  60. print("Enter the Pastebin code:")
  61. local pastebinCode = read()
  62. fs.delete("DOS.config")
  63. shell.run("pastebin", "get", pastebinCode, "DOS.config")
  64. print("Configuration data installed.")
  65. else
  66. print("Invalid choice.")
  67. end
  68. end
  69.  
  70. local function loadDefaultConfigData()
  71. clearScreen()
  72. print("Load Default Doggy OS Configuration Data")
  73. fs.delete("DOS.config")
  74. fs.copy("/disk/bootloader/Default.config", "DOS.config")
  75. print("Default configuration data loaded.")
  76. end
  77.  
  78. -- Main program
  79. while true do
  80. displayMenu()
  81.  
  82. local choice = tonumber(read())
  83.  
  84. if choice == 1 then
  85. clearScreen()
  86. print("Shutting down...")
  87. os.shutdown()
  88. elseif choice == 2 then
  89. recoveryMenu()
  90. local recoveryChoice = tonumber(read())
  91.  
  92. if recoveryChoice == 1 then
  93. factoryDataReset()
  94. elseif recoveryChoice == 2 then
  95. clearUserData()
  96. elseif recoveryChoice == 3 then
  97. installConfigData()
  98. elseif recoveryChoice == 4 then
  99. loadDefaultConfigData()
  100. else
  101. print("Invalid choice.")
  102. end
  103. else
  104. print("Invalid choice.")
  105. end
  106. end
  107.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement