Make sure that version_detail.sh script always:

* Uses proper directory name for source files. This approach should be portable, I think.
* Always uses LANG=C for obtaining data, because in non-US environments it will not capture branch name, for example.
This commit is contained in:
pztrn 2015-12-14 22:10:04 +05:00
parent e824a2faea
commit 8fe9e9e791
2 changed files with 25 additions and 9 deletions

View file

@ -3,6 +3,12 @@
#don't exit even if a command fails
set +e
SCRIPT_PATH=$(dirname "`readlink -f "${0}"`")
OLDLANG=${LANG}
export LANG=C
if ( git log -n 1 &> /dev/null); then
#retrieve git information
version="$(git log --pretty=format:"%H" | head -1 | cut -c1-8)"
@ -22,7 +28,9 @@ fi
if [[ ${version} != '' ]]; then
echo "Writing version to retroshare/rsversion.h : ${version}"
sed -e "s%RS_REVISION_NUMBER.*%RS_REVISION_NUMBER 0x${version}%" retroshare/rsversion.in >retroshare/rsversion.h
sed -e "s%RS_REVISION_NUMBER.*%RS_REVISION_NUMBER 0x${version}%" ${SCRIPT_PATH}/retroshare/rsversion.in >${SCRIPT_PATH}/retroshare/rsversion.h
fi
export LANG=${OLDLANG}
echo "script version_detail.sh finished normally"
exit 0