diff options
| author | onefang | 2019-12-05 23:53:15 +1000 |
|---|---|---|
| committer | onefang | 2019-12-05 23:53:15 +1000 |
| commit | 7ec0b463aa6aac8b8576433806181eba74983372 (patch) | |
| tree | 5c8d1f1b3aed5f3d2f4c9990d1f9a47cedc8c19e | |
| parent | Various little cleanups. (diff) | |
| download | apt-panopticon-7ec0b463aa6aac8b8576433806181eba74983372.zip apt-panopticon-7ec0b463aa6aac8b8576433806181eba74983372.tar.gz apt-panopticon-7ec0b463aa6aac8b8576433806181eba74983372.tar.bz2 apt-panopticon-7ec0b463aa6aac8b8576433806181eba74983372.tar.xz | |
Tweakage of how Packages are checked.
Diffstat (limited to '')
| -rwxr-xr-x | apt-panopticon.lua | 32 |
1 files changed, 18 insertions, 14 deletions
diff --git a/apt-panopticon.lua b/apt-panopticon.lua index 2a65d0b..de6f271 100755 --- a/apt-panopticon.lua +++ b/apt-panopticon.lua | |||
| @@ -1036,23 +1036,27 @@ if 0 < #arg then | |||
| 1036 | for l in nfile:lines() do | 1036 | for l in nfile:lines() do |
| 1037 | local v, p, sz, m, sha = l:match(' | (.+) | (pool/.+%.deb) | (%d.+) | (%x.+) | (%x.+) |') | 1037 | local v, p, sz, m, sha = l:match(' | (.+) | (pool/.+%.deb) | (%d.+) | (%x.+) | (%x.+) |') |
| 1038 | if nil ~= p then | 1038 | if nil ~= p then |
| 1039 | local status, fsz = execute('ls -l results/' .. pu.host .. "/merged/" .. p .. ' | cut -d " " -f 5-5') | 1039 | if checkFile('results/' .. pu.host .. "/merged/" .. p) then |
| 1040 | if testing("Integrity") then | 1040 | local status, fsz = execute('ls -l results/' .. pu.host .. "/merged/" .. p .. ' | cut -d " " -f 5-5') |
| 1041 | if sz ~= fsz:sub(2, -2) then -- The sub bit is to slice off the EOLs at each end. | 1041 | if testing("Integrity") then |
| 1042 | E('Package size mismatch - results/' .. pu.host .. "/merged/" .. p, 'http', 'Integrity', pu.host) | 1042 | if sz ~= fsz:sub(2, -2) then -- The sub bit is to slice off the EOLs at each end. |
| 1043 | print('|' .. sz .. '~=' .. fsz:sub(2, -2) .. '|') | 1043 | E('Package size mismatch - results/' .. pu.host .. "/merged/" .. p, 'http', 'Integrity', pu.host) |
| 1044 | else | 1044 | print('|' .. sz .. '~=' .. fsz:sub(2, -2) .. '|') |
| 1045 | local status, fm = execute('md5sum results/' .. pu.host .. "/merged/" .. p .. ' | cut -d " " -f 1') | 1045 | else |
| 1046 | if m ~= fm:sub(2, -2) then E('Package MD5 sum mismatch - results/' .. pu.host .. "/merged/" .. p, 'http', 'Integrity', pu.host) end | 1046 | local status, fm = execute('md5sum results/' .. pu.host .. "/merged/" .. p .. ' | cut -d " " -f 1') |
| 1047 | local status, fsha = execute('sha256sum results/' .. pu.host .. "/merged/" .. p .. ' | cut -d " " -f 1') | 1047 | if m ~= fm:sub(2, -2) then E('Package MD5 sum mismatch - results/' .. pu.host .. "/merged/" .. p, 'http', 'Integrity', pu.host) end |
| 1048 | if sha ~= fsha:sub(2, -2) then E('Package SHA256 sum mismatch - results/' .. pu.host .. "/merged/" .. p, 'http', 'Integrity', pu.host) end | 1048 | local status, fsha = execute('sha256sum results/' .. pu.host .. "/merged/" .. p .. ' | cut -d " " -f 1') |
| 1049 | if sha ~= fsha:sub(2, -2) then E('Package SHA256 sum mismatch - results/' .. pu.host .. "/merged/" .. p, 'http', 'Integrity', pu.host) end | ||
| 1049 | -- TODO - maybe check the PGP key, though packages are mostly not signed. | 1050 | -- TODO - maybe check the PGP key, though packages are mostly not signed. |
| 1051 | end | ||
| 1050 | end | 1052 | end |
| 1051 | end | 1053 | if testing("Updated") then |
| 1052 | if testing("Updated") then | 1054 | if sz ~= fsz:sub(2, -2) then |
| 1053 | if sz ~= fsz:sub(2, -2) then | 1055 | E('Package size mismatch - results/' .. pu.host .. "/merged/" .. p, 'http', 'Updated', pu.host) |
| 1054 | E('Package size mismatch - results/' .. pu.host .. "/merged/" .. p, 'http', 'Updated', pu.host) | 1056 | end |
| 1055 | end | 1057 | end |
| 1058 | else | ||
| 1059 | E('Failed to download - results/' .. pu.host .. "/merged/" .. p, 'http', 'Updated', pu.host) | ||
| 1056 | end | 1060 | end |
| 1057 | end | 1061 | end |
| 1058 | end | 1062 | end |
