Test install script
This commit is contained in:
parent
58cff5be78
commit
944ad4d679
18
install.lua
Normal file
18
install.lua
Normal file
|
@ -0,0 +1,18 @@
|
||||||
|
fs.makeDir("/ccryptolib") -- Make folder structure
|
||||||
|
|
||||||
|
function downloadDir(dir)
|
||||||
|
local data = textutils.unserialiseJSON(http.get("https://git.chrischro.me/api/v1/repos/ChrisChrome/ccryptolib/contents/" .. dir).readAll())
|
||||||
|
for _,entry in ipairs(data) do
|
||||||
|
if entry.type == "file" then -- We're gonna download it
|
||||||
|
print("Downloading " .. entry.name)
|
||||||
|
local file = http.get(entry.download_url).readAll()
|
||||||
|
local newFile = fs.open("/" .. entry.path, "w")
|
||||||
|
newFile.write(file)
|
||||||
|
newFile.close()
|
||||||
|
elseif entry.type == "dir" then
|
||||||
|
downloadDir(entry.path)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
downloadDir("ccryptolib")
|
Loading…
Reference in a new issue