diff options
author | onefang | 2019-09-07 01:34:25 +1000 |
---|---|---|
committer | onefang | 2019-09-07 01:34:25 +1000 |
commit | 0c8e9bf6dc96e6970aac00af9546293d23916bc0 (patch) | |
tree | a0ccd7c545fa26e0be616db6f598a4bc35b22de5 | |
parent | Split the checked packages to Debain and Devuan based ones. (diff) | |
download | apt-panopticon-0c8e9bf6dc96e6970aac00af9546293d23916bc0.zip apt-panopticon-0c8e9bf6dc96e6970aac00af9546293d23916bc0.tar.gz apt-panopticon-0c8e9bf6dc96e6970aac00af9546293d23916bc0.tar.bz2 apt-panopticon-0c8e9bf6dc96e6970aac00af9546293d23916bc0.tar.xz |
Use the saved mirrors list and the split packages lists.
-rwxr-xr-x | mirror-checker.lua | 22 |
1 files changed, 13 insertions, 9 deletions
diff --git a/mirror-checker.lua b/mirror-checker.lua index 6d74e59..d141f8e 100755 --- a/mirror-checker.lua +++ b/mirror-checker.lua | |||
@@ -133,11 +133,15 @@ local W = function(s) log(1, "WARNING ", s) end | |||
133 | local E = function(s) log(0, "ERROR ", s) end | 133 | local E = function(s) log(0, "ERROR ", s) end |
134 | local C = function(s) log(-1, "CRITICAL", s) end | 134 | local C = function(s) log(-1, "CRITICAL", s) end |
135 | 135 | ||
136 | local testing = function(t) | ||
137 | local mirrors = {} | 136 | local mirrors = {} |
138 | 137 | ||
138 | local testing = function(t, host) | ||
139 | for i, v in pairs(options.tests.value) do | 139 | for i, v in pairs(options.tests.value) do |
140 | if t == v then return true end | 140 | if t == v then |
141 | local h = mirrors[host] | ||
142 | if nil == h then return true end | ||
143 | if true == h["Protocols"][t] then return true else D("Skipping " .. t .. " checks for " .. host) end | ||
144 | end | ||
141 | end | 145 | end |
142 | return false | 146 | return false |
143 | end | 147 | end |
@@ -262,20 +266,20 @@ local checkPaths = function (host, ip, path, file) | |||
262 | if nil ~= file then | 266 | if nil ~= file then |
263 | if "redirect" == ip then ip = host end | 267 | if "redirect" == ip then ip = host end |
264 | I(" Checking IP for file " .. host .. " -> " .. ip .. " " .. path .. " " .. file) | 268 | I(" Checking IP for file " .. host .. " -> " .. ip .. " " .. path .. " " .. file) |
265 | if testing("http") then checkURL(host, "http://" .. ip .. path .. "/" .. file) end | 269 | if testing("http", host) then checkURL(host, "http://" .. ip .. path .. "/" .. file) end |
266 | if testing("https") then checkURL(host, "https://" .. ip .. path .. "/" .. file) end | 270 | if testing("https", host) then checkURL(host, "https://" .. ip .. path .. "/" .. file) end |
267 | else | 271 | else |
268 | I(" Checking IP " .. host .. " -> " .. ip .. " " .. path) | 272 | I(" Checking IP " .. host .. " -> " .. ip .. " " .. path) |
269 | for i, s in pairs(referenceDebs) do | 273 | for i, s in pairs(referenceDevs) do |
270 | if testing("http") then checkURL(host, "http://" .. ip .. path .. "/" .. s) end | 274 | if testing("http", host) then checkURL(host, "http://" .. ip .. path .. "/" .. s) end |
271 | if testing("https") then checkURL(host, "https://" .. ip .. path .. "/" .. s) end | 275 | if testing("https", host) then checkURL(host, "https://" .. ip .. path .. "/" .. s) end |
272 | end | 276 | end |
273 | 277 | ||
274 | for i, s in pairs(releases) do | 278 | for i, s in pairs(releases) do |
275 | for j, k in pairs(releaseFiles) do | 279 | for j, k in pairs(releaseFiles) do |
276 | if repoExists(s .. k) then | 280 | if repoExists(s .. k) then |
277 | if testing("http") then checkURL(host, "http://" .. ip .. path .. "/merged/dists/" .. s .. k) end | 281 | if testing("http", host) then checkURL(host, "http://" .. ip .. path .. "/merged/dists/" .. s .. k) end |
278 | if testing("https") then checkURL(host, "https://" .. ip .. path .. "/merged/dists/" .. s .. k) end | 282 | if testing("https", host) then checkURL(host, "https://" .. ip .. path .. "/merged/dists/" .. s .. k) end |
279 | end | 283 | end |
280 | end | 284 | end |
281 | end | 285 | end |