File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -49,7 +49,7 @@ sudo curl -sSL "https://github.com/ankddev/envfetch/releases/latest/download/env
4949# Check integrity
5050
5151EXPECTED_CHECKSUM=$( curl -sSL " https://github.com/ankddev/envfetch/releases/latest/download/envfetch-$BUILD_TARGET .sha256" | tr -d ' [:space:]' | tr -d ' \n' )
52- ACTUAL_CHECKSUM=$( sha256sum " $INSTALL_DIR /envfetch" | awk ' {print $1}' )
52+ ACTUAL_CHECKSUM=$( calculate_checksum " $INSTALL_DIR /envfetch" | awk ' {print $1}' )
5353
5454if [ " $EXPECTED_CHECKSUM " != " $ACTUAL_CHECKSUM " ]; then
5555 echo " Checksum mismatch" >&2
6363sudo chmod +x " $INSTALL_DIR /envfetch"
6464
6565echo " Successfully installed envfetch"
66+
67+ # Calculate checksum. We use this function because Linux and macOS have different commands
68+ calculate_checksum () {
69+ if [ " $OS_NAME " = " Darwin" ]; then
70+ # macOS
71+ shasum -a 256 " $1 " | cut -d ' ' -f 1
72+ else
73+ # Linux and others
74+ sha256sum " $1 " | cut -d ' ' -f 1
75+ fi
76+ }
You can’t perform that action at this time.
0 commit comments