2009-08-01 09:53:47 -04:00
|
|
|
#!/bin/bash
|
|
|
|
|
2009-08-13 11:10:19 -04:00
|
|
|
#don't exit even if a command fails
|
|
|
|
set +e
|
|
|
|
|
2010-02-09 14:10:58 -05:00
|
|
|
if ( git log -n 1 &> /dev/null); then
|
|
|
|
#retrieve git information
|
2015-08-02 13:10:59 -04:00
|
|
|
version="$(git log --pretty=format:"%H" | head -1 | cut -c1-8)"
|
2010-02-09 14:10:58 -05:00
|
|
|
fi
|
|
|
|
|
2015-08-02 13:10:59 -04:00
|
|
|
# if ( git log -n 1 | grep svn &> /dev/null); then
|
|
|
|
# #retrieve git svn information
|
|
|
|
# version="${version} svn : $(git log -n 1 | awk '/svn/ {print $2}' | head -1 | sed 's/.*@//')"
|
|
|
|
# elif ( git log -n 10 | grep svn &> /dev/null); then
|
|
|
|
# #retrieve git svn information
|
|
|
|
# version="${version} svn closest version : $(git log -n 10 | awk '/svn/ {print $2}' | head -1 | sed 's/.*@//')"
|
|
|
|
# fi
|
2010-02-09 14:10:58 -05:00
|
|
|
|
2015-08-02 13:10:59 -04:00
|
|
|
# if ( svn info &> /dev/null); then
|
|
|
|
# version=$(svn info | awk '/^Revision:/ {print $NF}')
|
|
|
|
# fi
|
2012-09-04 15:04:48 -04:00
|
|
|
|
2015-04-04 11:37:54 -04:00
|
|
|
if [[ ${version} != '' ]]; then
|
|
|
|
echo "Writing version to retroshare/rsversion.h : ${version}"
|
2015-08-02 13:10:59 -04:00
|
|
|
sed -e "s%RS_REVISION_NUMBER.*%RS_REVISION_NUMBER 0x${version}%" retroshare/rsversion.in >retroshare/rsversion.h
|
2009-08-01 09:53:47 -04:00
|
|
|
fi
|
2009-08-13 11:10:19 -04:00
|
|
|
echo "script version_detail.sh finished normally"
|
|
|
|
exit 0
|