Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- Doggy OS Advanced Startup
- -- Function to clear the screen and set cursor position
- local function clearScreen()
- term.clear()
- term.setCursorPos(1, 1)
- end
- -- Function to display menu options
- local function displayMenu()
- clearScreen()
- print("Doggy OS Advanced Startup")
- print("1. System Reset")
- print("2. Power Options")
- print("3. Advanced Options")
- end
- -- Function to handle system reset options
- local function systemReset()
- clearScreen()
- print("System Reset Options:")
- print("1. Reset this PC")
- print("2. Reset Pocket Computer")
- print("3. Reset Firmware")
- local option = tonumber(read())
- if option == 1 then
- -- Reset this PC
- print("Resetting this PC...")
- fs.delete("/disk/startup")
- for _, disk in pairs(peripheral.getNames()) do
- disk = peripheral.wrap(disk)
- disk.eject()
- end
- elseif option == 2 then
- -- Reset Pocket Computer
- print("Resetting Pocket Computer...")
- fs.delete("/disk2/disk")
- elseif option == 3 then
- -- Reset Firmware
- print("Resetting Firmware...")
- local success, err = pcall(fs.delete, "/disk/startup")
- if not success then
- print("Error: " .. err)
- sleep(3)
- end
- else
- print("Invalid option.")
- end
- end
- -- Function to handle power options
- local function powerOptions()
- clearScreen()
- print("Power Options:")
- print("1. Reboot")
- print("2. Shutdown")
- local option = tonumber(read())
- if option == 1 then
- -- Reboot
- print("Rebooting...")
- os.reboot()
- elseif option == 2 then
- -- Shutdown
- print("Shutting down...")
- os.shutdown()
- else
- print("Invalid option.")
- end
- end
- -- Function to handle advanced options
- local function advancedOptions()
- clearScreen()
- print("Advanced Options:")
- print("1. Command Shell - run /disk/bootloader/recovery-shell.lua")
- print("2. System Info - run /disk/bootloader/VA11-ILLA.lua")
- local option = tonumber(read())
- if option == 1 then
- -- Command Shell
- print("Running Command Shell...")
- local success, err = pcall(shell.run, "/disk/bootloader/recovery-shell.lua")
- if not success then
- print("Error: " .. err)
- sleep(3)
- end
- elseif option == 2 then
- -- System Info
- print("Running System Info...")
- local success, err = pcall(shell.run, "/disk/bootloader/VA11-ILLA.lua")
- if not success then
- print("Error: " .. err)
- sleep(3)
- end
- else
- print("Invalid option.")
- end
- end
- -- Main program
- clearScreen()
- while true do
- displayMenu()
- local choice = tonumber(read())
- if choice == 1 then
- systemReset()
- elseif choice == 2 then
- powerOptions()
- elseif choice == 3 then
- advancedOptions()
- else
- print("Invalid choice. Please try again.")
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement