Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local function drawSeparator()
- print(string.rep("-", 30))
- end
- local function showMenu()
- term.clear()
- term.setCursorPos(1, 1)
- print("=== VA11-ILLA Bootloader Tool ===")
- drawSeparator()
- print("1. Download file from Pastebin")
- print("2. Use a local file")
- print("3. Exit")
- drawSeparator()
- term.write("Enter your choice: ")
- end
- local function downloadFromPastebin()
- term.clear()
- term.setCursorPos(1, 1)
- print("=== Download from Pastebin ===")
- drawSeparator()
- term.write("Enter Pastebin code: ")
- local code = read()
- local url = "https://pastebin.com/raw/" .. code
- local response = http.get(url)
- if response then
- local file = fs.open("VA11-ILLA_DOSBL", "w")
- file.write(response.readAll())
- file.close()
- response.close()
- print("\nFile downloaded successfully as VA11-ILLA_DOSBL!")
- sleep(2)
- return true
- else
- print("\nFailed to download. Check the code or network connection.")
- sleep(2)
- return false
- end
- end
- local function copyFromLocal()
- term.clear()
- term.setCursorPos(1, 1)
- print("=== Use Local File ===")
- drawSeparator()
- term.write("Enter the path to the local file: ")
- local path = read()
- if fs.exists(path) then
- fs.copy(path, "VA11-ILLA_DOSBL")
- print("\nFile copied successfully as VA11-ILLA_DOSBL!")
- sleep(2)
- return true
- else
- print("\nFile not found. Check the path.")
- sleep(2)
- return false
- end
- end
- local function runRepairScript()
- term.clear()
- term.setCursorPos(1, 1)
- print("Running FW-REPAIR...")
- drawSeparator()
- if fs.exists("/disk/bootloader/FW-REPAIR.lua") then
- shell.run("/disk/bootloader/FW-REPAIR.lua")
- else
- print("\nError: Repair script not found at /disk/bootloader/FW-REPAIR.lua")
- sleep(2)
- end
- end
- local function main()
- while true do
- showMenu()
- local choice = read()
- if choice == "1" then
- if downloadFromPastebin() then
- runRepairScript()
- end
- elseif choice == "2" then
- if copyFromLocal() then
- runRepairScript()
- end
- elseif choice == "3" then
- print("\nExiting tool. Goodbye!")
- sleep(1)
- break
- else
- print("\nInvalid choice. Please try again.")
- sleep(2)
- end
- end
- end
- main()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement