From bbff2135f0386d68b8223ce755d6bd9c2feafa57 Mon Sep 17 00:00:00 2001 From: Tobias Ulmer Date: Wed, 20 Nov 2013 16:50:52 +0100 Subject: [PATCH] Remove e2lib.sha1sum() in favor of the hash module Signed-off-by: Tobias Ulmer --- generic/e2lib.lua | 42 ------------------------------------------ 1 file changed, 42 deletions(-) diff --git a/generic/e2lib.lua b/generic/e2lib.lua index ac46c27..ca6d165 100644 --- a/generic/e2lib.lua +++ b/generic/e2lib.lua @@ -2185,48 +2185,6 @@ function e2lib.isfile(path) return false end ---- Calculate SHA1 sum of a file. --- @param path string: path --- @return SHA1 sum of file or false on error. --- @return Error object on failure. -function e2lib.sha1sum(path) - local rc, re, e, sha1sum, sha1sum_flags, cmd, p, msg, out, sha1, file - - assert(type(path) == "string") - - e = err.new("calculating SHA1 checksum failed") - - sha1sum, re = tools.get_tool("sha1sum") - if not sha1sum then - return false , e:cat(re) - end - - sha1sum_flags, re = tools.get_tool_flags("sha1sum") - if not sha1sum_flags then - return false, e:cat(re) - end - - sha1sum_flags = table.concat(sha1sum_flags, " ") - - cmd = string.format("%s %s %s", e2lib.shquote(sha1sum), sha1sum_flags, - e2lib.shquote(path)) - - p, msg = io.popen(cmd, "r") - if not p then - return false, e:cat(msg) - end - - out, msg = p:read("*l") - p:close() - - sha1, file = out:match("(%S+) (%S+)") - if type(sha1) ~= "string" then - return false, e:cat("parsing sha1sum output failed") - end - - return sha1 -end - --- call the e2-su-2.2 command -- @param argv table: argument vector -- @return bool -- 2.39.5