bump-version.sh 823 B

12345678910111213141516171819202122232425262728293031323334353637
  1. #!/bin/sh +v
  2. set -eu
  3. # Start from the build directory, where the version file is located
  4. if [ -f build/version ]; then
  5. cd build
  6. fi
  7. if [ \! -f version ]; then
  8. echo "Can't find version file"
  9. exit 1
  10. fi
  11. # Update the build number in the 'version' file.
  12. # Separate number from additional alpha/beta/etc marker
  13. MARKER=`cat version | sed 's/[0-9.]//g'`
  14. # Bump the number
  15. VN=`cat version | sed 's/[^0-9.]//g'`
  16. # Reassemble and write back out
  17. VN=$(($VN + 1))
  18. rm -f version.old
  19. mv version version.old
  20. chmod +w version.old
  21. echo $VN$MARKER > version
  22. VS="$(($VN/1000000)).$(( ($VN/1000)%1000 )).$(( $VN%1000 ))$MARKER"
  23. cd ..
  24. ANNOUNCE=`date +"%b %d, %Y:"`" libarchive $VS released"
  25. echo $ANNOUNCE
  26. # Add a version notice to NEWS
  27. mv NEWS NEWS.bak
  28. chmod +w NEWS.bak
  29. echo $ANNOUNCE >> NEWS
  30. echo >> NEWS
  31. cat NEWS.bak >> NEWS