Skip to content

Instantly share code, notes, and snippets.

@davidjbradshaw
Created November 12, 2013 20:52
Show Gist options
  • Save davidjbradshaw/7438465 to your computer and use it in GitHub Desktop.
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.
#!/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
#!/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