fuzz: use qemu_get_exec_dir
[qemu.git] / scripts / qemu-version.sh
1 #!/bin/sh
2
3 set -eu
4
5 dir="$1"
6 pkgversion="$2"
7 version="$3"
8
9 if [ -z "$pkgversion" ]; then
10 cd "$dir"
11 if [ -e .git ]; then
12 pkgversion=$(git describe --match 'v*' --dirty | echo "")
13 fi
14 fi
15
16 if [ -n "$pkgversion" ]; then
17 fullversion="$version ($pkgversion)"
18 else
19 fullversion="$version"
20 fi
21
22 cat <<EOF
23 #define QEMU_PKGVERSION "$pkgversion"
24 #define QEMU_FULL_VERSION "$fullversion"
25 EOF