From 98dcc0be5f0df60ba4c4e6c25c495ee3d83374b2 Mon Sep 17 00:00:00 2001 From: onefang Date: Sat, 28 Dec 2019 22:49:01 +1000 Subject: Add bandwidth argument and it's aliases, to choose how hard to hit the 'net. --- apt-panopticommon.lua | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) (limited to 'apt-panopticommon.lua') diff --git a/apt-panopticommon.lua b/apt-panopticommon.lua index d9293f6..b1f39d7 100644 --- a/apt-panopticommon.lua +++ b/apt-panopticommon.lua @@ -26,6 +26,19 @@ APT.keep = false APT.options = { + bandwidth = + { + typ = "number", + help = ' 0 = low - HTTP tests for all IPs of all mirrors (HEAD tests), but not URL sanity tests.\n' .. + ' 1 = medium - Also HTTP(S) redirect tests, other protocols, download Release files over HTTP, and check them.\n' .. + ' 2 = high - Also download Packages.xz files that changed, unpack and check them.\n' .. + ' Also download and check InRelease files\n.' .. + ' Pick a few small packages, download them, check their SHA512.\n' .. + ' 3 = more - Also pick more packages, some for each arch.\n' .. + ' 4 = all - Do absolutely everything.\n' .. + ' Actually download some Contents files, and some more Packages.xz, and package files.', + value = 2, + }, referenceSite = { typ = "string", @@ -127,6 +140,24 @@ APT.parseArgs = function(args) elseif "-r" == a then APT.redir = true sendArgs = sendArgs .. a .. " " + elseif "--low" == a then + APT.options.bandwidth.value = 0 + APT.options.timeout.value = 2 + APT.options.timeouts.value = 1 + APT.options.retries.value = 1 + sendArgs = sendArgs .. a .. " " + elseif "--medium" == a then + APT.options.bandwidth.value = 1 + sendArgs = sendArgs .. a .. " " + elseif "--high" == a then + APT.options.bandwidth.value = 2 + sendArgs = sendArgs .. a .. " " + elseif "--more" == a then + APT.options.bandwidth.value = 3 + sendArgs = sendArgs .. a .. " " + elseif "--all" == a then + APT.options.bandwidth.value = 4 + sendArgs = sendArgs .. a .. " " elseif "--" == a:sub(1, 2) then local s, e = a:find("=") if nil == s then e = -1 end -- cgit v1.1