diff options
author | onefang | 2019-12-27 13:53:34 +1000 |
---|---|---|
committer | onefang | 2019-12-27 13:53:34 +1000 |
commit | 471c3a965be14dcd786189fda87a64bb50c72461 (patch) | |
tree | 5c3c5a546cb3294f9b6be8613a51ea6f0b3848eb | |
parent | Add a linky to the graphs for each mirror. (diff) | |
download | apt-panopticon-471c3a965be14dcd786189fda87a64bb50c72461.zip apt-panopticon-471c3a965be14dcd786189fda87a64bb50c72461.tar.gz apt-panopticon-471c3a965be14dcd786189fda87a64bb50c72461.tar.bz2 apt-panopticon-471c3a965be14dcd786189fda87a64bb50c72461.tar.xz |
Optimise updater a tiny bit.
-rwxr-xr-x | apt-panopticon-update-data.lua | 26 |
1 files changed, 14 insertions, 12 deletions
diff --git a/apt-panopticon-update-data.lua b/apt-panopticon-update-data.lua index 82a6ba5..57eddd9 100755 --- a/apt-panopticon-update-data.lua +++ b/apt-panopticon-update-data.lua | |||
@@ -19,6 +19,7 @@ os.execute('touch ' .. lock) | |||
19 | if -1 < APT.verbosity then print('\nUpacking tarballs and cleaning them.') end | 19 | if -1 < APT.verbosity then print('\nUpacking tarballs and cleaning them.') end |
20 | local files = io.popen('ls -1 results_*.tar.xz') | 20 | local files = io.popen('ls -1 results_*.tar.xz') |
21 | for l in files:lines() do | 21 | for l in files:lines() do |
22 | local lsub = l:sub(1, -8) | ||
22 | if 0 == oldest then | 23 | if 0 == oldest then |
23 | local status, whn = APT.execute('TZ="GMT" ls -d1 --time-style="+%s" ' .. l .. ' | cut -d " " -f 6-6') | 24 | local status, whn = APT.execute('TZ="GMT" ls -d1 --time-style="+%s" ' .. l .. ' | cut -d " " -f 6-6') |
24 | whn = whn:sub(2, -2) | 25 | whn = whn:sub(2, -2) |
@@ -28,24 +29,25 @@ for l in files:lines() do | |||
28 | end | 29 | end |
29 | if -1 < APT.verbosity then io.stdout:write('\r' .. 'tar -xf ' .. l); io.stdout:flush() end | 30 | if -1 < APT.verbosity then io.stdout:write('\r' .. 'tar -xf ' .. l); io.stdout:flush() end |
30 | os.execute('tar -xf ' .. l) | 31 | os.execute('tar -xf ' .. l) |
31 | os.execute('rm -f ' .. l:sub(1, -8) .. '/*.curl') | 32 | os.execute('rm -f ' .. lsub .. '/*.curl') |
32 | os.execute('rm -f ' .. l:sub(1, -8) .. '/STATUS_*') | 33 | os.execute('rm -f ' .. lsub .. '/STATUS_*') |
33 | if APT.checkFile(l:sub(1, -8) .. '/mirrors.lua') then | 34 | |
34 | APT.mirrors = loadfile(l:sub(1, -8) .. "/mirrors.lua")() | 35 | if APT.checkFile(lsub .. '/mirrors.lua') then |
36 | APT.mirrors = loadfile(lsub .. "/mirrors.lua")() | ||
35 | for k, v in pairs(APT.mirrors) do | 37 | for k, v in pairs(APT.mirrors) do |
36 | if APT.options.referenceSite.value ~= k then | 38 | if APT.options.referenceSite.value ~= k then |
37 | if APT.checkFile(l:sub(1, -8) .. '/' .. k) then | 39 | if APT.checkFile(lsub .. '/' .. k) then |
38 | os.execute('rm -fr ' .. l:sub(1, -8) .. '/' .. k) | 40 | os.execute('rm -fr ' .. lsub .. '/' .. k) |
39 | end | 41 | end |
40 | else | 42 | else |
41 | for i, n in pairs(APT.releases) do | 43 | for i, n in pairs(APT.releases) do |
42 | os.execute( 'rm -f ' .. l:sub(1, -8) .. '/' .. k .. '/merged/dists/' .. n .. '/Release;' .. | 44 | os.execute( 'rm -f ' .. lsub .. '/' .. k .. '/merged/dists/' .. n .. '/Release;' .. |
43 | 'rm -f ' .. l:sub(1, -8) .. '/' .. k .. '/merged/dists/' .. n .. '/Release.gpg;' .. | 45 | 'rm -f ' .. lsub .. '/' .. k .. '/merged/dists/' .. n .. '/Release.gpg;' .. |
44 | 'rm -fr ' .. l:sub(1, -8) .. '/' .. k .. '/merged/dists/' .. n .. '/contrib 2>/dev/null;' .. | 46 | 'rm -fr ' .. lsub .. '/' .. k .. '/merged/dists/' .. n .. '/contrib 2>/dev/null;' .. |
45 | 'rm -fr ' .. l:sub(1, -8) .. '/' .. k .. '/merged/dists/' .. n .. '/main 2>/dev/null;' .. | 47 | 'rm -fr ' .. lsub .. '/' .. k .. '/merged/dists/' .. n .. '/main 2>/dev/null;' .. |
46 | 'rm -fr ' .. l:sub(1, -8) .. '/' .. k .. '/merged/dists/' .. n .. '/non-free 2>/dev/null') | 48 | 'rm -fr ' .. lsub .. '/' .. k .. '/merged/dists/' .. n .. '/non-free 2>/dev/null') |
47 | end | 49 | end |
48 | os.execute('rm -fr ' .. l:sub(1, -8) .. '/' .. k .. '/merged/pool') | 50 | os.execute('rm -fr ' .. lsub .. '/' .. k .. '/merged/pool') |
49 | end | 51 | end |
50 | local results = {} | 52 | local results = {} |
51 | local f = l:sub(1, -8) .. "/" .. k .. ".lua" | 53 | local f = l:sub(1, -8) .. "/" .. k .. ".lua" |