script: Implemented a helper script to help build include/version.h
This commit is contained in:
parent
9a0e4b4f23
commit
e388fbbb2c
|
@ -0,0 +1,18 @@
|
||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
if ! command -v git &>/dev/null; then
|
||||||
|
echo "Git not found, assuming up to date include/version.h"
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
if ! git rev-parse HEAD &>/dev/null; then
|
||||||
|
echo "No git repository found, not updating include/version.h"
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
version=`git describe --always --dirty --tags`
|
||||||
|
header="#define FIRMWARE_VERSION \"$version\""
|
||||||
|
|
||||||
|
if [ "`cat include/version.h 2>/dev/null`" != "$header" ]; then
|
||||||
|
echo $header > include/version.h
|
||||||
|
fi
|
Loading…
Reference in New Issue