diff options
| author | onefang | 2019-12-28 22:47:24 +1000 |
|---|---|---|
| committer | onefang | 2019-12-28 22:47:24 +1000 |
| commit | 3468d711b6ca49f476d87bf2acf9ca5e8fbd2728 (patch) | |
| tree | 7cad00d45d9ef2ab1563980e20708a85514aa737 | |
| parent | The answer to life, the universe, and input validation. (diff) | |
| download | apt-panopticon-3468d711b6ca49f476d87bf2acf9ca5e8fbd2728.zip apt-panopticon-3468d711b6ca49f476d87bf2acf9ca5e8fbd2728.tar.gz apt-panopticon-3468d711b6ca49f476d87bf2acf9ca5e8fbd2728.tar.bz2 apt-panopticon-3468d711b6ca49f476d87bf2acf9ca5e8fbd2728.tar.xz | |
Better first time calculation in the update script.
Diffstat (limited to '')
| -rwxr-xr-x | apt-panopticon-update-data.lua | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/apt-panopticon-update-data.lua b/apt-panopticon-update-data.lua index 8ab9254..105a1c7 100755 --- a/apt-panopticon-update-data.lua +++ b/apt-panopticon-update-data.lua | |||
| @@ -9,7 +9,7 @@ local E = APT.E | |||
| 9 | local C = APT.C | 9 | local C = APT.C |
| 10 | local arg, sendArgs = APT.parseArgs({...}) | 10 | local arg, sendArgs = APT.parseArgs({...}) |
| 11 | 11 | ||
| 12 | local oldest = 0 | 12 | local oldest = os.date('!%s') - (60 * 60) |
| 13 | 13 | ||
| 14 | local fixResults = function(f) | 14 | local fixResults = function(f) |
| 15 | if APT.checkFile(f) then | 15 | if APT.checkFile(f) then |
| @@ -46,16 +46,13 @@ os.execute('touch ' .. lock) | |||
| 46 | 46 | ||
| 47 | 47 | ||
| 48 | if -1 < APT.verbosity then print('\nUpacking tarballs and cleaning them.') end | 48 | if -1 < APT.verbosity then print('\nUpacking tarballs and cleaning them.') end |
| 49 | local files = io.popen('ls -1 results_*.tar.xz 2>/dev/null; ls -1 results_*/results_*.tar.xz 2>/dev/null') | 49 | local files = io.popen('ls -1 results_*/results_*.tar.xz 2>/dev/null; ls -1 results_*.tar.xz 2>/dev/null') |
| 50 | for l in files:lines() do | 50 | for l in files:lines() do |
| 51 | local lsub = l:sub(1, -8) | 51 | local lsub = l:sub(1, -8) |
| 52 | if 0 == oldest then | 52 | |
| 53 | local status, whn = APT.execute('TZ="GMT" ls -d1 --time-style="+%s" ' .. l .. ' | cut -d " " -f 6-6') | 53 | local dt = os.date('!%s', os.time{year = l:sub(-23, -20), month = l:sub(-18, -17), day = l:sub(-15, -14), hour = l:sub(-12, -11), minute = l:sub(-9, -8)}) - (60 * 60) |
| 54 | whn = whn:sub(2, -2) | 54 | if dt < oldest then oldest = dt; print('\nOldest time is ' .. oldest) end |
| 55 | local status, new = APT.execute('TZ="GMT" date -d "' .. whn:sub(9, 18) .. ' ' .. whn:sub(20, 21) .. ':' .. whn:sub(23, 24) .. '" "+%s"') | 55 | |
| 56 | oldest = tonumber("0" .. new:sub(2, -2)) - (60 * 60) | ||
| 57 | if -1 < APT.verbosity then print('\nOldest time is ' .. oldest) end | ||
| 58 | end | ||
| 59 | if -1 < APT.verbosity then io.stdout:write('\r' .. 'tar -xf ' .. l); io.stdout:flush() end | 56 | if -1 < APT.verbosity then io.stdout:write('\r' .. 'tar -xf ' .. l); io.stdout:flush() end |
| 60 | os.execute('tar -xf ' .. l) | 57 | os.execute('tar -xf ' .. l) |
| 61 | 58 | ||
| @@ -79,6 +76,7 @@ for l in files:lines() do | |||
| 79 | end | 76 | end |
| 80 | os.execute('rm -fr ' .. lsub .. '/' .. k .. '/merged/pool') | 77 | os.execute('rm -fr ' .. lsub .. '/' .. k .. '/merged/pool') |
| 81 | end | 78 | end |
| 79 | |||
| 82 | local results = {} | 80 | local results = {} |
| 83 | local f = l:sub(1, -8) .. "/" .. k .. ".lua" | 81 | local f = l:sub(1, -8) .. "/" .. k .. ".lua" |
| 84 | if APT.checkFile(f) then | 82 | if APT.checkFile(f) then |
| @@ -90,8 +88,10 @@ for l in files:lines() do | |||
| 90 | rfile:close() | 88 | rfile:close() |
| 91 | end | 89 | end |
| 92 | end | 90 | end |
| 91 | |||
| 93 | end | 92 | end |
| 94 | end | 93 | end |
| 94 | |||
| 95 | local fls = io.popen('ls -1 ' .. lsub .. '/*.lua 2>/dev/null') | 95 | local fls = io.popen('ls -1 ' .. lsub .. '/*.lua 2>/dev/null') |
| 96 | for k in fls:lines() do | 96 | for k in fls:lines() do |
| 97 | fixResults(k) | 97 | fixResults(k) |
