From 455b0b12287bd886147da861c645c82adf20b0e6 Mon Sep 17 00:00:00 2001
From: Guillaume Roguez <guillaume.roguez@savoirfairelinux.com>
Date: Sat, 14 Mar 2015 14:31:33 -0400
Subject: [PATCH] tools: make update-copyright usable without modifications

No more needed to change the script to update the date.

Refs #68586

Change-Id: I86c99beda652169e9a761990be211a6bd2aacd96
---
 tools/update-copyright | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/tools/update-copyright b/tools/update-copyright
index bc9d5254a5..5092cc0da7 100755
--- a/tools/update-copyright
+++ b/tools/update-copyright
@@ -1,6 +1,6 @@
 #!/bin/bash
 
-# Copyright (C) 2004-2013 Savoir-Faire Linux Inc.
+# Copyright (C) 2004-2015 Savoir-Faire Linux Inc.
 # Author: Emmanuel Milou <emmanuel.milou@savoirfairelinux.com>
 #
 # This program is free software: you can redistribute it and/or modify
@@ -28,15 +28,15 @@
 # as that of the covered work.
 #
 
-cd ..
-# List all files
-FILES=`find -name "*.h" -o -name "*.c" -o -name "*.cpp" -o -name "*.i" -o -name "README" -o -name "*.sh"`
+# List all files in current directory
+FILES=`find -name "*.h" -o -name "*.c" -o -name "*.cpp" -o -name "*.i" -o -name "README" -o -name "*.sh" -o -name "*.py"`
+year=`date +%Y`
 
 # Loop and replace
 for f in $FILES
 do
-  sed -i "s/\-2012 Savoir-Faire Linux Inc/\-2013 Savoir-Faire Linux Inc/g" $f
-  sed -i "s/ 2012 Savoir-Faire Linux Inc/ 2012-2013 Savoir-Faire Linux Inc/g" $f
+  sed -i "/$year/b; s/\-[0-9]\+ Savoir-Faire Linux Inc/-$year Savoir-Faire Linux Inc/g" $f
+  sed -i "/$year/b; s/ \([0-9]\+\) Savoir-Faire Linux Inc/ \1-$year Savoir-Faire Linux Inc/g" $f
 done
 
 exit 0;
-- 
GitLab