Whamcloud - gitweb
New release 2.15.64
[fs/lustre-release.git] / contrib / scripts / license-status
1 #!/bin/bash
2 # SPDX-License-Identifier: GPL-2.0-only
3
4 #
5 # Copyright (c) 2001, 2010, Oracle and/or its affiliates. All rights reserved.
6 #
7
8 #
9 # This file is part of Lustre, http://www.lustre.org/
10 #
11 # contrib/scripts/license-status
12 #
13 # Display the license status of files in the current directory
14 #
15 # Author: Gordon Matzigkeit <gord@fig.org>, 2001-09-27
16 # Author: Timothy Day <timday@amazon.com>, 2023-04-03
17 #
18
19 for file in $(git ls-tree -r HEAD --name-only); do
20         if head -20 "$file" | egrep -e 'SPDX' > /dev/null; then
21                 license="$(grep SPDX $file | awk '{ print $3; exit; }')"
22                 printf "%-10s %-15s %-s\n" "SPDX" "$license" "$file"
23         elif head -20 "$file" | egrep -e 'GNU General Public License' > /dev/null; then
24                 printf "%-10s %-15s %-s\n" "guess" "gpled" "$file"
25         elif head -20 "$file" | egrep -e '\([Cc]\)' > /dev/null; then
26                 printf "%-10s %-15s %-s\n" "guess" "copyright" "$file"
27         else
28                 printf "%-10s %-15s %-s\n" "guess" "unknown" "$file"
29         fi
30 done | sort