summaryrefslogtreecommitdiff
path: root/scripts/functions
diff options
context:
space:
mode:
authorAlexey Neyman <stilor@att.net>2017-09-30 00:05:22 (GMT)
committerAlexey Neyman <stilor@att.net>2017-09-30 00:05:22 (GMT)
commitb3038a0a41079130351e6c5d9ec19587a9a08a03 (patch)
treeca487c04c55434886e9ef42b815057251cd947f9 /scripts/functions
parentea08141d4559a3c20f74f00aea7754f6a2329718 (diff)
Add digests for all packages
Also fix test-packages: it was saving the output from CT_DoLog into the checksum file. Also use one file per version. Signed-off-by: Alexey Neyman <stilor@att.net>
Diffstat (limited to 'scripts/functions')
-rw-r--r--scripts/functions28
1 files changed, 20 insertions, 8 deletions
diff --git a/scripts/functions b/scripts/functions
index 055fc74..c3ef29e 100644
--- a/scripts/functions
+++ b/scripts/functions
@@ -775,18 +775,29 @@ CT_DoVerifyDigest()
local dir="${path%/*}"
local pkgdir="$2"
local alg="${CT_VERIFY_DOWNLOAD_DIGEST_ALG}"
+ local chksum a f c
- if [ ! -r "${pkgdir}/${file}.${alg}" ]; then
+ if [ ! -r "${pkgdir}/chksum" ]; then
CT_DoLog WARN "Not verifying '${file}': digest missing"
- return
+ return 0
fi
CT_DoLog EXTRA "Verifying ${alg^^} checksum for '${file}'"
- CT_Pushd "${dir}"
- if ! CT_DoExecLog ALL "${alg}sum" -c "${pkgdir}/${file}.${alg}"; then
- CT_Popd
- return 1
- fi
- CT_Popd
+ chksum=`"${alg}sum" "${path}"`
+ chksum="${chksum%%[[:space:]]*}"
+ while read a f c; do
+ if [ "${a}" != "${alg}" -o "${f}" != "${file}" ]; then
+ continue
+ fi
+ if [ "${c}" = "${chksum}" ]; then
+ CT_DoLog DEBUG "Correct ${alg} digest for ${file}: ${chksum}"
+ return 0
+ else
+ CT_DoLog ERROR "Bad ${alg} digest for ${file}: ${chksum}, expect ${c}"
+ return 1
+ fi
+ done < "${pkgdir}/chksum"
+ CT_DoLog WARN "Downloaded file ${file} reference digest not available"
+ return 0
}
# Decompress a file to stdout
@@ -834,6 +845,7 @@ CT_DoVerifySignature()
local sigfile
local cat
+ CT_DoLog EXTRA "Verifying detached signature for '${file}'"
case "${method}" in
packed)
# Typical case: release is packed, then signed