Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- Function to check if a directory exists
- function directoryExists(path)
- local success, message = fs.isDir(path)
- return success
- end
- -- Function to handle System Recovery submenu
- function handleSystemRecovery()
- print("System Recovery")
- print("1. Reinstall System Software")
- print("2. Reinstall System Firmware")
- local choice = read()
- if choice == "1" then
- -- Reinstall System Software
- if directoryExists("/disk2/disk") then
- fs.delete("/disk2/disk")
- fs.copy("/DOSM/", "/disk2/disk")
- print("System Software reinstalled.")
- else
- print("System Software not found.")
- end
- elseif choice == "2" then
- -- Reinstall System Firmware
- if directoryExists("/disk2/no-os") then
- fs.delete("/disk2/no-os")
- fs.copy("/DOSM/bootloader/no-os", "/disk2/no-os")
- end
- if directoryExists("/disk2/startup") then
- fs.delete("/disk2/startup")
- end
- fs.copy("/DOSM/boot/error", "/disk2/startup")
- print("System Firmware reinstalled.")
- else
- print("Invalid choice.")
- end
- end
- -- Function to handle User Data Recovery submenu
- function handleUserDataRecovery()
- print("User Data Recovery")
- print("1. Backup user data")
- print("2. Restore user data")
- local choice = read()
- if choice == "1" then
- -- Backup user data
- print("Enter the backup destination path:")
- local backupPath = read()
- if directoryExists("/disk2/disk/users/") then
- fs.copy("/disk2/disk/users/", backupPath)
- print("User data backed up.")
- else
- print("User data not found.")
- end
- elseif choice == "2" then
- -- Restore user data
- print("Enter the path of the backup data:")
- local backupPath = read()
- if directoryExists(backupPath) then
- fs.delete("/disk2/disk/users/")
- fs.copy(backupPath, "/disk2/disk/users/")
- print("User data restored.")
- else
- print("Backup data not found.")
- end
- else
- print("Invalid choice.")
- end
- end
- -- Main program
- if directoryExists("/disk2/recovery") then
- print("Doggy OS Mobile System Recovery")
- print("---------------------------------------")
- print("1. System Recovery")
- print("2. User Data Recovery")
- local mainChoice = read()
- if mainChoice == "1" then
- handleSystemRecovery()
- elseif mainChoice == "2" then
- handleUserDataRecovery()
- else
- print("Invalid choice.")
- end
- else
- print("Recovery directory not found.")
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement