--sif-standard-installer local url = "https://raw.github.com/Siftos/sif-standard/latest-release/" --Vars --Functions local function save(content, filename) if fs.exists("sif-standard/"..filename) then fs.delete("sif-standard"..filename) end local file = fs.open("sif-standard/"..filename, "w") file.write(content) file.close() end local function download(file) save(http.get(url..file).readAll(), file) end --RUN term.setTextColor(colors.blue) print("Do you want to download sif-standard on this computer? [Y/N]") local consent = false while true do local event, key = os.pullEvent() if event == "key" then if key == keys.y then consent = true break end if key == keys.n then consent = false break end end end if not consent then return end if not fs.isDir("/sif-standard") then fs.makeDir("/sif-standard") end download("json.lua") os.loadAPI("sif-standard/json.lua") local filenames = {} print(" ") print("Fetching information...") local err, response_table = json.decode(http.get("https://api.github.com/repos/Siftos/sif-standard/git/trees/latest-release?recursive=1").readAll()) for i, v in ipairs(response_table["tree"]) do filenames[#filenames + 1] = v["path"] end local x, y = term.getCursorPos() local percent = 0 term.setTextColor(colors.white) term.write("Downloading... ["..percent.."%]") for i = 1, #filenames do term.setCursorPos(x,y) download(filenames[i]) percent = math.floor(i/#filenames * 100) term.setTextColor(colors.white) term.write("Downloading... ") term.setTextColor(colors.yellow) if percent == 100 then term.setTextColor(colors.lime) end term.write("["..percent.."%]") end term.setTextColor(colors.blue) print(" ") print("Do you want to turn on autoupdating? [Y/N]") local consent = false while true do local _, key = os.pullEvent("key") if key == keys.y then consent = true break end if key == keys.n then term.setTextColor(colors.white) print(" ") print(" ") print("Thank you for downloading sif-standard libraries! Enjoy :)") consent = false break end end if not consent then return end if fs.exists("/startup.lua") then fs.delete("/startup.lua") end local file = fs.open("startup.lua", "w") file.write("shell.run(\"sif-standard/updater.lua\")") file.close() term.setTextColor(colors.white) print(" ") print("Thank you for downloading sif-standard libraries! Enjoy :)")