45 lines
1.1 KiB
Bash
45 lines
1.1 KiB
Bash
#!/bin/bash
|
|
# Checksum verification for spark artifacts
|
|
# Format: sha256sum output format
|
|
|
|
# Generate checksums for key files
|
|
cd /root/.hermes/wizard-outputs/spark
|
|
|
|
# Create checksum file
|
|
python3 << 'PYTHON_EOF'
|
|
import hashlib
|
|
from pathlib import Path
|
|
|
|
output_dir = Path("/root/.hermes/wizard-outputs/spark")
|
|
checksum_file = output_dir / "checksums.sha256"
|
|
|
|
files_to_checksum = [
|
|
"results.txt",
|
|
"env-check.sh",
|
|
"checksum_verify.py",
|
|
"check_spark_profile.py",
|
|
"verify_checksums.sh"
|
|
]
|
|
|
|
lines = []
|
|
for fname in files_to_checksum:
|
|
fpath = output_dir / fname
|
|
if fpath.exists():
|
|
sha256_hash = hashlib.sha256()
|
|
with open(fpath, "rb") as f:
|
|
for chunk in iter(lambda: f.read(8192), b""):
|
|
sha256_hash.update(chunk)
|
|
hash_val = sha256_hash.hexdigest()
|
|
lines.append(f"{hash_val} {fname}")
|
|
|
|
checksum_file.write_text("\n".join(lines) + "\n")
|
|
print(f"Generated checksums for {len(lines)} files")
|
|
PYTHON_EOF
|
|
|
|
exit_code=$?
|
|
|
|
# Now verify the checksums
|
|
echo "Verifying checksums..."
|
|
python3 checksum_verify.py checksums.sha256
|
|
|
|
exit $exit_code |