summaryrefslogtreecommitdiff
path: root/Tools/scripts/LEGALlint
blob: 99ee9b2101d8ac9cb316249d84cbc4ec0a95cf63 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
#!/bin/sh
# $FreeBSD$

PORTSDIR="${PORTSDIR:-/usr/ports}"

cd "$PORTSDIR" || exit 1

export IFS="${IFS}:"
grep -nv '#' "$PORTSDIR/LEGAL" | while read -r line _ port text
do
  if [ ! -d "$port" ]
  then
    printf "%d (%s): port has been removed\\n" "$line" "$port"
    continue
  fi

  actual_text="$(make -C "$port" -VLEGAL)"
  if [ "$text" != "$actual_text" ]
  then
    printf "%d (%s): reason mismatch\\n" "$line" "$port"
  fi
done