File tree Expand file tree Collapse file tree 1 file changed +13
-9
lines changed
Expand file tree Collapse file tree 1 file changed +13
-9
lines changed Original file line number Diff line number Diff line change 1515# Run from ruleset folder to simplify sha256sum output
1616cd src/chrome/content/rules
1717WLIST=../../../../utils/ruleset-coverage-whitelist.txt
18- WLISTFILES= $( cut -f3 -d " " $WLIST )
18+ DELIM= " "
1919
20- for file in $WLISTFILES ; do
20+ while IFS=$DELIM read listed_hash file; do
21+ display_hash=$( echo $listed_hash | cut -c-7)
2122 # Remove those that no longer exist
2223 if [ ! -f $file ]; then
23- sed -i " / $file /d" $WLIST
24- echo >&2 " Removed $file : file no longer exists"
25- # Remove those whose hashes no longer match
26- elif ! grep -q $( sha256sum $file ) $WLIST ; then
27- sed -i " / $file /d" $WLIST
28- echo >&2 " Removed $file : file no longer matches the whitelist hash"
24+ sed -i " /$listed_hash$DELIM$file /d" $WLIST
25+ echo >&2 " Removed $file ($display_hash ): file no longer exists"
26+ else
27+ actual_hash=$( sha256sum $file | cut -c-64)
28+ # Remove those whose hashes do not match
29+ if [ " $listed_hash " != " $actual_hash " ]; then
30+ sed -i " /$listed_hash$DELIM$file /d" $WLIST
31+ echo >&2 " Removed $file ($display_hash ): listed hash does not match actual hash"
32+ fi
2933 fi
30- done
34+ done < " $WLIST "
You can’t perform that action at this time.
0 commit comments