File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -25,7 +25,7 @@ if [ "$OS_NAME" = "Linux" ]; then
2525 fi
2626elif [ " $OS_NAME " = " Darwin" ]; then
2727 OS=" macOS"
28-
28+
2929 if [ " $ARCH_NAME " = " x86_64" ]; then
3030 BUILD_TARGET=" darwin-amd64"
3131 elif [ " $ARCH_NAME " = " arm" ] || [ " $ARCH_NAME " = " arm64" ]; then
4545
4646# Download file directly to install directory
4747sudo curl -sSL " https://github.com/ankddev/envfetch/releases/latest/download/envfetch-$BUILD_TARGET " --output " $INSTALL_DIR /envfetch"
48+
49+ # Check integrity
50+
51+ EXPECTED_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}' )
53+
54+ if [ " $EXPECTED_CHECKSUM " != " $ACTUAL_CHECKSUM " ]; then
55+ echo " Checksum mismatch" >&2
56+ echo " Expected: $EXPECTED_CHECKSUM "
57+ echo " Actual: $ACTUAL_CHECKSUM "
58+ echo " Please try again later or report this issue to the developer."
59+ exit 1
60+ fi
61+
4862# Give permissions for executable
4963sudo chmod +x " $INSTALL_DIR /envfetch"
5064
You can’t perform that action at this time.
0 commit comments