nagios4/update-version

72 lines
2.6 KiB
Plaintext
Raw Normal View History

2017-05-19 22:22:40 +02:00
#!/bin/sh
# Get date (two formats)
if [ -n "$2" ]; then
LONGDATE=`date -d "$2" "+%B %d, %Y"`
2017-05-19 23:37:19 +02:00
SHORTDATE=`date -d "$2" "+%Y-%m-%d"`
YEAR=`date -d "$2" "+%Y"`
2017-05-19 22:22:40 +02:00
else
LONGDATE=`date "+%B %d, %Y"`
2017-05-19 23:37:19 +02:00
SHORTDATE=`date "+%Y-%m-%d"`
YEAR=`date "+%Y"`
2017-05-19 22:22:40 +02:00
fi
# Current version number
2017-10-20 15:43:36 +02:00
CURRENTVERSION=4.3.4
2017-05-19 22:22:40 +02:00
# Last date
2017-10-20 15:43:36 +02:00
LASTDATE=2017-08-24
2017-05-19 22:22:40 +02:00
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 main PHP page
2017-05-19 23:37:19 +02:00
perl -i -p -e "s/this_year = '.*';/this_year = '$YEAR';/;" html/index.php.in
perl -i -p -e "s/this_year = '.*';/this_year = '$YEAR';/;" html/main.php
2017-05-19 22:22:40 +02:00
perl -i -p -e "s/releasedate\">.*<\//releasedate\">$LONGDATE<\//;" html/main.php
2017-05-19 23:37:19 +02:00
perl -i -p -e "s/this_version = '.*';/this_version = '$newversion';/;" html/main.php
perl -i -p -e "s/this_version = '.*';/this_version = '$newversion';/;" html/side.php
2017-05-19 22:22:40 +02:00
# Update version number and release date in common code
2017-05-19 23:37:19 +02:00
perl -i -p -e "s/PROGRAM_VERSION \".*\"/PROGRAM_VERSION \"$newversion\"/;" include/common.h
2017-05-19 22:22:40 +02:00
perl -i -p -e "s/MODIFICATION_DATE \".*\"/MODIFICATION_DATE \"$SHORTDATE\"/;" include/common.h
# Update version number and release date in configure script and configure.in
perl -i -p -e "s/PKG_VERSION=.*/PKG_VERSION=\"$newversion\"/;" configure
perl -i -p -e "s/PKG_REL_DATE=.*\"/PKG_REL_DATE=\"$SHORTDATE\"/;" configure
2017-05-19 23:37:19 +02:00
perl -i -p -e "s/PKG_VERSION=.*/PKG_VERSION=\"$newversion\"/;" configure.ac
perl -i -p -e "s/PKG_REL_DATE=.*\"/PKG_REL_DATE=\"$SHORTDATE\"/;" configure.ac
2017-05-19 22:22:40 +02:00
# Update RPM spec file with version number
2017-05-19 23:37:19 +02:00
perl -i -p -e "s/Version: .*/Version: $newversion/;" nagios.spec
2017-05-19 22:22:40 +02:00
2017-05-19 23:37:19 +02:00
# Update the doxygen docs
perl -i -p -e "s/^PROJECT_NUMBER = .*/PROJECT_NUMBER = $newversion/;" doxy.conf
2017-05-19 22:22:40 +02:00
# 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