fix whitespaces
[openwrt.git] / scripts / getver.sh
1 #!/usr/bin/env bash
2 export LANG=C
3 [ -n "$TOPDIR" ] && cd $TOPDIR
4
5 try_version() {
6 [ -f version ] || return 1
7 REV="$(cat version)"
8 [ -n "$REV" ]
9 }
10
11 try_svn() {
12 [ -d .svn ] || return 1
13 REV="$(svn info | awk '/^Revision:/ { print $2 }')"
14 REV="${REV:+r$REV}"
15 [ -n "$REV" ]
16 }
17
18 try_git() {
19 [ -d .git ] || return 1
20 REV="$(git-log | grep -m 1 git-svn-id | awk '{ gsub(/.*@/, "", $2); print $2 }')"
21 REV="${REV:+r$REV}"
22 [ -n "$REV" ]
23 }
24
25 try_version || try_svn || try_git || REV="unknown"
26 echo "$REV"
This page took 0.053622 seconds and 5 git commands to generate.