Make bufadvance rely on bufseek instead of duplicating code
[Rockbox.git] / tools / svnversion.sh
blob1744e98c6e5d7be1de1fe5c1f378a3d80ffb6a6e
1 #!/bin/sh
2 # __________ __ ___.
3 # Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 # Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 # Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 # Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 # \/ \/ \/ \/ \/
8 # $Id$
11 # Usage: svnversion.sh [source-root]
13 # Prints the revision "rXYZ" of the first argument, as reported by svnversion.
14 # Prints "unknown" if svnversion fails or says "exported".
15 svnversion_safe() {
16 # LANG=C forces svnversion to not localize "exported".
17 if OUTPUT=`LANG=C svnversion "$@"`; then
18 if [ "$OUTPUT" = "exported" ]; then
19 echo "unknown"
20 else
21 echo "r$OUTPUT"
23 else
24 echo "unknown"
28 VERSIONFILE=docs/VERSION
29 if [ -n "$1" ]; then TOP=$1; else TOP=..; fi
30 if [ -r $TOP/$VERSIONFILE ]; then SVNVER=`cat $TOP/$VERSIONFILE`;
31 else
32 SVNVER=`svnversion_safe $TOP`;
33 if [ "$SVNVER" = "unknown" ]; then
34 # try getting it from a subdir to test if perhaps they are symlinked
35 # from the root
36 SVNVER=`svnversion_safe $TOP/tools`;
39 VERSION=$SVNVER-`date -u +%y%m%d`
40 echo $VERSION