added an installer generator

This commit is contained in:
Izaya 2018-08-06 19:22:21 +10:00
parent 230a04f59f
commit 61845fb7cc
1 changed files with 36 additions and 0 deletions

36
instgen.lua Normal file
View File

@ -0,0 +1,36 @@
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("(.+)/(.+)")
os.execute("mkdir "..dest..path)
os.execute("wget "..pathpre..v.." -O "..dest..v)
print("wget "..pathpre..v.." -O "..dest..v)
end
os.execute("wget https://git.shadowkat.net/izaya/OC-misc/raw/branch/master/repoinstaller.lua "..dest.."/.install")