diff --git a/rpm_tests/p_osinfo-db/01-msvsphere-present.sh b/rpm_tests/p_osinfo-db/01-msvsphere-present.sh index 08978d0..e815bc0 100755 --- a/rpm_tests/p_osinfo-db/01-msvsphere-present.sh +++ b/rpm_tests/p_osinfo-db/01-msvsphere-present.sh @@ -1,6 +1,8 @@ #!/bin/bash -x echo "Тест наличия MSVSphere ОС в БД osinfo" +echo "=====================================" +echo "" source ../../library/sh_lib.sh diff --git a/rpm_tests/p_osinfo-db/02-check-image.sh b/rpm_tests/p_osinfo-db/02-image-os_name.sh similarity index 90% rename from rpm_tests/p_osinfo-db/02-check-image.sh rename to rpm_tests/p_osinfo-db/02-image-os_name.sh index 06c3b8a..d4e1095 100755 --- a/rpm_tests/p_osinfo-db/02-check-image.sh +++ b/rpm_tests/p_osinfo-db/02-image-os_name.sh @@ -1,6 +1,8 @@ #!/bin/bash echo "Тест получения названия MSVSphere ОС из ISO образа" +echo "==================================================" +echo "" source ../../library/sh_lib.sh 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 888e6c7..2dd361a 100755 --- a/rpm_tests/p_osinfo-db/03-check-image-sha256.sh +++ b/rpm_tests/p_osinfo-db/03-check-image-sha256.sh @@ -1,6 +1,8 @@ #!/bin/bash -echo "Тест получения названия MSVSphere ОС из ISO образа" +echo "Тест проверки целостности ISO образов MSVSphere ОС" +echo "==================================================" +echo "" source ../../library/sh_lib.sh @@ -8,9 +10,32 @@ check=0 ISO_IMAGES_URLS_FILE='files/msvsphereiso_url.txt' while read LINE; do - CHECKSUM_URL="$LINE.CHECKSUM" + ISO_FILENAME=`basename $LINE` + ISO_URL_PATH="${LINE%/*}" + LOCAL_FILE="/home/pavel/MSVSphere-images/$ISO_FILENAME" + CHECKSUM_URL="$ISO_URL_PATH/$ISO_FILENAME.CHECKSUM" + echo "ISO URL: $LINE" + echo "Local file path: $LOCAL_FILE" + echo "Checksum File: $CHECKSUM_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}')" # curl -LJs -r 0-1048576 -o img.iso $LINE - echo "File: $LINE; Checksum: $CHECKSUM_URL" + # 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 }')" + + # Test and print results + echo "Calculated file SHA256 hash: $SHA256HASH" + echo "SHA256 hash from CHECKSUM file: $SHA256_HASH_FROM_FILE" + if [ "$SHA256HASH" == "$SHA256_HASH_FROM_FILE" ]; then + echo 'SHA256 hash OK' + else + echo 'ERROR: SHA256 hash mismatch!!!' + let check+=1 + fi + echo "--------------------------" done < $ISO_IMAGES_URLS_FILE check_test_status ${check} "$0" diff --git a/rpm_tests/p_osinfo-db/files/msvsphereiso_local.txt b/rpm_tests/p_osinfo-db/files/msvsphereiso_local.txt new file mode 100644 index 0000000..86ca90e --- /dev/null +++ b/rpm_tests/p_osinfo-db/files/msvsphereiso_local.txt @@ -0,0 +1,5 @@ +/home/pavel/MSVSphere-images/MSVSphere-9.3-x86_64-dvd.iso +/home/pavel/MSVSphere-images/MSVSphere-9.3-x86_64-netinstall.iso +/home/pavel/MSVSphere-images/MSVSphere-9.3-x86_64-minimal.iso +/home/pavel/MSVSphere-images/MSVSphere-9.3-x86_64-server.iso +/home/pavel/MSVSphere-images/MSVSphere-9.3-x86_64-arm.iso