Release 0.8.2.482.65a5001-1
[nginx-catap.git] / version.sh
blob09edc2bbf35a828af9df7def9575db9c6f42bb48
1 #!/bin/bash
2 test -d .git || exit 0
3 git rev-list HEAD | sort > config.git-hash
4 LOCALVER=`wc -l config.git-hash | awk '{print $1}'`
5 if [ $LOCALVER \> 1 ] ; then
6 VER=`git rev-list origin/master | sort | join config.git-hash - | wc -l | awk '{print $1}'`
7 if [ $VER != $LOCALVER ] ; then
8 VER="$VER+$(($LOCALVER-$VER))"
9 elif git status | grep -q "modified:" ; then
10 VER="${VER}M"
12 VER="$VER.$(git rev-list HEAD -n 1 | head -c 7)"
13 else
14 VER="x"
16 rm -f config.git-hash
17 sed -i -e "s:\"\([0-9]*\.[0-9]*\.[0-9]*\).*\".*$:\"\1\.$VER\":g" \
18 -e "s:\"nginx/\":\"nginx-catap/\":g" \
19 src/core/nginx.h
20 sed -i -e "s:'\([0-9]*\.[0-9]*\.[0-9]*\).*'.*$:\'\1\.$VER\';:g" \
21 src/http/modules/perl/nginx.pm