1#!/bin/sh 2 3# Get date (two formats) 4if [ -n "$2" ]; then 5 LONGDATE=`date -d "$2" "+%B %d, %Y"` 6 SHORTDATE=`date -d "$2" "+%m-%d-%Y"` 7else 8 LONGDATE=`date "+%B %d, %Y"` 9 SHORTDATE=`date "+%m-%d-%Y"` 10fi 11 12# Current version number 13CURRENTVERSION=2.7.2 14 15# Last date 16LASTDATE=07-03-2007 17 18if [ "x$1" = "x" ] 19then 20 echo "Usage: $0 <version number | \"newdate\"> [revision date]" 21 echo "" 22 echo "Run this script with the name of the new version (i.e \"2.6\") to" 23 echo "update version number and modification date in files." 24 echo "Use the \"newdate\" argument if you want to keep the current version" 25 echo "number and just update the modification date." 26 echo "" 27 echo "Current version=$CURRENTVERSION" 28 echo "Current Modification date=$LASTDATE" 29 echo "" 30 exit 1 31fi 32 33newversion=$1 34if [ "x$newversion" = "xnewdate" ] 35then 36 newversion=$CURRENTVERSION 37fi 38 39# Update version number and release date in common code 40perl -i -p -e "s/VERSION \".*\"/VERSION \"$1\"/;" include/common.h 41perl -i -p -e "s/MODIFICATION_DATE \".*\"/MODIFICATION_DATE \"$SHORTDATE\"/;" include/common.h 42 43# Update version number and release date in main code 44perl -i -p -e "s/Last Modified: [0-9].*/Last Modified: $SHORTDATE/;" src/nsca.c 45perl -i -p -e "s/Last Modified: [0-9].*/Last Modified: $SHORTDATE/;" src/send_nsca.c 46 47# Update version number and release date in configure script and configure.in 48perl -i -p -e "s/PKG_VERSION=.*/PKG_VERSION=\"$1\"/;" configure 49perl -i -p -e "s/PKG_REL_DATE=.*\"/PKG_REL_DATE=\"$SHORTDATE\"/;" configure 50perl -i -p -e "s/PKG_VERSION=.*/PKG_VERSION=\"$1\"/;" configure.in 51perl -i -p -e "s/PKG_REL_DATE=.*\"/PKG_REL_DATE=\"$SHORTDATE\"/;" configure.in 52 53# Update RPM spec file with version number 54perl -i -p -e "s/%define version .*/%define version $1/;" nsca.spec 55 56# Update this file with version number and last date 57perl -i -p -e "s/^CURRENTVERSION=.*/CURRENTVERSION=$newversion/;" update-version 58perl -i -p -e "s/^LASTDATE=.*/LASTDATE=$SHORTDATE/;" update-version 59