Advertisement
DOGGYWOOF

Doggy OS Mobile external system recovery

Jul 22nd, 2024
12
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.69 KB | None | 0 0
  1. -- Function to check if a directory exists
  2. function directoryExists(path)
  3. local success, message = fs.isDir(path)
  4. return success
  5. end
  6.  
  7. -- Function to handle System Recovery submenu
  8. function handleSystemRecovery()
  9. print("System Recovery")
  10. print("1. Reinstall System Software")
  11. print("2. Reinstall System Firmware")
  12. local choice = read()
  13.  
  14. if choice == "1" then
  15. -- Reinstall System Software
  16. if directoryExists("/disk2/disk") then
  17. fs.delete("/disk2/disk")
  18. fs.copy("/DOSM/", "/disk2/disk")
  19. print("System Software reinstalled.")
  20. else
  21. print("System Software not found.")
  22. end
  23. elseif choice == "2" then
  24. -- Reinstall System Firmware
  25. if directoryExists("/disk2/no-os") then
  26. fs.delete("/disk2/no-os")
  27. fs.copy("/DOSM/bootloader/no-os", "/disk2/no-os")
  28. end
  29. if directoryExists("/disk2/startup") then
  30. fs.delete("/disk2/startup")
  31. end
  32. fs.copy("/DOSM/boot/error", "/disk2/startup")
  33. print("System Firmware reinstalled.")
  34. else
  35. print("Invalid choice.")
  36. end
  37. end
  38.  
  39. -- Function to handle User Data Recovery submenu
  40. function handleUserDataRecovery()
  41. print("User Data Recovery")
  42. print("1. Backup user data")
  43. print("2. Restore user data")
  44. local choice = read()
  45.  
  46. if choice == "1" then
  47. -- Backup user data
  48. print("Enter the backup destination path:")
  49. local backupPath = read()
  50. if directoryExists("/disk2/disk/users/") then
  51. fs.copy("/disk2/disk/users/", backupPath)
  52. print("User data backed up.")
  53. else
  54. print("User data not found.")
  55. end
  56. elseif choice == "2" then
  57. -- Restore user data
  58. print("Enter the path of the backup data:")
  59. local backupPath = read()
  60. if directoryExists(backupPath) then
  61. fs.delete("/disk2/disk/users/")
  62. fs.copy(backupPath, "/disk2/disk/users/")
  63. print("User data restored.")
  64. else
  65. print("Backup data not found.")
  66. end
  67. else
  68. print("Invalid choice.")
  69. end
  70. end
  71.  
  72. -- Main program
  73. if directoryExists("/disk2/recovery") then
  74. print("Doggy OS Mobile System Recovery")
  75. print("---------------------------------------")
  76. print("1. System Recovery")
  77. print("2. User Data Recovery")
  78. local mainChoice = read()
  79.  
  80. if mainChoice == "1" then
  81. handleSystemRecovery()
  82. elseif mainChoice == "2" then
  83. handleUserDataRecovery()
  84. else
  85. print("Invalid choice.")
  86. end
  87. else
  88. print("Recovery directory not found.")
  89. end
  90.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement