skip already processed files and directories on build
[FireMan.git] / scripts / generate_version.sh
blob5f6e9e3dc2fbc382d44b9600cd6db16fc1c5e712
1 #!/bin/sh
3 # Copyright (c) 2008 Tobias Sarnowski <sarnowski@new-thoughts.org>
5 # Permission to use, copy, modify, and distribute this software for any
6 # purpose with or without fee is hereby granted, provided that the above
7 # copyright notice and this permission notice appear in all copies.
9 # THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
10 # WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
11 # MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
12 # ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
13 # WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
14 # ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
15 # OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
17 # generate version from git
18 version=$(git-describe --abbrev=4 HEAD 2>/dev/null)
20 # dashes are ugly, use dots
21 version=$(echo $version | sed 's/-/./g')
23 if [ "$1" != "--full" ]; then
24 version=$(echo $version | sed 's/\.[^\.]*$//')
27 # mark as dirty if uncommitted parts are in the source
28 if [ "$1" == "--full" ] && [ ! -z "$(git-diff-index --name-only HEAD --)" ]; then
29 version="$version-dirty"
32 # print out
33 echo $version