update-version 2.1 KB

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