configure.in renamed to configure.ac
[amule.git] / src / utils / scripts / year_bumper
blobfd923c05f77603f20dd5150872ca3dccedd3a32d
1 #!/bin/sh -eu
3 ## This file is part of the aMule Project
4 ##
5 ## Copyright (c) 2011 Dévai Tamás ( gonosztopi@amule.org )
6 ## Copyright (c) 2011 aMule Team ( admin@amule.org / http://www.amule.org )
7 ##
8 ## This program is free software; you can redistribute it and/or
9 ## modify it under the terms of the GNU General Public License
10 ## as published by the Free Software Foundation; either
11 ## version 2 of the License, or (at your option) any later version.
13 ## This program is distributed in the hope that it will be useful,
14 ## but WITHOUT ANY WARRANTY; without even the implied warranty of
15 ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 ## GNU General Public License for more details.
18 ## You should have received a copy of the GNU General Public License
19 ## along with this program; if not, write to the Free Software
20 ## Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
22 # Usage:
23 # year_bumper [oldyear [newyear]]
25 # oldyear defaults to the year found in configure.ac
26 # newyear defaults to the current year
28 if [ ! -f ./configure.ac ]; then
29 echo "This script must be run from the source root directory!"
30 exit 1
33 if [ $# -ge 1 ]; then
34 oldyear="$1"
35 else
36 oldyear=`sed -e 's/# Copyright (c) 2003-\([0-9]\{4\}\).*/\1/;t;d' ./configure.ac`
39 if [ $# -ge 2 ]; then
40 newyear="$2"
41 else
42 newyear=`date "+%Y"`
45 echo "Bumping from ${oldyear} to ${newyear}..."
47 if [ "$newyear" = "$oldyear" ]; then
48 echo "Nothing to do."
49 exit
52 find '.' \
53 '(' \
54 -name '.svn' -o \
55 -name '.hg' -o \
56 -name '.git' -o \
57 -name '*.wdr' \
58 ')' -prune -o \
59 -type f -print | \
60 while read f; do
61 if file "$f" | grep -q text ; then
62 if grep -q "$oldyear" "$f" ; then
63 echo $f
64 sed -i -e "/Copyright/{s/-${oldyear}/-${newyear}/g;s/${oldyear}/${oldyear}-${newyear}/g;}" "$f"
67 done