Advertisement
DOGGYWOOF

Doggy OS recovery

Jan 29th, 2024 (edited)
20
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.66 KB | None | 0 0
  1. -- Doggy OS Recovery
  2.  
  3. local function clearScreen()
  4. term.clear()
  5. term.setCursorPos(1, 1)
  6. end
  7.  
  8. local function fullSystemRecovery()
  9. clearScreen()
  10. shell.run("delete /disk")
  11. shell.run("copy /recovery /disk")
  12. print("Full System Recovery completed.")
  13. sleep(2) -- Adding a delay for visibility
  14. end
  15.  
  16. local function refreshRecoveryPartition()
  17. clearScreen()
  18. print("Please insert Doggy OS disk!")
  19.  
  20. while not fs.exists("/disk2/") do
  21. sleep(1)
  22. end
  23.  
  24. shell.run("delete /recovery")
  25. shell.run("copy /disk2 /recovery")
  26. print("Recovery partition refreshed.")
  27. sleep(2) -- Adding a delay for visibility
  28. end
  29.  
  30. local function installUpdateFromDisk()
  31. clearScreen()
  32. print("Please insert Doggy OS disk!")
  33.  
  34. while not fs.exists("/disk2/") do
  35. sleep(1)
  36. end
  37.  
  38. shell.run("delete /disk")
  39. shell.run("copy /disk2 /disk")
  40. print("Update installed from disk.")
  41. sleep(2) -- Adding a delay for visibility
  42. end
  43.  
  44. -- Main loop
  45. while true do
  46. clearScreen()
  47. print("Doggy OS Recovery Menu:")
  48. print("1. Recovery Options")
  49. print("2. Power Options")
  50.  
  51. local choice = tonumber(io.read())
  52.  
  53. if choice == 1 then
  54. while true do
  55. clearScreen()
  56. term.setCursorPos(1, 1)
  57. print("Recovery Options:")
  58. print("1. Full System Recovery")
  59. print("2. Refresh Recovery Partition")
  60. print("3. Install Update from Disk")
  61. print("4. Back")
  62.  
  63. local recoveryChoice = tonumber(io.read())
  64.  
  65. if recoveryChoice == 1 then
  66. fullSystemRecovery()
  67. elseif recoveryChoice == 2 then
  68. refreshRecoveryPartition()
  69. elseif recoveryChoice == 3 then
  70. installUpdateFromDisk()
  71. elseif recoveryChoice == 4 then
  72. break -- Go back to the main menu
  73. else
  74. print("Invalid choice.")
  75. sleep(2) -- Adding a delay for visibility
  76. end
  77. end
  78. elseif choice == 2 then
  79. clearScreen()
  80. term.setCursorPos(1, 1)
  81. print("Power Options:")
  82. print("1. Reboot system")
  83. print("2. Shutdown system")
  84.  
  85. local powerChoice = tonumber(io.read())
  86.  
  87. if powerChoice == 1 then
  88. os.reboot()
  89. elseif powerChoice == 2 then
  90. os.shutdown()
  91. else
  92. print("Invalid choice.")
  93. sleep(2) -- Adding a delay for visibility
  94. end
  95. else
  96. print("Invalid choice. Please try again.")
  97. sleep(2) -- Adding a delay for visibility
  98. end
  99. end
  100.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement