Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- Doggy OS Developer Firmware Installer
- -- Function to install custom bootloader
- local function installCustomBootloader()
- print("Enter the path to the custom bootloader file:")
- local bootloaderFile = read()
- print("Enter the directory to install the bootloader:")
- local directory = read()
- -- Check if file and directory exist
- if fs.exists(bootloaderFile) and fs.isDir(directory) then
- -- Replace the startup program
- local startupFile = fs.combine(directory, "startup")
- local handle, err = fs.open(startupFile, "w")
- if not handle then
- print("Error: " .. err)
- return
- end
- handle.writeLine('shell.run("/disk/boot/check-recovery")')
- handle.writeLine('shell.run("no-os")')
- handle.writeLine('print("Unknown Bootloader")')
- handle.close()
- print("Custom bootloader installed successfully.")
- else
- print("Error: File or directory not found.")
- end
- end
- -- Function to install custom recovery
- local function installCustomRecovery()
- print("Enter the path to the custom recovery file:")
- local recoveryFile = read()
- -- Check if file exists
- if fs.exists(recoveryFile) then
- -- Replace the Recovery.lua file
- fs.copy(recoveryFile, "/disk/boot/Recovery.lua")
- print("Custom recovery installed successfully.")
- else
- print("Error: File not found.")
- end
- end
- -- Function to install custom boot error message
- local function installCustomBootErrorMessage()
- print("Enter the path to the custom boot error message file:")
- local errorMessageFile = read()
- -- Check if file exists
- if fs.exists(errorMessageFile) then
- -- Read the content of the file to check for security risk
- local handle = fs.open(errorMessageFile, "r")
- local content = handle.readAll()
- handle.close()
- -- Check if the content contains security risk
- if content:find("read()") and content:find("os.reboot") then
- print("Are you sure you want to replace Boot error message with this program?")
- print("It is unsecure and is a security risk. Please choose another program or proceed with caution.")
- print("Proceed with caution? (yes/no)")
- local choice = read()
- if choice == "yes" then
- -- Replace the no-os read() function with the custom error message
- fs.copy(errorMessageFile, "/disk/no-os")
- print("Custom boot error message installed successfully.")
- else
- print("Installation cancelled.")
- end
- else
- print("Error: The provided file does not meet the security requirements.")
- end
- else
- print("Error: File not found.")
- end
- end
- -- Main function
- local function main()
- print("Welcome to Doggy OS Developer Firmware Installer")
- print("1. Install Custom Bootloader")
- print("2. Install Custom Recovery")
- print("3. Install Custom Boot Error Message")
- print("4. Exit")
- local choice = tonumber(read())
- if choice == 1 then
- installCustomBootloader()
- elseif choice == 2 then
- installCustomRecovery()
- elseif choice == 3 then
- installCustomBootErrorMessage()
- elseif choice == 4 then
- print("Exiting...")
- os.reboot()
- else
- print("Invalid choice.")
- end
- end
- -- Run the main function
- main()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement