Very simple tool which modifies the Copyright lines in all git checked-in
files with an updated year. Lines only listing a single year (2016) will
be modified to list a range instead.
Only the Copyright lines owners of specific owners will be modified. The
script will need to be slightly updated to cover more owners. See the
UPDATE_COPYRIGHT_LINES line in the script for the currently set owners.
v2 - On-the-fly-commit-update: use vendor/ instead of cmocka and
add @sophos.com to the list of copyright holders to update
Signed-off-by: David Sommerseth <davids@openvpn.net>
Acked-by: Steffan Karger <steffan@karger.me>
Message-Id: <1482173532-25132-1-git-send-email-davids@openvpn.net>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg13645.html
1 | 1 |
new file mode 100755 |
... | ... |
@@ -0,0 +1,50 @@ |
0 |
+#!/bin/sh |
|
1 |
+# update-copyright-sh - Simple tool to update the Copyright lines |
|
2 |
+# in all files checked into git |
|
3 |
+# |
|
4 |
+# Copyright (C) 2016 David Sommerseth <davids@openvpn.net> |
|
5 |
+# |
|
6 |
+# This program is free software; you can redistribute it and/or |
|
7 |
+# modify it under the terms of the GNU General Public License |
|
8 |
+# as published by the Free Software Foundation; either version 2 |
|
9 |
+# of the License. |
|
10 |
+# |
|
11 |
+# This program is distributed in the hope that it will be useful, |
|
12 |
+# but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
13 |
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
14 |
+# GNU General Public License for more details. |
|
15 |
+# |
|
16 |
+# You should have received a copy of the GNU General Public License |
|
17 |
+# along with this program; if not, write to the Free Software |
|
18 |
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. |
|
19 |
+# |
|
20 |
+ |
|
21 |
+# Basic shell sanity |
|
22 |
+set -eu |
|
23 |
+ |
|
24 |
+# Simple argument control |
|
25 |
+if [ $# -ne 1 ]; then |
|
26 |
+ echo "Usage: $0 <New Copyright Year>" |
|
27 |
+ exit 1 |
|
28 |
+fi |
|
29 |
+ |
|
30 |
+# Only update Copyright lines with these owners |
|
31 |
+# The 'or' operator is GNU sed specific, and must be \| |
|
32 |
+UPDATE_COPYRIGHT_LINES="@openvpn\.net\|@fox-it\.com\|@sophos.com\|@eurephia\.net\|@greenie\.muc\.de" |
|
33 |
+COPY_YEAR="$1" |
|
34 |
+ |
|
35 |
+cd "$(git rev-parse --show-toplevel)" |
|
36 |
+for file in $(git ls-files | grep -v vendor/); |
|
37 |
+do |
|
38 |
+ echo -n "Updating $file ..." |
|
39 |
+ # The first sed operation covers 20xx-20yy copyright lines, |
|
40 |
+ # The second sed operation changes 20xx -> 20xx-20yy |
|
41 |
+ sed -e "/$UPDATE_COPYRIGHT_LINES/s/\(Copyright (C) 20..-\)\(20..\)[[:blank:]]\+/\1$COPY_YEAR /" \ |
|
42 |
+ -e "/$UPDATE_COPYRIGHT_LINES/s/\(Copyright (C) \)\(20..\)[[:blank:]]\+/\1\2-$COPY_YEAR /" \ |
|
43 |
+ -i $file |
|
44 |
+ echo " Done" |
|
45 |
+done |
|
46 |
+echo |
|
47 |
+echo "** All files updated with $COPY_YEAR as the ending copyright year" |
|
48 |
+echo |
|
49 |
+exit 0 |