Created
November 12, 2013 20:52
-
-
Save davidjbradshaw/7438465 to your computer and use it in GitHub Desktop.
Shell scripts to check files against the MANIFEST file create by the grunt-hash-manifest plugin.
This file contains 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 | |
# | |
SEQ=/usr/bin/seq | |
MANIFEST=( $( cat MANIFEST) ) | |
for i in $($SEQ 0 2 $((${#MANIFEST[@]} - 1))) | |
do | |
localMD5=($(md5sum ${MANIFEST[$i]})) | |
manifestMD5=${MANIFEST[$i + 1]} | |
fileName=${MANIFEST[$i]} | |
echo MD5 check: $localMD5 $fileName | |
if [ $localMD5 != $manifestMD5 ] | |
then | |
echo "MD5 sums mismatch (expected $manifestMD5)" >&2 | |
exit 1 | |
fi | |
done | |
exit 0 |
This file contains 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 | |
# | |
echo | |
echo Removing MANIFEST files | |
SEQ=/usr/bin/seq | |
MANIFEST=( $( cat MANIFEST) ) | |
for i in $($SEQ 0 2 $((${#MANIFEST[@]} - 1))) | |
do | |
if [ -e ${MANIFEST[$i]} ] | |
then | |
rm -fv ${MANIFEST[$i]} | |
fi | |
done | |
rm -fv MANIFEST | |
exit 0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment