Explorar o código

Fix hash check

Markson Hon %!s(int64=3) %!d(string=hai) anos
pai
achega
046d9aa243
Modificáronse 1 ficheiros con 6 adicións e 8 borrados
  1. 6 8
      install-release.sh

+ 6 - 8
install-release.sh

@@ -429,14 +429,12 @@ download_xray() {
   fi
   fi
 
 
   # Verification of Xray archive
   # Verification of Xray archive
-  for LISTSUM in 'md5' 'sha1' 'sha256' 'sha512'; do
-    SUM="$(${LISTSUM}sum "$ZIP_FILE" | sed 's/ .*//')"
-    CHECKSUM="$(grep ${LISTSUM^^} "$ZIP_FILE".dgst | grep "$SUM" -o -a | uniq)"
-    if [[ "$SUM" != "$CHECKSUM" ]]; then
-      echo 'error: Check failed! Please check your network or try again.'
-      return 1
-    fi
-  done
+  CHECKSUM=$(cat "$ZIP_FILE".dgst | awk -F '= ' '/256=/ {print $2}')
+  LOCALSUM=$(sha256sum "$ZIP_FILE" | awk '{printf $1}')
+  if [[ "$CHECKSUM" != "$LOCALSUM" ]]; then
+    echo 'error: SHA256 check failed! Please check your network or try again.'
+    return 1
+  fi
 }
 }
 
 
 decompression() {
 decompression() {