Recent git versions place the submodule git repos into the
.git/modules directory of the toplevel repo.  In that case
.git of the seabios tree isn't a directory, but a regular
file, saying where the gitdir is.

Extent the git check to also allow .git being a regular file,
so works correctly when called within the qemu

Signed-off-by: Gerd Hoffmann <>
diff --git a/scripts/ b/scripts/
index c8c1725..e5ce96c 100755
--- a/scripts/
+++ b/scripts/
@@ -4,7 +4,7 @@
 # Extract version info
-if [ -d .git ]; then
+if [ -d .git -o -f .git ]; then
     VERSION="`git describe --tags --long --dirty`"
 elif [ -f .version ]; then
     VERSION="`cat .version`"