From c3aed37d97243b801c442c95d8908400d77364ef Mon Sep 17 00:00:00 2001 From: XeonSquared Date: Sat, 6 Jun 2020 18:53:45 +1000 Subject: [PATCH] made makepkg output valid archives --- makepkg.lua | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/makepkg.lua b/makepkg.lua index 842a26f..35e4b73 100644 --- a/makepkg.lua +++ b/makepkg.lua @@ -25,14 +25,14 @@ end local function fnormalize(path) local rt = {} for segment in path:gmatch("[^/]+") do - if segment ~= "." and segment ~= ".." then + if segment ~= "." then rt[#rt+1] = segment end end return table.concat(rt,"/") end -local dirs, files = {tArgs[1]},{} +local dirs, files = {fnormalize(tArgs[1])},{} for _,dir in ipairs(dirs) do for file in fs.dir(dir) do if file == "." or file == ".." then @@ -49,7 +49,8 @@ if not f then error("no package.cfg in source") end local pkginfo = serial.unserialize(f:read("*a")) f:close() -local outpath = tArgs[2].."/"..tArgs[1]..".mtar" +local outpath = tArgs[2].."/"..fnormalize(tArgs[1])..".mtar" +print(outpath) local of = io.open(outpath,"wb") for k,v in ipairs(files) do @@ -68,6 +69,7 @@ if lzss then print("Compressing "..outpath.." to "..outpath..".lss") local f = io.open(outpath,"rb") local of = io.open(outpath..".lss","wb") + of:write("lz16") while true do local b = f:read(4096) if not b or b:len() < 1 then break end