From 45b1e121b1ca2d90a774df6b3a855cfc142a8445 Mon Sep 17 00:00:00 2001 From: Marko Lindqvist Date: Wed, 16 Feb 2022 16:39:30 +0200 Subject: [PATCH 11/11] generate_gitrev.sh: Handle relative output file path correctly See osdn #43879 Signed-off-by: Marko Lindqvist --- bootstrap/generate_gitrev.sh | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/bootstrap/generate_gitrev.sh b/bootstrap/generate_gitrev.sh index fdde1c2e29..a46bd5fb22 100755 --- a/bootstrap/generate_gitrev.sh +++ b/bootstrap/generate_gitrev.sh @@ -22,7 +22,9 @@ REV2="dist" # Check that all commands required by this script are available # If not, we will not claim to know which git revision this is # (REVSTATE will be OFF) - if command -v git && command -v tail && command -v wc ; then + if command -v git >/dev/null && + command -v tail >/dev/null && + command -v wc >/dev/null ; then REVTMP="$(git rev-parse --short HEAD 2>/dev/null)" if test "x$REVTMP" != "x" ; then # This is git repository. Check for local modifications @@ -37,11 +39,11 @@ REV2="dist" fi fi - sed -e "s,,$REV1," -e "s,,$REV2," -e "s,,$REVSTATE," fc_gitrev_gen.h.tmpl > "$OUTPUTDIR/fc_gitrev_gen.h.tmp" - if ! test -f "$OUTPUTDIR/fc_gitrev_gen.h" || - ! cmp "$OUTPUTDIR/fc_gitrev_gen.h" "$OUTPUTDIR/fc_gitrev_gen.h.tmp" - then - mv "$OUTPUTDIR/fc_gitrev_gen.h.tmp" "$OUTPUTDIR/fc_gitrev_gen.h" - fi - rm -f "$OUTPUTDIR/fc_gitrev_gen.h.tmp" -) > /dev/null + sed -e "s,,$REV1," -e "s,,$REV2," -e "s,,$REVSTATE," fc_gitrev_gen.h.tmpl ) > "$OUTPUTDIR/fc_gitrev_gen.h.tmp" + +if ! test -f "$OUTPUTDIR/fc_gitrev_gen.h" || + ! cmp "$OUTPUTDIR/fc_gitrev_gen.h" "$OUTPUTDIR/fc_gitrev_gen.h.tmp" >/dev/null +then + mv "$OUTPUTDIR/fc_gitrev_gen.h.tmp" "$OUTPUTDIR/fc_gitrev_gen.h" +fi +rm -f "$OUTPUTDIR/fc_gitrev_gen.h.tmp" -- 2.34.1