-
Notifications
You must be signed in to change notification settings - Fork 1.2k
/
check-copyright.sh
executable file
·21 lines (20 loc) · 1 KB
/
check-copyright.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
#!/bin/bash
# Copyright 2020 syzkaller project authors. All rights reserved.
# Use of this source code is governed by Apache 2 LICENSE that can be found in the LICENSE file.
FILES=0
FAILED=""
for F in $(find -name "*.go" -o -name "*.sh" -o \( -path "./sys/*/*.txt" \) | egrep -v "/vendor/|/gen/"); do
((FILES+=1))
cat $F | tr '\n' '_' | egrep "(//|#) Copyright 20[0-9]{2}(/20[0-9]{2})? syzkaller project authors\. All rights reserved\._(//|#) Use of this source code is governed by Apache 2 LICENSE that can be found in the LICENSE file\." >/dev/null
if [ $? -eq 0 ]; then continue; fi
# Ignore auto-generated files.
egrep "(//|#) AUTOGENERATED FILE|(WARNING: This file is machine generated)" $F >/dev/null
if [ $? -eq 0 ]; then continue; fi
# Ignore untracked files.
git ls-files --error-unmatch $F >/dev/null 2>&1
if [ $? -ne 0 ]; then continue; fi
echo "$F: does not have standard copyright statement"
FAILED="1"
done
if [ "$FAILED" != "" ]; then exit 1; fi
echo "$FILES files checked for copyright statement"