From f8d60c001118e308b094b6f2a856d317a53eea3a Mon Sep 17 00:00:00 2001 From: Micheal Quinn Date: Thu, 1 Aug 2019 12:55:05 -0500 Subject: [PATCH] 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 --- src/install/default.txt | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/src/install/default.txt b/src/install/default.txt index bc66b6c..bf27488 100644 --- a/src/install/default.txt +++ b/src/install/default.txt @@ -97,7 +97,7 @@ install_croc() elif [[ $unameu == *LINUX* ]]; then croc_os="Linux" elif [[ $unameu == *FREEBSD* ]]; then - croc_os="freebsd" + croc_os="FreeBSD" elif [[ $unameu == *NETBSD* ]]; then croc_os="NetBSD" elif [[ $unameu == *OPENBSD* ]]; then @@ -144,17 +144,23 @@ install_croc() echo "Verifying checksum..." 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 - checksum="$(sha256sum ${dl}) $croc_file" + checksum="$(sha256sum ${dl})" 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_check}" echo "checksums are not valid, exiting" return 7 + else + echo "verified checksum" + echo "Downloaded: ${checksum}" + echo "Remote: ${checksum_check}" fi