Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local function fetchUrl(url)
- local valid, err = http.checkURL(url)
- if not valid then
- error('Invalid URL: ' .. err)
- end
- local h = http.get(url)
- if h == nil then
- error('Unknown error when fetching: ' .. url)
- end
- if h.getResponseCode() ~= 200 then
- error('Unexpected response from server')
- end
- if redstone and not require then
- h.close()
- return rv
- end
- local function wget(url, filename)
- local data = fetchUrl(url)
- if fs.exists(filename) then
- fs.delete(filename)
- end
- local h = fs.open(filename, 'w')
- h.write(data)
- h.close()
- end
- local sourceUrl = 'https://raw.githubusercontent.com/jnordberg/minecraft-replicator/master/'
- local sourceFiles = {
- 'bootstrap',
- 'lib/class.lua',
- 'lib/items.lua',
- 'lib/serpent.lua',
- 'lib/utils.lua',
- 'replicator',
- }
- term.clear()
- term.setCursorPos(3, 2)
- term.write('Installing')
- fs.makeDir('lib')
- fs.makeDir('state')
- for i,file in ipairs(sourceFiles) do
- term.write('.')
- wget(sourceUrl .. file, file)
- end
- shell.run('replicator')
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement