Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- Define a function to delete a file if it exists
- local function deleteFile(path)
- if fs.exists(path) then
- fs.delete(path)
- print("Deleted existing file: " .. path)
- end
- end
- -- Define a function to download a file from Pastebin
- local function downloadFile(pastebinCode, path)
- local response = http.get("https://pastebin.com/raw/" .. pastebinCode)
- if response then
- local content = response.readAll()
- response.close()
- local file = fs.open(path, "w")
- file.write(content)
- file.close()
- print("Downloaded " .. path)
- else
- print("Failed to download " .. pastebinCode)
- end
- end
- -- Define file paths and Pastebin codes
- local files = {
- {code = "3vvyfD4Y", path = "/disk/os/programs"},
- {code = "p6TqHfWw", path = "/disk/packages/package-editor"},
- {code = "LYPfg5JZ", path = "/disk/packages/package-remover"},
- {code = "5hSF8Rda", path = "/disk/packages/package-installer"}
- }
- -- Delete existing files and download new ones
- for _, file in ipairs(files) do
- deleteFile(file.path)
- downloadFile(file.code, file.path)
- end
- -- Display update complete message and wait for user input
- print("Update Complete. Press Enter to continue...")
- read()
- -- Run the specified program
- shell.run("/disk/os/gui")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement