From 61845fb7cc14bca9d67bdcbaac6f40fa1e479992 Mon Sep 17 00:00:00 2001 From: Izaya Date: Mon, 6 Aug 2018 19:22:21 +1000 Subject: [PATCH] added an installer generator --- instgen.lua | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 instgen.lua diff --git a/instgen.lua b/instgen.lua new file mode 100644 index 0000000..bb20ea5 --- /dev/null +++ b/instgen.lua @@ -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")