Fix a typo in xas.1 (thanks to Marcell)
[amule.git] / src / utils / scripts / version_bumper
bloba30ea1a8ceb33cb6d0e09a952fbb5a0bab799433
1 #!/bin/sh
2 ##################################################
3 # aMule Version Info Bumper #
4 ##################################################
6 ## This file is part of the aMule Project
7 ##
8 ## Copyright (c) 2004-2011 Angel Vidal ( kry@amule.org )
9 ## Copyright (c) 2003-2011 aMule Team ( admin@amule.org / http://www.amule.org )
11 ## This program is free software; you can redistribute it and/or
12 ## modify it under the terms of the GNU General Public License
13 ## as published by the Free Software Foundation; either
14 ## version 2 of the License, or (at your option) any later version.
16 ## This program is distributed in the hope that it will be useful,
17 ## but WITHOUT ANY WARRANTY; without even the implied warranty of
18 ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 ## GNU General Public License for more details.
21 ## You should have received a copy of the GNU General Public License
22 ## along with this program; if not, write to the Free Software
23 ## Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
25 if test x"$1" = x""; then
26 echo "aMule Version Info Bumper v0.2"
27 echo "Copyright (c) 2004-2011 Angel Vidal ( kry@amule.org )"
28 echo "Copyright (c) 2003-2011 aMule Team ( admin@amule.org / http://www.amule.org )"
29 echo -e "Usage:"
30 echo -e "\tversion_bumper [old_version] new_version"
31 echo -e "Examples:"
32 echo -e "\tUpdates version 2.1.0 info to 2.1.1 -> version_bumper 2.1.0 2.1.1"
33 echo -e "\tUpdates current version to 2.1.1 \(autodetect old version\) -> version_bumper 2.1.1"
34 echo " - This script is buggy and can kill your dog. Be careful. -"
35 else
36 if test x"`ls configure.in`" = x""; then
37 echo "This script must be run on aMule base directory."
38 else
39 OLD_VERSION=$1
40 NEW_VERSION=$2
41 if test x"$NEW_VERSION" = x""; then
42 NEW_VERSION=$OLD_VERSION
43 OLD_VERSION=`grep "PROJECT_NUMBER" docs/Doxyfile | grep "=" | sed -r "s/\s+/ /g" | cut -d " " -f 3`
44 echo "Autodetected old version: $OLD_VERSION"
46 if test x"`echo "$OLD_VERSION" | grep -o -E "[0-9]+\.[0-9]+\.[0-9]+"`" != x"$OLD_VERSION"; then
47 echo "Specified old version ($OLD_VERSION) does not conform to a.b.c form."
48 else
49 if test x"`echo "$NEW_VERSION" | grep -o -E "[0-9]+\.[0-9]+\.[0-9]+"`" != x"$NEW_VERSION"; then
50 echo "Specified new version ($NEW_VERSION) does not conform to a.b.c form."
51 else
52 echo "Bumping from $OLD_VERSION to $NEW_VERSION"
53 #Command:
54 sed -i "s/$OLD_VERSION/$NEW_VERSION/g" aMule.app/Contents/Info.plist configure.in src/include/common/ClientVersion.h docs/Doxyfile aMule.spec po/*.po
55 sed -i -r "s/VERSION_MJR\s+(0x0)?`echo $OLD_VERSION | cut -d "." -f 1`/VERSION_MJR\t\t`echo $NEW_VERSION | cut -d "." -f 1`/g" src/include/common/ClientVersion.h
56 sed -i -r "s/VERSION_MIN\s+(0x0)?`echo $OLD_VERSION | cut -d "." -f 2`/VERSION_MIN\t\t`echo $NEW_VERSION | cut -d "." -f 2`/g" src/include/common/ClientVersion.h
57 sed -i -r "s/VERSION_UPDATE\s+(0x0)?`echo $OLD_VERSION | cut -d "." -f 3`/VERSION_UPDATE\t\t`echo $NEW_VERSION | cut -d "." -f 3`/g" src/include/common/ClientVersion.h
58 if test x"`grep -E "^#define __SVN__$" src/include/common/ClientVersion.h`" != x""; then
59 echo "WARNING! ClientVersion.h still defines version as SVN. Please comment the line \"#define __SVN__\" before releasing."