RetroShare/retroshare-gui/src/version_detail.sh
pztrn 8fe9e9e791 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.
2015-12-14 22:10:04 +05:00

39 lines
1.3 KiB
Bash
Executable File

#!/bin/bash
#check if we're on *nix system
#write the version.html file
#don't exit even if a command fails
set +e
OLDLANG=${LANG}
export LANG=C
SCRIPT_PATH=$(dirname "`readlink -f "${0}"`")
if (ls &> /dev/null); then
echo "Retroshare Gui version : " > ${SCRIPT_PATH}/gui/help/version.html
if ( /usr/bin/git log -n 1 &> /dev/null); then
#retrieve git information
echo "Git version : $(git status | grep branch | head -n 1 | cut -c 4-) $(git log -n 1 | grep commit)" >> ${SCRIPT_PATH}/gui/help/version.html
fi
if ( /usr/bin/git log -n 1 | grep svn &> /dev/null); then
#retrieve git svn information
echo "Svn version : $(git log -n 1 | awk '/svn/ {print $2}' | head -1)" >> ${SCRIPT_PATH}/gui/help/version.html
elif ( /usr/bin/git log -n 10 | grep svn &> /dev/null); then
#retrieve git svn information
echo "Svn closest version : $(git log -n 10 | awk '/svn/ {print $2}' | head -1)" >> ${SCRIPT_PATH}/gui/help/version.html
fi
if ( /usr/bin/svn info &> /dev/null); then
echo "Svn version : $(svn info | awk '/^Revision:/ {print $NF}')" >> ${SCRIPT_PATH}/gui/help/version.html
fi
date >> ${SCRIPT_PATH}/gui/help/version.html
echo "" >> ${SCRIPT_PATH}/gui/help/version.html
echo "" >> ${SCRIPT_PATH}/gui/help/version.html
fi
export LANG=${OLDLANG}
echo "version_detail.sh scripts finished"
exit 0