From a72172d11e0ab607e6d9783e05e4624e11050784 Mon Sep 17 00:00:00 2001 From: Micheal Quinn Date: Tue, 13 Aug 2019 22:28:26 -0500 Subject: [PATCH] Adding update to checksum check function to always filter the checksum file based on downloaded file. Adding CYGWIN croc_os switch for windows support (needs more testing) --- src/install/rewrite.txt | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/install/rewrite.txt b/src/install/rewrite.txt index 34167fc..da218d0 100644 --- a/src/install/rewrite.txt +++ b/src/install/rewrite.txt @@ -240,7 +240,10 @@ checksum_check() { cd "${dir}" || return 3 if command -v sha256sum >/dev/null 2>&1; then - sha256sum -c "${checksum_file}" --ignore-missing >/dev/null 2>&1 + ## Not all sha256sum versions seem to have --ignore-missing, so filter the checksum file + ## to only include the file we downloaded. + grep "$(basename "${file}")" "${checksum_file}" > filtered_checksum.txt + sha256sum -c "filtered_checksum.txt" >/dev/null 2>&1 rcode="${?}" elif command -v shasum >/dev/null 2>&1; then ## With shasum on FreeBSD, we don't get to --ignore-missing, so filter the checksum file @@ -459,6 +462,7 @@ main() { case "${croc_os}" in "Darwin" ) croc_os="macOS";; + "CYGWIN"* ) croc_os="Windows";; esac case "${croc_arch}" in