galmon/update-git-hash-if-necessary

18 lines
284 B
Bash
Executable File

#!/bin/sh
HASH=$(git describe --always --dirty=+ | tr -d '\n')
echo \#define GIT_HASH \"$HASH\" > githash.h.tmp
echo $HASH > githash
cmp -s githash.h githash.h.tmp > /dev/null
if [ "$?" -ne "0" ]
then
mv githash.h.tmp githash.h
echo updated githash.h
else
rm githash.h.tmp
fi