Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local function displayLegacyBootloader()
- -- Clear the terminal screen
- term.clear()
- -- Set cursor position to the top-left corner
- term.setCursorPos(1, 1)
- -- Print the bootloader title
- print("Doggy OS Legacy Bootloader")
- print("") -- Empty line for spacing
- -- Print the bootloader ASCII art
- print(" _________________")
- print(" | | ___________ |o|")
- print(" | | ___________ | |")
- print(" | | ___________ | |")
- print(" | | ___________ | |")
- print(" | |_____________| |")
- print(" | _______ |")
- print(" | | | ||")
- print(" | DD | | V|")
- print(" |____|_______|____|")
- print("") -- Empty line for spacing
- end
- local function promptUser()
- -- Display options to the user
- print("Please insert a Doggy OS disk.")
- print("Press 1 to copy over /disk2/ as recovery.")
- print("Press 2 to copy over /disk/ as recovery.")
- print("Press q to quit.")
- end
- local function copyDisk(source, destination)
- -- Copy contents from source to destination
- fs.delete(destination) -- Ensure the destination is empty
- fs.copy(source, destination)
- print("Recovery files copied successfully to " .. destination)
- end
- local function main()
- -- Display the bootloader menu
- displayLegacyBootloader()
- -- Prompt the user for action
- promptUser()
- -- Wait for user input
- local event, key
- repeat
- event, key = os.pullEvent("key")
- until key == keys.one or key == keys.two or key == keys.q
- -- Perform the appropriate action based on user input
- if key == keys.one then
- if disk.isPresent("left") then
- copyDisk("/disk", "/disk2")
- else
- print("No disk found in the left drive.")
- end
- elseif key == keys.two then
- if disk.isPresent("left") then
- copyDisk("/disk", "/disk")
- else
- print("No disk found in the left drive.")
- end
- elseif key == keys.q then
- print("Exiting bootloader.")
- return
- end
- -- Reboot the system
- os.reboot()
- end
- -- Run the main function
- main()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement