made makepkg output valid archives

This commit is contained in:
Izaya 2020-06-06 18:53:45 +10:00
parent 9e4464e2fa
commit c3aed37d97
1 changed files with 5 additions and 3 deletions

View File

@ -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