Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local git = "https://raw.github.com/MudkipTheEpic/ComputerCraft/master"
- local InstallFiles = {
- {"APIs/osrunner", "APIs/osrunner"};
- {"APIs/zip", "APIs/zip"};
- {"Resources/logo", "Resources/logo"};
- {"Resources/main", "Resources/main"};
- {"Boot/startup", "Boot/startup"};
- }
- local Directories = {
- "APIs";
- "Resources";
- "Boot";
- }
- local Version = "1.1"
- if not http then
- print("You must have http enabled to install OSRunner")
- return
- end
- local function Download(Link)
- if not http then return false end
- local Res = http.get(Link)
- if not Res then return false end
- local ToR = Res.readAll()
- Res.close()
- return ToR
- end
- local Vers = Download(git .. "/CurrentVersion/installer")
- if Vers ~= Version then
- local Update = Download(git .. "/installer")
- local Fo = fs.open(shell.getRunningProgram(), "w")
- Fo.write(Update)
- Fo.close()
- shell.run(shell.getRunningProgram())
- return
- end
- for i,v in pairs(Directories) do
- if fs.exists(v) then
- fs.delete(v)
- end
- fs.makeDir(v)
- end
- for i,v in pairs(InstallFiles) do
- if fs.exists(v[2]) then
- fs.delete(v[2])
- end
- local Res = Download(git .. "/" .. v[1])
- if Res == false then
- print("Unable to download")
- return
- end
- local Fo = fs.open(v[2], "w")
- Fo.write(Res)
- Fo.close()
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement