Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function getUrlFile(url)
- local status, mrHttpFile = pcall(http.get, url)
- if not status then
- print("\nFailed to get Program Versions file.")
- print("Error: ".. mrHttpFile)
- return exit
- end
- mrHttpFile = mrHttpFile.readAll()
- return mrHttpFile
- end
- function writeFile(filename, data)
- local file = fs.open(filename, "w")
- file.write(data)
- file.close()
- end
- if http then
- print("Grabbing retriever..")
- cat = getUrlFile("https://raw.github.com/darkrising/darkprograms/darkprograms/programVersions")
- if not cat then
- return exit
- end
- cat = textutils.unserialize(cat)
- currentRunning = shell.getRunningProgram()
- program = getUrlFile(cat["darkretriever"].GitURL)
- writeFile(currentRunning, program)
- shell.run(currentRunning)
- else
- print("HTTP is not enabled.")
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement