From f3d074986c8a0c5eb9a8e5ae769e247f871b8251 Mon Sep 17 00:00:00 2001 From: onefang Date: Thu, 5 Dec 2019 04:09:08 +1000 Subject: Various little cleanups. --- apt-panopticon.lua | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/apt-panopticon.lua b/apt-panopticon.lua index cf95a8e..2a65d0b 100755 --- a/apt-panopticon.lua +++ b/apt-panopticon.lua @@ -973,7 +973,8 @@ if 0 < #arg then end end - if checkFile('results/' .. pu.host .. '/merged/dists/' .. n .. '/Release') then + if checkFile('results/' .. pu.host .. '/merged/dists/' .. n .. '/Release') and + checkFile('results_old/pkgmaster.devuan.org/merged/dists/' .. n .. '/Release.SORTED') then os.execute('sort -k 3 results/' .. pu.host .. '/merged/dists/' .. n .. '/Release >results/' .. pu.host .. '/merged/dists/' .. n .. '/Release.SORTED') if options.referenceSite.value == pu.host then os.execute('diff -U 0 results_old/pkgmaster.devuan.org/merged/dists/' .. n .. '/Release.SORTED ' .. @@ -1103,13 +1104,13 @@ else local fadt = io.popen("ls -dl results_old 2>/dev/null | cut -d '>' -f 2 | cut -d ' ' -f 2") local adt = fadt:read('*l') fadt:close() - if 0 ~= #adt then os.execute('tar -c --xz ' .. adt .. ' -f ' .. adt .. '.tar.xz') end + if nil ~= adt then os.execute('tar -c --xz ' .. adt .. ' -f ' .. adt .. '.tar.xz') end local dt = os.date('!%Y-%m-%d-%H-%M') - local fodt = io.popen('TZ="GMT" date -r results/stamp +%Y-%m-%d-%H-%M', 'r') + local fodt = io.popen('TZ="GMT" date -r results/stamp +%Y-%m-%d-%H-%M 2>/dev/null', 'r') local odt = fodt:read('*l') fodt:close() - os.execute(' rm -f results_old; ln -s results_' .. odt .. ' results_old 2>/dev/null') - os.execute('mkdir -p results_' .. dt .. '; rm -f results; ln -s results_' .. dt .. ' results 2>/dev/null') + if nil ~= odt then os.execute(' rm -f results_old; ln -s results_' .. odt .. ' results_old 2>/dev/null') end + if nil ~= dt then os.execute('mkdir -p results_' .. dt .. '; rm -f results; ln -s results_' .. dt .. ' results 2>/dev/null') end os.execute('if [ -f results/stamp ]; then mv results/stamp results/stamp.old; else touch results/stamp.old -t 199901010000; fi; touch results/stamp') os.execute("rm -f results/*.check 2>/dev/null") if not keep then @@ -1162,7 +1163,7 @@ else end end - if 0 ~= #adt then os.execute('rm -fr ' .. adt .. ' 2>/dev/null') end + if nil ~= adt then os.execute('rm -fr ' .. adt .. ' 2>/dev/null') end logPost() logFile:close() -- cgit v1.1