Advertisement
DOGGYWOOF

Fatal error recovery

Mar 6th, 2024 (edited)
23
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.69 KB | None | 0 0
  1. -- Doggy Fatal Error Recovery Program
  2.  
  3. function reinstallOS()
  4. if fs.exists("/disk/") and fs.exists("/disk2/") then
  5. fs.delete("/disk/")
  6. fs.copy("/disk2/", "/disk/")
  7. print("Doggy OS reinstalled successfully.")
  8. else
  9. print("Error: /disk/ and /disk2/ must exist for OS reinstallation.")
  10. end
  11. end
  12.  
  13. function reinstallBootloader()
  14. if fs.exists("/startup/") and fs.exists("/disk/") and fs.exists("/disk2/") then
  15. fs.delete("/startup/")
  16. fs.copy("/disk/boot/error", "/startup/")
  17. print("Bootloader reinstalled successfully.")
  18. else
  19. print("Error: /startup/, /disk/, and /disk2/ must exist for bootloader reinstallation.")
  20. end
  21. end
  22.  
  23. function createBackup()
  24. if fs.exists("/disk/") and fs.exists("/disk2/") then
  25. fs.copy("/disk/", "/backup/")
  26. print("Backup created successfully.")
  27. else
  28. print("Error: /disk/ and /disk2/ must exist for backup creation.")
  29. end
  30. end
  31.  
  32. function recoveryFromBackup()
  33. if fs.exists("/disk/") and fs.exists("/disk2/") then
  34. fs.delete("/disk/")
  35. fs.copy("/backup/", "/disk/")
  36. print("Recovery from backup successful.")
  37. else
  38. print("Error: /disk/ and /disk2/ must exist for recovery from backup.")
  39. end
  40. end
  41.  
  42. function deleteBackup()
  43. fs.delete("/backup/")
  44. print("Backup deleted successfully.")
  45. end
  46.  
  47. function powerOptions()
  48. print("Select power option:")
  49. print("1. Reboot")
  50. print("2. Shutdown")
  51. print("3. Eject disk and shutdown")
  52.  
  53. local choice = read()
  54.  
  55. if choice == "1" then
  56. os.reboot()
  57. elseif choice == "2" then
  58. os.shutdown()
  59. elseif choice == "3" then
  60. print("Ejecting disk...")
  61. -- Perform disk ejection logic if needed
  62. os.shutdown()
  63. else
  64. print("Invalid choice.")
  65. end
  66. end
  67.  
  68. -- Main program
  69. while true do
  70. print("Doggy Fatal Error Recovery Program")
  71. print("1. Reinstall Doggy OS")
  72. print("2. Reinstall Bootloader")
  73. print("3. Create Backup")
  74. print("4. Recovery from Backup")
  75. print("5. Delete Backup")
  76. print("6. Power Options")
  77.  
  78. local choice = read()
  79.  
  80. if choice == "1" then
  81. reinstallOS()
  82. elseif choice == "2" then
  83. reinstallBootloader()
  84. elseif choice == "3" then
  85. createBackup()
  86. elseif choice == "4" then
  87. recoveryFromBackup()
  88. elseif choice == "5" then
  89. deleteBackup()
  90. elseif choice == "6" then
  91. powerOptions()
  92. elseif choice == "7" then
  93. print("Exiting Doggy Fatal Error Recovery Program.")
  94. break
  95. else
  96. print("Invalid choice. Please try again.")
  97. end
  98. end
  99.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement