File indexing completed on 2024-05-05 05:19:11

0001 #!/bin/bash
0002 
0003 find "$@" -name '*.h' -o -name '*.cpp' -o -name '*.qml' -o -name '*.java' -o -name "*.js" | grep -v /3rdparty/ | while read FILE; do
0004     if grep -qiE "Licensed under CC0." "$FILE" ; then continue; fi
0005     if grep -qiE "Copyright \(C\) [0-9, -]{4,} " "$FILE" ; then continue; fi
0006     if grep -qiE "SPDX-" "$FILE" ; then continue; fi
0007     thisfile=`basename $FILE`
0008     authorName=`git config user.name`
0009     authorEmail=`git config user.email`
0010     thisYear=`date +%Y`
0011     cat <<EOF > "$FILE".tmp
0012 /*
0013     SPDX-FileCopyrightText: $thisYear $authorName <$authorEmail>
0014 
0015     SPDX-License-Identifier: LGPL-2.0-or-later
0016 */
0017 
0018 EOF
0019     cat "$FILE" >> "$FILE".tmp
0020     mv "$FILE".tmp "$FILE"
0021 done