pull/86/head
Markson Hon 2023-02-05 16:37:07 +08:00 committed by yuhan6665
parent 00974924bf
commit cfddeb5115
1 changed files with 6 additions and 8 deletions

View File

@ -87,14 +87,12 @@ download_xray() {
}
verification_xray() {
for LISTSUM in 'md5' 'sha1' 'sha256' 'sha512'; do
SUM="$(${LISTSUM}sum $ZIP_FILE | sed 's/ .*//')"
CHECKSUM="$(grep $(echo $LISTSUM | tr [:lower:] [:upper:]) $ZIP_FILE.dgst | uniq | sed 's/.* //')"
if [ "$SUM" != "$CHECKSUM" ]; then
echo 'error: Check failed! Please check your network or try again.'
exit 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() {