made makepkg output valid archives
This commit is contained in:
parent
9e4464e2fa
commit
c3aed37d97
@ -25,14 +25,14 @@ end
|
|||||||
local function fnormalize(path)
|
local function fnormalize(path)
|
||||||
local rt = {}
|
local rt = {}
|
||||||
for segment in path:gmatch("[^/]+") do
|
for segment in path:gmatch("[^/]+") do
|
||||||
if segment ~= "." and segment ~= ".." then
|
if segment ~= "." then
|
||||||
rt[#rt+1] = segment
|
rt[#rt+1] = segment
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
return table.concat(rt,"/")
|
return table.concat(rt,"/")
|
||||||
end
|
end
|
||||||
|
|
||||||
local dirs, files = {tArgs[1]},{}
|
local dirs, files = {fnormalize(tArgs[1])},{}
|
||||||
for _,dir in ipairs(dirs) do
|
for _,dir in ipairs(dirs) do
|
||||||
for file in fs.dir(dir) do
|
for file in fs.dir(dir) do
|
||||||
if file == "." or file == ".." then
|
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"))
|
local pkginfo = serial.unserialize(f:read("*a"))
|
||||||
f:close()
|
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")
|
local of = io.open(outpath,"wb")
|
||||||
for k,v in ipairs(files) do
|
for k,v in ipairs(files) do
|
||||||
@ -68,6 +69,7 @@ if lzss then
|
|||||||
print("Compressing "..outpath.." to "..outpath..".lss")
|
print("Compressing "..outpath.." to "..outpath..".lss")
|
||||||
local f = io.open(outpath,"rb")
|
local f = io.open(outpath,"rb")
|
||||||
local of = io.open(outpath..".lss","wb")
|
local of = io.open(outpath..".lss","wb")
|
||||||
|
of:write("lz16")
|
||||||
while true do
|
while true do
|
||||||
local b = f:read(4096)
|
local b = f:read(4096)
|
||||||
if not b or b:len() < 1 then break end
|
if not b or b:len() < 1 then break end
|
||||||
|
Loading…
Reference in New Issue
Block a user