0
0
Fork 0
mirror of https://github.com/schollz/croc.git synced 2025-10-11 21:30:16 +02:00

Adding in some fixes for FreeBSD (tested in a FreeNAS jail 'FreeBSD 11.2-STABLE') as well as a fix for the checksum logic not correctly comparing the checksums. This still needs testing on a MacOS host

This commit is contained in:
Micheal Quinn 2019-08-01 12:55:05 -05:00
parent e1e722fc5b
commit f8d60c0011
No known key found for this signature in database
GPG key ID: 0E7217F3C30BA059

View file

@ -97,7 +97,7 @@ install_croc()
elif [[ $unameu == *LINUX* ]]; then elif [[ $unameu == *LINUX* ]]; then
croc_os="Linux" croc_os="Linux"
elif [[ $unameu == *FREEBSD* ]]; then elif [[ $unameu == *FREEBSD* ]]; then
croc_os="freebsd" croc_os="FreeBSD"
elif [[ $unameu == *NETBSD* ]]; then elif [[ $unameu == *NETBSD* ]]; then
croc_os="NetBSD" croc_os="NetBSD"
elif [[ $unameu == *OPENBSD* ]]; then elif [[ $unameu == *OPENBSD* ]]; then
@ -144,17 +144,23 @@ install_croc()
echo "Verifying checksum..." echo "Verifying checksum..."
if [[ $unameu == *DARWIN* ]]; then if [[ $unameu == *DARWIN* ]]; then
checksum="$(shasum -a 256 ${dl}) $croc_file" checksum="$(shasum -a 256 ${dl}) $croc_file)"
elif [[ $unameu == "FREEBSD" ]]; then
checksum="$(sha256 -q ${dl}) $croc_file"
else else
checksum="$(sha256sum ${dl}) $croc_file" checksum="$(sha256sum ${dl})"
fi fi
checksum_check="$(cat ${dl_checksum} | grep $croc_file) $croc_file" checksum_check="$(cat ${dl_checksum} | grep "${checksum}")"
if [[ "$s1" != "$s2" ]]; then if [[ "${checksum}" != "${checksum_check}" ]]; then
echo "${checksum}" echo "${checksum}"
echo "${checksum_check}" echo "${checksum_check}"
echo "checksums are not valid, exiting" echo "checksums are not valid, exiting"
return 7 return 7
else
echo "verified checksum"
echo "Downloaded: ${checksum}"
echo "Remote: ${checksum_check}"
fi fi