File: check_copyright.sh

package info (click to toggle)
dmtx-utils 0.7.6-1.1
  • links: PTS
  • area: main
  • in suites: bookworm, bullseye, buster, forky, sid, trixie
  • size: 484 kB
  • sloc: ansic: 2,737; sh: 154; makefile: 124; perl: 28
file content (19 lines) | stat: -rwxr-xr-x 399 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
#!/bin/sh

FILE="$1"

# Every nontrivial source file must include a copyright line
COPYRIGHT=$(grep "Copyright (C) " $FILE)
if [[ $? -ne 0 ]]; then
   echo "Missing copyright text in $FILE"
   exit 1
fi

# Copyright line must contain the current year
echo "$COPYRIGHT" | grep --silent $(date '+%Y')
if [[ $? -ne 0 ]]; then
   echo "Missing or incorrect copyright year in $FILE"
   exit 2
fi

exit 0