autoupdater: add possibility to specify mirrors on commandline (#123)
This commit is contained in:
parent
c7de283d44
commit
463f872844
|
@ -35,6 +35,7 @@ local force = false
|
||||||
-- timespan given by the priority and another 24h have passed
|
-- timespan given by the priority and another 24h have passed
|
||||||
local fallback = false
|
local fallback = false
|
||||||
|
|
||||||
|
local mirrors = {}
|
||||||
|
|
||||||
local function parse_args()
|
local function parse_args()
|
||||||
local i = 1
|
local i = 1
|
||||||
|
@ -52,9 +53,11 @@ local function parse_args()
|
||||||
end
|
end
|
||||||
|
|
||||||
branch_name = arg[i]
|
branch_name = arg[i]
|
||||||
else
|
elseif arg[i]:sub(0, 1) == '-' then
|
||||||
io.stderr:write("Error parsing command line: unexpected argument '" .. arg[i] .. "'\n")
|
io.stderr:write("Error parsing command line: unexpected argument '" .. arg[i] .. "'\n")
|
||||||
os.exit(1)
|
os.exit(1)
|
||||||
|
else
|
||||||
|
table.insert(mirrors, arg[i])
|
||||||
end
|
end
|
||||||
|
|
||||||
i = i+1
|
i = i+1
|
||||||
|
@ -350,10 +353,13 @@ if not lockfd:lock('tlock') then
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
local mirrors = branch.mirror
|
if #mirrors == 0 then
|
||||||
|
while #branch.mirror > 0 do
|
||||||
|
table.insert(mirrors, table.remove(branch.mirror, math.random(#branch.mirror)))
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
while #mirrors > 0 do
|
for k, mirror in ipairs(mirrors) do
|
||||||
local mirror = table.remove(mirrors, math.random(#mirrors))
|
|
||||||
if autoupdate(mirror) then
|
if autoupdate(mirror) then
|
||||||
os.exit(0)
|
os.exit(0)
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue