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