check_copyright_notice.sh 579 B

1234567891011121314151617181920
  1. #!/bin/sh
  2. # Copyright (c) 2017 Arista Networks, Inc.
  3. # Use of this source code is governed by the Apache License 2.0
  4. # that can be found in the COPYING file.
  5. # egrep that comes with our Linux distro doesn't like \d, so use [0-9]
  6. notice='Copyright \(c\) 20[0-9][0-9] Arista Networks, Inc.'
  7. files=`git diff-tree --no-commit-id --name-only --diff-filter=ACMR -r HEAD | \
  8. egrep '\.(go|proto|py|sh)$' | grep -v '\.pb\.go$'`
  9. status=0
  10. for file in $files; do
  11. if ! egrep -q "$notice" $file; then
  12. echo "$file: missing or incorrect copyright notice"
  13. status=1
  14. fi
  15. done
  16. exit $status