File tree Expand file tree Collapse file tree 1 file changed +30
-0
lines changed
Expand file tree Collapse file tree 1 file changed +30
-0
lines changed Original file line number Diff line number Diff line change 1+ #! /bin/bash
2+ # Remove from ruleset whitelist the filenames of files that
3+ # no longer exist or have no matching hash sums.
4+
5+ # Change directory to git root; taken from ../test/test.sh
6+ if [ -n " $GIT_DIR " ]
7+ then
8+ # $GIT_DIR is set, so we're running as a hook.
9+ cd $GIT_DIR
10+ else
11+ # Git command exists? Cool, let's CD to the right place.
12+ git rev-parse && cd " $( git rev-parse --show-toplevel) "
13+ fi
14+
15+ # Run from ruleset folder to simplify sha256sum output
16+ cd src/chrome/content/rules
17+ WLIST=../../../../utils/ruleset-coverage-whitelist.txt
18+ WLISTFILES=$( cut -f3 -d " " $WLIST )
19+
20+ for file in $WLISTFILES ; do
21+ # Remove those that no longer exist
22+ if [ ! -f $file ]; then
23+ sed -i " / $file /d" $WLIST
24+ echo " $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 " $file no longer matches the whitelist hash"
29+ fi
30+ done
You can’t perform that action at this time.
0 commit comments