Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local function clearScreen()
- term.clear()
- term.setCursorPos(1, 1)
- end
- local function showError(errorMessage)
- clearScreen()
- print("Error: " .. errorMessage)
- sleep(2)
- end
- local function showMainMenu()
- clearScreen()
- print("Main Menu:")
- print("1. Recovery")
- print("2. Applications")
- print("3. Device Info")
- print("4. Exit")
- end
- local function showRecoveryMenu()
- clearScreen()
- print("Recovery Menu:")
- print("1. Reset PIN")
- print("2. Wipe Device")
- print("3. Backup OS")
- print("4. Restore OS")
- print("5. Back to Main Menu")
- end
- local function showAppsMenu()
- clearScreen()
- print("Applications Menu:")
- print("1. Sideload Apps")
- print("2. Download Apps from Connected Device")
- print("3. Reset Apps")
- print("4. Back to Main Menu")
- end
- local function deviceInfo()
- clearScreen()
- print("Device Info:")
- local label = os.getComputerLabel() or "Unnamed Device"
- print("Label: " .. label)
- print("Doggy OS Version: 1.0") -- Update with actual version
- local va11illaVersion = "Unknown"
- local va11illaFile = fs.open("/disk2/disk/bootloader/VA11-ILLA.lua", "r")
- if va11illaFile then
- local va11illaContent = va11illaFile.readAll()
- va11illaFile.close()
- va11illaVersion = string.match(va11illaContent, 'version%s*=%s*"([^"]+)"') or "Unknown"
- end
- print("VA11-ILLA Version: " .. va11illaVersion)
- print("Security: High") -- Example security level
- print("Press Enter to return to the Main Menu")
- read() -- Wait for user input before returning to main menu
- end
- local function resetPIN()
- clearScreen()
- print("Reset PIN:")
- print("Enter new PIN:")
- local newPIN = read("*n")
- print("Confirm new PIN:")
- local confirmPIN = read("*n")
- if newPIN == confirmPIN then
- local configFile = fs.open("/disk/PIN.config", "w")
- configFile.write(tostring(newPIN))
- configFile.close()
- print("PIN reset successfully.")
- else
- showError("PINs do not match. Operation aborted.")
- end
- sleep(2)
- end
- local function wipeDevice()
- clearScreen()
- print("Wipe Device:")
- fs.delete("/disk2/disk/")
- fs.delete("/disk2/startup")
- fs.delete("/disk2/no-os")
- print("Device wiped successfully.")
- sleep(2)
- end
- local function backupOS()
- clearScreen()
- print("Backup OS:")
- fs.copy("/disk2/disk/", "/" .. os.getComputerLabel() .. "-Backup/")
- print("OS backed up successfully.")
- sleep(2)
- end
- local function restoreOS()
- clearScreen()
- print("Restore OS:")
- fs.copy("/" .. os.getComputerLabel() .. "-Backup/", "/disk2/disk/")
- fs.move("/disk2/startup", "/")
- fs.move("/disk2/no-os", "/")
- print("OS restored successfully.")
- sleep(2)
- end
- local function sideloadApps()
- clearScreen()
- print("Sideload Apps:")
- print("Enter app name or directory to sideload:")
- local appPath = read()
- local success, error = pcall(function()
- fs.copy(appPath, "/disk2/disk/packages/")
- print("App sideloaded successfully.")
- end)
- if not success then
- showError(error)
- end
- sleep(2)
- end
- local function downloadApps()
- clearScreen()
- print("Download Apps from Connected Device:")
- print("Enter app name or directory to download:")
- local appPath = read()
- local success, error = pcall(function()
- fs.copy(appPath, "/disk/")
- print("App downloaded successfully.")
- end)
- if not success then
- showError(error)
- end
- sleep(2)
- end
- local function resetApps()
- clearScreen()
- print("Reset Apps:")
- local files = fs.list("/disk2/disk/packages")
- for _, file in ipairs(files) do
- if file ~= "Package-installer" then
- fs.delete("/disk2/disk/packages/" .. file)
- end
- end
- print("Apps reset successfully.")
- sleep(2)
- end
- while true do
- showMainMenu()
- local choice = tonumber(read())
- if choice == 1 then
- while true do
- showRecoveryMenu()
- local recoveryChoice = tonumber(read())
- if recoveryChoice == 1 then
- resetPIN()
- elseif recoveryChoice == 2 then
- wipeDevice()
- elseif recoveryChoice == 3 then
- backupOS()
- elseif recoveryChoice == 4 then
- restoreOS()
- elseif recoveryChoice == 5 then
- break
- else
- showError("Invalid choice.")
- end
- end
- elseif choice == 2 then
- while true do
- showAppsMenu()
- local appsChoice = tonumber(read())
- if appsChoice == 1 then
- sideloadApps()
- elseif appsChoice == 2 then
- downloadApps()
- elseif appsChoice == 3 then
- resetApps()
- elseif appsChoice == 4 then
- break
- else
- showError("Invalid choice.")
- end
- end
- elseif choice == 3 then
- deviceInfo()
- elseif choice == 4 then
- clearScreen()
- print("Exiting...")
- sleep(1)
- break
- else
- showError("Invalid choice.")
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement