summaryrefslogtreecommitdiffstats
path: root/git_version.sh
diff options
context:
space:
mode:
authorMark Wielaard <mjw@redhat.com>2010-02-25 22:06:42 +0100
committerMark Wielaard <mjw@redhat.com>2010-03-03 12:19:30 +0100
commit7020ae0062b9f5dc60da698f896bb91c6d8a6b09 (patch)
tree9370679dab3594a32358316e5e596c9eb59a3d3f /git_version.sh
parentf4fe2e932cc8f445e9e1bc52863e11b669e3afc9 (diff)
downloadsystemtap-steved-7020ae0062b9f5dc60da698f896bb91c6d8a6b09.tar.gz
systemtap-steved-7020ae0062b9f5dc60da698f896bb91c6d8a6b09.tar.xz
systemtap-steved-7020ae0062b9f5dc60da698f896bb91c6d8a6b09.zip
git_version.sh: Don't unnecessarily write to builddir during make install.
Ideally make install wouldn't touch the src or build dirs. When the build dir is mounted so root cannot write to it a make install would fail because git_version.sh tried to create a temporary file. Fix by creating temporary git_version.h.new file in temp dir. * git_version.sh: Create temp dir and git_version.h.new outside src and build dir. Change all occurances of $outfile.new to $outfilenew.
Diffstat (limited to 'git_version.sh')
-rwxr-xr-xgit_version.sh15
1 files changed, 9 insertions, 6 deletions
diff --git a/git_version.sh b/git_version.sh
index c9d3dff7..3fcd27e4 100755
--- a/git_version.sh
+++ b/git_version.sh
@@ -88,6 +88,8 @@ do
if [ "x$outfile" = "x-" ]; then
: # keep default ifndef_symbol
else
+ newdir=$(mktemp -t -d git_version_XXXXXX)
+ outfilenew="$newdir/$1.new"
ifndef_symbol=`basename "$outfile" | $SED 's|\.|_|g; s|[^A-Za-z0-9_]||g' | tr a-z A-Z`
fi
else
@@ -133,7 +135,7 @@ if [ "x$outfile" = "x-" ]
then
: # keep using stdout
else
- exec 1> "${outfile}.new"
+ exec 1> "${outfilenew}"
fi
# Done with creating output files, so we can change to source dir
@@ -353,18 +355,19 @@ then
if [ -f "$outfile" ]; then
if [ "x$keep_if_no_repo" = "xyes" ] && [ "x$git_repo" = "xno" ]; then
"$quiet" || echo "$self: Not a git repo, keeping existing $outfile" >&2
- rm -f "$outfile.new"
- elif cmp "$outfile" "$outfile.new" > /dev/null; then
+ rm -f "$outfilenew"
+ elif cmp "$outfile" "$outfilenew" > /dev/null; then
"$quiet" || echo "$self: Output is unchanged, keeping $outfile" >&2
- rm -f "$outfile.new"
+ rm -f "$outfilenew"
else
echo "$self: Output has changed, updating $outfile" >&2
- mv -f "$outfile.new" "$outfile"
+ mv -f "$outfilenew" "$outfile"
fi
else
echo "$self: Output is new file, creating $outfile" >&2
- mv -f "$outfile.new" "$outfile"
+ mv -f "$outfilenew" "$outfile"
fi
+ rmdir "$newdir"
fi
# THE END.