Advertisement
DOGGYWOOF

Untitled

Feb 8th, 2025 (edited)
8
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.90 KB | None | 0 0
  1. -- Doggy OS Systems
  2. -- DogRE 13.0 (N3K0 V13 CFG)
  3.  
  4. local function clearScreen(message)
  5. term.clear()
  6. term.setCursorPos(1, 1)
  7. if message then
  8. print(message)
  9. end
  10. end
  11.  
  12. local function waitForDisk(diskPath, message)
  13. clearScreen(message)
  14. while not fs.exists(diskPath) do
  15. sleep(1)
  16. end
  17. end
  18.  
  19. local function promptForEnter(message)
  20. print(message .. " Press Enter to continue...")
  21. io.read()
  22. end
  23.  
  24. local function askToOverride(filePath)
  25. clearScreen("File " .. filePath .. " already exists.\nDo you want to override it?\n1. Yes\n2. No (Skip)")
  26. local choice = tonumber(io.read())
  27. return choice == 1
  28. end
  29.  
  30. local function displayError(errorMsg, errorCode)
  31. clearScreen("===== DOGGY OS SYSTEM RECOVERY ERROR =====")
  32. print("Error Message: " .. errorMsg)
  33. print("Error Code: " .. (errorCode or "DOSx7002"))
  34. print("\nPossible Causes:")
  35. print("1. Missing or corrupted files.")
  36. print("2. Disk access errors.")
  37. print("3. Unexpected system behavior.")
  38. print("\nSuggested Actions:")
  39. print("1. Check disk connections and try again.")
  40. print("2. Run a full system recovery.")
  41. print("3. Contact support if the issue persists.\n")
  42. promptForEnter("Press Enter to Reboot system and return to normal system environment")
  43. end
  44.  
  45. local function showLoadingScreen(message, totalSteps)
  46. local barLength = 30
  47. clearScreen(message)
  48. for step = 1, totalSteps do
  49. term.setCursorPos(1, 3)
  50. write("[")
  51. for i = 1, barLength do
  52. if i <= math.floor((step / totalSteps) * barLength) then
  53. write("=")
  54. else
  55. write(" ")
  56. end
  57. end
  58. write("] " .. math.floor((step / totalSteps) * 100) .. "%")
  59. sleep(0.3)
  60. end
  61. end
  62.  
  63. local function fullSystemRecovery()
  64. showLoadingScreen("Starting Full System Recovery...", 50)
  65. -- Logic to restore files from /recovery
  66. clearScreen("Recovery process completed.\nThe system is now restored.")
  67. promptForEnter("Press Enter to exit")
  68. end
  69.  
  70. local function wipeDataAndResetFactoryDefaults()
  71. showLoadingScreen("Wiping data and resetting to factory defaults...", 50)
  72. -- Logic to delete everything except /disk/users/ and restore from /.doggyfactorydefaults/
  73. clearScreen("Factory reset completed.\nPreparing for system setup...")
  74. shell.run("/disk/setup")
  75. end
  76.  
  77. local function recoveryMenu()
  78. while true do
  79. clearScreen("===== Recovery Options =====\n1. Full System Recovery\n2. Wipe data / Reset to factory defaults\n3. Exit")
  80. local choice = tonumber(io.read())
  81. if choice == 1 then
  82. fullSystemRecovery()
  83. elseif choice == 2 then
  84. wipeDataAndResetFactoryDefaults()
  85. elseif choice == 3 then
  86. break
  87. else
  88. clearScreen("Invalid choice. Please try again.")
  89. sleep(2)
  90. end
  91. end
  92. end
  93.  
  94. local function powerMenu()
  95. clearScreen("===== Power Options =====\n1. Reboot system\n2. Shutdown system")
  96. local choice = tonumber(io.read())
  97. if choice == 1 then
  98. os.reboot()
  99. elseif choice == 2 then
  100. os.shutdown()
  101. else
  102. clearScreen("Invalid choice. Please try again.")
  103. sleep(2)
  104. end
  105. end
  106.  
  107. local function mainMenu()
  108. while true do
  109. clearScreen("===== Doggy OS DEV Recovery GUI =====\n1. Recovery Options\n2. Power Options\n3. Exit")
  110. local choice = tonumber(io.read())
  111. if choice == 1 then
  112. recoveryMenu()
  113. elseif choice == 2 then
  114. powerMenu()
  115. elseif choice == 3 then
  116. break
  117. else
  118. clearScreen("Invalid choice. Please try again.")
  119. sleep(2)
  120. end
  121. end
  122. end
  123.  
  124. if fs.exists("/disk/config/dogRE/disableRE.cfg") then
  125. displayError("Recovery Environment Disabled", "DOSx7000")
  126. else
  127. mainMenu()
  128. end
  129.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement