2018-08-06 19:22:21 +10:00
|
|
|
local serial = require "serialization"
|
|
|
|
|
|
|
|
local tArgs = {...}
|
|
|
|
local src, dest = tArgs[1], tArgs[2].."/"
|
|
|
|
|
|
|
|
os.execute("mkdir "..dest.."/master/")
|
|
|
|
os.execute("wget "..src.." -O "..dest.."/master/programs.cfg")
|
|
|
|
|
|
|
|
local pathpre = src:match("(.+/).+/.+")
|
|
|
|
print(pathpre)
|
|
|
|
|
|
|
|
local f = io.open(dest.."/master/programs.cfg","rb")
|
|
|
|
if not f then
|
|
|
|
print("Unable to open programs.cfg")
|
|
|
|
return false
|
|
|
|
end
|
|
|
|
local programs = serial.unserialize(f:read("*a"))
|
|
|
|
f:close()
|
|
|
|
|
|
|
|
local dlfiles = {}
|
|
|
|
for k,v in pairs(programs) do
|
|
|
|
if v.files then
|
|
|
|
for l,m in pairs(v.files) do
|
|
|
|
dlfiles[#dlfiles+1] = l
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
for k,v in pairs(dlfiles) do
|
|
|
|
local path,fn = v:match("(.+)/(.+)")
|
2019-11-09 17:12:00 +11:00
|
|
|
if v:sub(1,4) ~= "http" then
|
|
|
|
os.execute("mkdir -p "..dest..path)
|
|
|
|
os.execute("wget "..pathpre..v.." -O "..dest..v)
|
|
|
|
print("wget "..pathpre..v.." -O "..dest..v..">/dev/null")
|
|
|
|
else
|
|
|
|
os.execute("mkdir -p "..dest.."/external")
|
|
|
|
print("wget "..v.." -O "..dest.."/external/"..v)
|
|
|
|
os.execute("wget "..v.." -O "..dest.."/external/"..fn.."> /dev/null")
|
|
|
|
end
|
2018-08-06 19:22:21 +10:00
|
|
|
end
|
|
|
|
|
2019-11-09 17:12:00 +11:00
|
|
|
os.execute("wget https://git.shadowkat.net/izaya/OC-misc/raw/branch/master/repo-installer/repoinstaller.lua -O "..dest.."/.install")
|