add_license.sh 536 Bytes
Newer Older
1
2
3
4
5
6
7
8
9
10
#!/bin/bash

find "$@" -name '*.h' -o -name '*.cpp' -o -name '*.qml' | grep -v /3rdparty/ | while read FILE; do
    if grep -qiE "Copyright \(C\) [0-9, -]{4,} " "$FILE" ; then continue; fi
    thisfile=`basename $FILE`
    authorName=`git config user.name`
    authorEmail=`git config user.email`
    thisYear=`date +%Y`
    cat <<EOF > "$FILE".tmp
/*
11
    SPDX-FileCopyrightText: $thisYear $authorName <$authorEmail>
12

13
    SPDX-License-Identifier: LGPL-2.0-or-later
14
15
16
17
18
19
*/

EOF
    cat "$FILE" >> "$FILE".tmp
    mv "$FILE".tmp "$FILE"
done