mirror of https://github.com/schollz/croc.git
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)
This commit is contained in:
parent
081e267a19
commit
a72172d11e
|
@ -240,7 +240,10 @@ checksum_check() {
|
||||||
|
|
||||||
cd "${dir}" || return 3
|
cd "${dir}" || return 3
|
||||||
if command -v sha256sum >/dev/null 2>&1; then
|
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="${?}"
|
rcode="${?}"
|
||||||
elif command -v shasum >/dev/null 2>&1; then
|
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
|
## 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
|
case "${croc_os}" in
|
||||||
"Darwin" ) croc_os="macOS";;
|
"Darwin" ) croc_os="macOS";;
|
||||||
|
"CYGWIN"* ) croc_os="Windows";;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
case "${croc_arch}" in
|
case "${croc_arch}" in
|
||||||
|
|
Loading…
Reference in New Issue