Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- Doggy Fatal Error Recovery Program
- function reinstallOS()
- if fs.exists("/disk/") and fs.exists("/disk2/") then
- fs.delete("/disk/")
- fs.copy("/disk2/", "/disk/")
- print("Doggy OS reinstalled successfully.")
- else
- print("Error: /disk/ and /disk2/ must exist for OS reinstallation.")
- end
- end
- function reinstallBootloader()
- if fs.exists("/startup/") and fs.exists("/disk/") and fs.exists("/disk2/") then
- fs.delete("/startup/")
- fs.copy("/disk/boot/error", "/startup/")
- print("Bootloader reinstalled successfully.")
- else
- print("Error: /startup/, /disk/, and /disk2/ must exist for bootloader reinstallation.")
- end
- end
- function createBackup()
- if fs.exists("/disk/") and fs.exists("/disk2/") then
- fs.copy("/disk/", "/backup/")
- print("Backup created successfully.")
- else
- print("Error: /disk/ and /disk2/ must exist for backup creation.")
- end
- end
- function recoveryFromBackup()
- if fs.exists("/disk/") and fs.exists("/disk2/") then
- fs.delete("/disk/")
- fs.copy("/backup/", "/disk/")
- print("Recovery from backup successful.")
- else
- print("Error: /disk/ and /disk2/ must exist for recovery from backup.")
- end
- end
- function deleteBackup()
- fs.delete("/backup/")
- print("Backup deleted successfully.")
- end
- function powerOptions()
- print("Select power option:")
- print("1. Reboot")
- print("2. Shutdown")
- print("3. Eject disk and shutdown")
- local choice = read()
- if choice == "1" then
- os.reboot()
- elseif choice == "2" then
- os.shutdown()
- elseif choice == "3" then
- print("Ejecting disk...")
- -- Perform disk ejection logic if needed
- os.shutdown()
- else
- print("Invalid choice.")
- end
- end
- -- Main program
- while true do
- print("Doggy Fatal Error Recovery Program")
- print("1. Reinstall Doggy OS")
- print("2. Reinstall Bootloader")
- print("3. Create Backup")
- print("4. Recovery from Backup")
- print("5. Delete Backup")
- print("6. Power Options")
- local choice = read()
- if choice == "1" then
- reinstallOS()
- elseif choice == "2" then
- reinstallBootloader()
- elseif choice == "3" then
- createBackup()
- elseif choice == "4" then
- recoveryFromBackup()
- elseif choice == "5" then
- deleteBackup()
- elseif choice == "6" then
- powerOptions()
- elseif choice == "7" then
- print("Exiting Doggy Fatal Error Recovery Program.")
- break
- else
- print("Invalid choice. Please try again.")
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement