made repoinstaller cope with external files reasonably

This commit is contained in:
Izaya 2019-11-09 17:12:00 +11:00
parent b68f1ad9e1
commit 7a48f1a27f
2 changed files with 21 additions and 7 deletions

View File

@ -28,9 +28,15 @@ 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)
if v:sub(1,4) ~= "http" then
os.execute("mkdir -p "..dest..path)
os.execute("wget "..pathpre..v.." -O "..dest..v)
print("wget "..pathpre..v.." -O "..dest..v..">/dev/null")
else
os.execute("mkdir -p "..dest.."/external")
print("wget "..v.." -O "..dest.."/external/"..v)
os.execute("wget "..v.." -O "..dest.."/external/"..fn.."> /dev/null")
end
end
os.execute("wget https://git.shadowkat.net/izaya/OC-misc/raw/branch/master/repo-installer/repoinstaller.lua "..dest.."/.install")
os.execute("wget https://git.shadowkat.net/izaya/OC-misc/raw/branch/master/repo-installer/repoinstaller.lua -O "..dest.."/.install")

View File

@ -190,14 +190,22 @@ local function install(pkg,where) -- installs a package, pkg, to where
if m:sub(1,2) ~= "//" then
if not fs.exists(fs.canonical(where.."/"..m)) then
os.execute("mkdir "..fs.canonical(where.."/"..m))
end
os.execute("cp -v "..rpath.."/"..l.." "..fs.canonical(where.."/"..m))
end
if l:sub(1,4) == "http" then
os.execute("cp -v "..rpath.."/external/"..l:match(".+/(.+)").." "..fs.canonical(where.."/"..m))
else
os.execute("cp -v "..rpath.."/"..l.." "..fs.canonical(where.."/"..m))
end
ipackages[pkg][l] = fs.canonical(where.."/"..m).."/"..lseg[#lseg]
else
if not fs.exists(fs.canonical(m:sub(2))) then
os.execute("mkdir "..fs.canonical(m:sub(2)))
end
os.execute("cp -v "..rpath.."/"..l.." "..fs.canonical(m:sub(2)))
if l:sub(1,4) == "http" then
os.execute("cp -v "..rpath.."/external/"..l:match(".+/(.+)").." "..fs.canonical(where.."/"..m))
else
os.execute("cp -v "..rpath.."/"..l.." "..fs.canonical(where.."/"..m))
end
ipackages[pkg][l] = fs.canonical(m:sub(2)).."/"..lseg[#lseg]
end
end