Advertisement
DOGGYWOOF

run

Feb 2nd, 2024 (edited)
14
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.28 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. local function overrideBootloader()
  45. clearScreen()
  46. print("Override Bootloader:")
  47. print("Enter the location of the OS kernel:")
  48.  
  49. local kernelLocation = io.read()
  50.  
  51. if fs.exists(kernelLocation) then
  52. shell.run("delete /startup")
  53. shell.run("copy " .. kernelLocation .. " /startup")
  54. print("Bootloader overridden successfully.")
  55. else
  56. print("Error: Specified file not found.")
  57. end
  58.  
  59. sleep(2) -- Adding a delay for visibility
  60. end
  61.  
  62. -- Main loop
  63. while true do
  64. clearScreen()
  65. print("Doggy OS Recovery Menu:")
  66. print("1. Recovery Options")
  67. print("2. Power Options")
  68.  
  69. local choice = tonumber(io.read())
  70.  
  71. if choice == 1 then
  72. while true do
  73. clearScreen()
  74. term.setCursorPos(1, 1)
  75. print("Recovery Options:")
  76. print("1. Full System Recovery")
  77. print("2. Refresh Recovery Partition")
  78. print("3. Install Update from Disk")
  79. print("4. Override Bootloader")
  80. print("5. Back")
  81.  
  82. local recoveryChoice = tonumber(io.read())
  83.  
  84. if recoveryChoice == 1 then
  85. fullSystemRecovery()
  86. elseif recoveryChoice == 2 then
  87. refreshRecoveryPartition()
  88. elseif recoveryChoice == 3 then
  89. installUpdateFromDisk()
  90. elseif recoveryChoice == 4 then
  91. overrideBootloader()
  92. elseif recoveryChoice == 5 then
  93. break -- Go back to the main menu
  94. else
  95. print("Invalid choice.")
  96. sleep(2) -- Adding a delay for visibility
  97. end
  98. end
  99. elseif choice == 2 then
  100. clearScreen()
  101. term.setCursorPos(1, 1)
  102. print("Power Options:")
  103. print("1. Reboot system")
  104. print("2. Shutdown system")
  105.  
  106. local powerChoice = tonumber(io.read())
  107.  
  108. if powerChoice == 1 then
  109. os.reboot()
  110. elseif powerChoice == 2 then
  111. os.shutdown()
  112. else
  113. print("Invalid choice.")
  114. sleep(2) -- Adding a delay for visibility
  115. end
  116. else
  117. print("Invalid choice. Please try again.")
  118. sleep(2) -- Adding a delay for visibility
  119. end
  120. end
  121.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement