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