-
Notifications
You must be signed in to change notification settings - Fork 0
/
update-version
executable file
·53 lines (44 loc) · 1.61 KB
/
update-version
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
#!/bin/sh
# Get date (two formats)
if [ -n "$2" ]; then
LONGDATE=`date -d "$2" "+%B %d, %Y"`
SHORTDATE=`date -d "$2" "+%m-%d-%Y"`
else
LONGDATE=`date "+%B %d, %Y"`
SHORTDATE=`date "+%m-%d-%Y"`
fi
# Current version number
CURRENTVERSION=0.8.0
# Last date
LASTDATE=02-13-2014
if [ "x$1" = "x" ]
then
echo "Usage: $0 <version number | \"newdate\"> [revision date]"
echo ""
echo "Run this script with the name of the new version (i.e \"2.0b1\") to"
echo "update version number and modification date in files."
echo "Use the \"newdate\" argument if you want to keep the current version"
echo "number and just update the modification date."
echo ""
echo "Current version=$CURRENTVERSION"
echo "Current Modification date=$LASTDATE"
echo ""
exit 1
fi
# Keep track of last version, as it is needed to update quickstart guide pages
lastversion=$CURRENTVERSION
# What's the new version number (if any)?
newversion=$1
if [ "x$newversion" = "xnewdate" ]
then
# No new version number, just a new version date
newversion=$CURRENTVERSION
fi
# Update version number and release date in common code
perl -i -p -e "s/PROGRAM_VERSION \".*\"/PROGRAM_VERSION \"$newversion\"/;" naemon/common.h
perl -i -p -e "s/MODIFICATION_DATE \".*\"/MODIFICATION_DATE \"$SHORTDATE\"/;" naemon/common.h
# Update version number in configure.ac
perl -i -p -e "s/^(AC_INIT.*?\[)\d+\.\d+.\d+/AC_INIT([naemon], [$newversion/;" configure.ac
# Update this file with version number and last date
perl -i -p -e "s/^CURRENTVERSION=.*/CURRENTVERSION=$newversion/;" update-version
perl -i -p -e "s/^LASTDATE=.*/LASTDATE=$SHORTDATE/;" update-version