Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- Doggy OS Boot Failure Program
- local function clearScreen()
- term.clear()
- term.setCursorPos(1, 1)
- end
- local function displayMenu()
- clearScreen()
- print("Doggy OS failed to boot.")
- print("1. Shutdown")
- print("2. Enter Recovery")
- end
- local function recoveryMenu()
- clearScreen()
- print("\nRecovery Options:")
- print("1. Factory Data Reset")
- print("2. Clear User Data")
- print("3. Install Doggy OS Configuration Data")
- print("4. Load Default Doggy OS Configuration Data")
- end
- local function factoryDataReset()
- clearScreen()
- print("Factory Data Reset: Deleting /disk/ and copying over /recovery/ as /disk/")
- fs.delete("/disk/")
- fs.copy("/recovery/", "/disk/")
- print("Factory Data Reset complete.")
- end
- local function clearUserData()
- clearScreen()
- print("Clear User Data: Deleting user data except for Root")
- local users = fs.list("/disk/users/")
- for _, user in ipairs(users) do
- if user ~= "Root" then
- fs.delete("/disk/users/" .. user)
- end
- end
- print("User data cleared.")
- end
- local function installConfigData()
- clearScreen()
- print("Install Doggy OS Configuration Data")
- print("Choose the source of the configuration data:")
- print("1. From Device")
- print("2. From Pastebin")
- local choice = tonumber(read())
- if choice == 1 then
- print("Enter the file location:")
- local sourceFile = read()
- fs.delete("DOS.config")
- fs.copy(sourceFile, "DOS.config")
- print("Configuration data installed.")
- elseif choice == 2 then
- print("Enter the Pastebin code:")
- local pastebinCode = read()
- fs.delete("DOS.config")
- shell.run("pastebin", "get", pastebinCode, "DOS.config")
- print("Configuration data installed.")
- else
- print("Invalid choice.")
- end
- end
- local function loadDefaultConfigData()
- clearScreen()
- print("Load Default Doggy OS Configuration Data")
- fs.delete("DOS.config")
- fs.copy("/disk/bootloader/Default.config", "DOS.config")
- print("Default configuration data loaded.")
- end
- -- Main program
- while true do
- displayMenu()
- local choice = tonumber(read())
- if choice == 1 then
- clearScreen()
- print("Shutting down...")
- os.shutdown()
- elseif choice == 2 then
- recoveryMenu()
- local recoveryChoice = tonumber(read())
- if recoveryChoice == 1 then
- factoryDataReset()
- elseif recoveryChoice == 2 then
- clearUserData()
- elseif recoveryChoice == 3 then
- installConfigData()
- elseif recoveryChoice == 4 then
- loadDefaultConfigData()
- else
- print("Invalid choice.")
- end
- else
- print("Invalid choice.")
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement