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