From a20a7b1ef3b6f26aac7a7bc0782bd5756aeaf191 Mon Sep 17 00:00:00 2001 From: Pavel Negrobov Date: Mon, 18 Dec 2023 12:39:51 +0300 Subject: [PATCH] =?UTF-8?q?INF-834:=20=D0=A1=D0=BE=D0=B7=D0=B4=D0=B0=D1=82?= =?UTF-8?q?=D1=8C=20=D1=82=D0=B5=D1=81=D1=82=20=D0=B4=D0=BB=D1=8F=20=D0=BF?= =?UTF-8?q?=D1=80=D0=BE=D0=B2=D0=B5=D1=80=D0=BA=D0=B8=20=D0=B1=D0=B8=D0=BB?= =?UTF-8?q?=D0=B4=D0=B0=20osinfo-db?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- rpm_tests/p_osinfo-db/03-check-image-sha256.sh | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/rpm_tests/p_osinfo-db/03-check-image-sha256.sh b/rpm_tests/p_osinfo-db/03-check-image-sha256.sh index 2dd361a..0ac386f 100755 --- a/rpm_tests/p_osinfo-db/03-check-image-sha256.sh +++ b/rpm_tests/p_osinfo-db/03-check-image-sha256.sh @@ -13,23 +13,22 @@ while read LINE; do ISO_FILENAME=`basename $LINE` ISO_URL_PATH="${LINE%/*}" LOCAL_FILE="/home/pavel/MSVSphere-images/$ISO_FILENAME" - CHECKSUM_URL="$ISO_URL_PATH/$ISO_FILENAME.CHECKSUM" + CHECKSUM_FILE_URL="$ISO_URL_PATH/$ISO_FILENAME.CHECKSUM" echo "ISO URL: $LINE" echo "Local file path: $LOCAL_FILE" - echo "Checksum File: $CHECKSUM_URL" + echo "Checksum File: $CHECKSUM_FILE_URL" # Get SHA256 hash value: # curl -s https://rsync.inferitos.ru/msvsphere/9.3/isos/x86_64/MSVSphere-9.3-x86_64-arm.iso.CHECKSUM | /bin/grep SHA256 | /bin/grep -v Hash: | /bin/awk -F '=' '{gsub(/ /, "", $2); print $2}' - SHA256_HASH_FROM_FILE="$(curl -s https://rsync.inferitos.ru/msvsphere/9.3/isos/x86_64/MSVSphere-9.3-x86_64-arm.iso.CHECKSUM | /bin/grep SHA256 | /bin/grep -v Hash: | /bin/awk -F '=' '{gsub(/ /, "", $2); print $2}')" + SHA256_HASH_FROM_FILE="$(curl -s $CHECKSUM_FILE_URL | /bin/grep SHA256 | /bin/grep -v Hash: | /bin/awk -F '=' '{gsub(/ /, "", $2); print $2}')" # curl -LJs -r 0-1048576 -o img.iso $LINE # sha256sum /home/pavel/MSVSphere-images/MSVSphere-9.3-x86_64-arm.iso | /bin/awk -F ' ' '{ print $1 }' - SHA256_OUTPUT="$(sha256sum $LOCAL_FILE)" - SHA256HASH="$(echo "$SHA256_OUTPUT" | /bin/awk -F ' ' '{ print $1 }')" + SHA256_HASH_CALCULATED="$(sha256sum $LOCAL_FILE | /bin/awk -F ' ' '{ print $1 }')" # Test and print results - echo "Calculated file SHA256 hash: $SHA256HASH" + echo "Calculated file SHA256 hash: $SHA256_HASH_CALCULATED" echo "SHA256 hash from CHECKSUM file: $SHA256_HASH_FROM_FILE" - if [ "$SHA256HASH" == "$SHA256_HASH_FROM_FILE" ]; then + if [ "$SHA256_HASH_CALCULATED" == "$SHA256_HASH_FROM_FILE" ]; then echo 'SHA256 hash OK' else echo 'ERROR: SHA256 hash mismatch!!!'