Last active
March 3, 2024 01:30
-
-
Save segyges/5f13fc4af8d93ed4ccebbe4ccc36d536 to your computer and use it in GitHub Desktop.
lfs_parity_checker.sh
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| lfs_files_long=$(git lfs ls-files --long) | |
| checked=0 | |
| bad=0 | |
| while IFS= read -r line; do | |
| # Read each part of the line into separate variables | |
| read -r hash separator filename <<< "$line" | |
| # Echo each part with a different prefix | |
| echo "Checking $filename with git lfs hash $hash" | |
| # You can process each part further here if needed | |
| computed_hash=$(sha256sum "$filename" | awk '{print $1}') | |
| # Compare the computed hash with the provided hash | |
| if [ "$computed_hash" = "$hash" ]; then | |
| echo "File $filename: Hash matches" | |
| else | |
| echo "File $filename: Hash does not match, computed hash from file is $computed_hash" | |
| ((bad++)) | |
| fi | |
| ((checked++)) | |
| done <<< "$lfs_files_long" | |
| if [ "$bad" -ne 0 ]; then | |
| echo "$bad have bad checksums" | |
| fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment