kbuild: fix delay in setlocalversion on readonly source
Nico Schottelius [Fri, 12 Jun 2009 07:59:52 +0000 (09:59 +0200)]
Do not update index on read only media.
Idea published by Christian Kujau <lists@nerdbynature.de>.

Cc: Nico Schottelius <nico@ikn.schottelius.org>
Cc: Christian Kujau <lists@nerdbynature.de>

scripts/setlocalversion

index 0079047..46989b8 100755 (executable)
@@ -39,8 +39,10 @@ if head=`git rev-parse --verify --short HEAD 2>/dev/null`; then
                printf -- '-svn%s' "`git svn find-rev $head`"
        fi
 
-       # Are there uncommitted changes?
-       git update-index --refresh --unmerged > /dev/null
+       # Update index only on r/w media
+       [ -w . ] && git update-index --refresh --unmerged > /dev/null
+
+       # Check for uncommitted changes
        if git diff-index --name-only HEAD | grep -v "^scripts/package" \
            | read dummy; then
                printf '%s' -dirty