From ce2bce1580f03cc16e1a122f35e33263b475bba4 Mon Sep 17 00:00:00 2001 From: Simon Let Date: Mon, 16 Dec 2019 03:33:10 +0100 Subject: [PATCH] macOS fix, improvements --- scripts/install.sh | 18 ++---------------- scripts/rawinstall.sh | 6 ++++++ 2 files changed, 8 insertions(+), 16 deletions(-) diff --git a/scripts/install.sh b/scripts/install.sh index f8757bb..e041d88 100755 --- a/scripts/install.sh +++ b/scripts/install.sh @@ -2,21 +2,6 @@ set -euo pipefail -die() { - if [ $# -eq 1 ]; then - echo "$1" - elif [ $# -eq 0 ]; then - echo "ERROR: SomEtHiNg WeNt wRonG - ExItiNg!" - echo "THIS IS NOT SUPPOSED TO HAPPEN!" - fi - echo - echo "Please report any issues you encounter to: https://github.com/curusarn/resh/issues" - echo - echo "You can rerun this installation by executing: (you will skip downloading the files)" - echo "cd $PWD && scripts/install.sh" - exit 1 -} - echo echo "Checking your system ..." @@ -24,7 +9,8 @@ echo "Checking your system ..." login_shell=$(echo "$SHELL" | rev | cut -d'/' -f1 | rev) if [ "$login_shell" != bash ] && [ "$login_shell" != zsh ]; then - die "ERROR: Unsupported/unknown login shell: $login_shell" + echo "ERROR: Unsupported/unknown login shell: $login_shell" + exit 1 fi echo " * Login shell: $login_shell - OK" diff --git a/scripts/rawinstall.sh b/scripts/rawinstall.sh index da793e8..fef932a 100755 --- a/scripts/rawinstall.sh +++ b/scripts/rawinstall.sh @@ -80,6 +80,12 @@ curl $curl_opt "$dl_binaries" echo echo "Checking integrity ..." + +# macOS doesn't have sha256sum +if [ "$OS" = darwin ]; then + function sha256sum() { shasum -a 256 "$@" ; } && export -f sha256sum +fi + if [ "$(sha256sum "$fname_binaries")" != "$(grep "$fname_binaries" "$fname_checksums")" ]; then echo "ERROR: integrity check failed - exiting!" exit 1