2 # SPDX-License-Identifier: GPL-2.0-only
5 # Copyright (c) 2001, 2010, Oracle and/or its affiliates. All rights reserved.
7 # Copyright (c) 2023-2024, Amazon and/or its affiliates. All rights reserved.
8 # Use is subject to license terms.
12 # This file is part of Lustre, http://www.lustre.org/
14 # Display the license status of files in the current directory
16 # Author: Gordon Matzigkeit <gord@fig.org>, 2001-09-27
17 # Author: Timothy Day <timday@amazon.com>, 2023-04-03
20 export files="${1:-$(pwd)}"
22 for file in $(git ls-files "$files"); do
23 if head -20 "$file" | grep -Ee 'SPDX' > /dev/null; then
24 license="$(grep SPDX "$file" | awk '{ print $3; exit; }')"
25 printf "%-10s %-15s %-s\n" "SPDX" "$license" "$file"
26 elif head -20 "$file" | grep -Ee 'GNU General Public License' > /dev/null; then
27 printf "%-10s %-15s %-s\n" "guess" "gpled" "$file"
28 elif head -20 "$file" | grep -Ee '\([Cc]\)' > /dev/null; then
29 printf "%-10s %-15s %-s\n" "guess" "copyright" "$file"
31 printf "%-10s %-15s %-s\n" "guess" "unknown" "$file"