From 03b0b5288022bd24a13f431de21d321a7483001c Mon Sep 17 00:00:00 2001 From: onefang Date: Tue, 5 Nov 2019 00:09:10 +1000 Subject: Add the round robin stuff to the mirrors.lua, and jiggle the code that loops through mirrors. --- mirror-checker.lua | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) (limited to 'mirror-checker.lua') diff --git a/mirror-checker.lua b/mirror-checker.lua index 6580190..3da8bc6 100755 --- a/mirror-checker.lua +++ b/mirror-checker.lua @@ -443,6 +443,9 @@ local getMirrors = function () mirrors[host] = m end end + mirrors[options.roundRobin.value] = { ["Protocols"] = { ["http"] = true; ["https"] = true; }; ["FQDN"] = 'deb.devuan.org'; ["Active"] = 'yes'; ["BaseURL"] = 'deb.devuan.org'; } + gatherIPs(options.roundRobin.value) + mirrors[options.roundRobin.value].IPs = IP[options.roundRobin.value] local file, e = io.open("results/mirrors.lua", "w+") if nil == file then C("opening mirrors file - " .. e) else file:write(dumpTable(mirrors, "", "mirrors") .. "\nreturn mirrors\n") @@ -575,9 +578,7 @@ else I("Starting tests " .. table.concat(options.tests.value, ", ")) execute("mkdir -p results") mirrors = getMirrors() - mirrors[options.referenceSite.value] = nil checkHost(options.referenceSite.value) - checkHost("deb.devuan.org") for k, m in pairs(mirrors) do if "/" == m.BaseURL:sub(-1, -1) then W("slash at end of BaseURL in mirror_list.txt! " .. m.BaseURL) @@ -588,9 +589,11 @@ else m.BaseURL = m.BaseURL:sub(1, -2) end local pu = url.parse("http://" .. m.BaseURL) - checkHost(m.BaseURL) - checkExes("mirror-checker.lua " .. sendArgs) - if testing("Integrity") or testing("Updated") then checkExes(downloadLock) end + if options.referenceSite.value ~= pu.host then + checkHost(m.BaseURL) + checkExes("mirror-checker.lua " .. sendArgs) + if testing("Integrity") or testing("Updated") then checkExes(downloadLock) end + end end while 1 <= checkExes("mirror-checker.lua " .. sendArgs) do os.execute("sleep 10") end if testing("Integrity") or testing("Updated") then -- cgit v1.1