From 32bbd6caf700eaa50d2e8b1c6514cd26a71cdb54 Mon Sep 17 00:00:00 2001 From: Tobias Ulmer Date: Wed, 7 Sep 2016 15:40:33 +0200 Subject: [PATCH] e2tool: restore fileid() behaviour and only verify when check-remote is true Signed-off-by: Tobias Ulmer --- local/e2tool.lua | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/local/e2tool.lua b/local/e2tool.lua index eef56b2..da75f13 100644 --- a/local/e2tool.lua +++ b/local/e2tool.lua @@ -943,7 +943,7 @@ function e2tool.fileid(info, file) assertIsStringN(file.server) assertIsStringN(file.location) - local rc, re, e, fileid, filever + local rc, re, e, fileid e = err.new("error calculating file id for file: %s:%s", file.server, file.location) @@ -957,10 +957,16 @@ function e2tool.fileid(info, file) end end - filever = { server = file.server, location = file.location, sha1 = fileid } - rc, re = e2tool.verify_hash(info, filever) - if not rc then - return false, e:cat(re) + if e2option.opts["check-remote"] then + local filever = { + server = file.server, + location = file.location, + sha1 = fileid + } + rc, re = e2tool.verify_hash(info, filever) + if not rc then + return false, e:cat(re) + end end return fileid -- 2.39.5