mirror of
https://github.com/RetroShare/RetroShare.git
synced 2024-10-01 02:35:48 -04:00
61429b0ddd
git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@5509 b45a01b8-16f6-495d-af2f-9b41ad6348cc
33 lines
1.1 KiB
Bash
Executable File
33 lines
1.1 KiB
Bash
Executable File
#!/bin/bash
|
|
|
|
#don't exit even if a command fails
|
|
set +e
|
|
|
|
|
|
if ( git log -n 1 &> /dev/null); then
|
|
#retrieve git information
|
|
version="git : $(git status | grep branch | cut -c 13-) $(git log -n 1 | grep commit | cut -c 8-)"
|
|
fi
|
|
|
|
if ( git log -n 1 | grep svn &> /dev/null); then
|
|
#retrieve git svn information
|
|
version="$version svn : $(git log -n 1 | grep svn | awk '{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 | grep svn | awk '{print $2}' | head -1 | sed 's/.*@//')"
|
|
fi
|
|
|
|
if ( svn info &> /dev/null); then
|
|
version=$(svn info | grep '^Revision:')
|
|
fi
|
|
|
|
if [[ $version != '' ]]; then
|
|
version_number=`echo $version | cut -d: -f2`
|
|
version="$version date : $(date +'%T %m.%d.%y')"
|
|
echo "Writing version to util/rsversion.h : $version "
|
|
sed -i "s/SVN_REVISION .*/SVN_REVISION \"$version\"/g" util/rsversion.h
|
|
sed -i "s/SVN_REVISION_NUMBER .*/SVN_REVISION_NUMBER $version_number/g" util/rsversion.h
|
|
fi
|
|
echo "script version_detail.sh finished normally"
|
|
exit 0
|