flokati/genversion.sh

17 lines
474 B
Bash
Raw Normal View History

2016-01-20 19:55:30 +00:00
#!/bin/sh
2016-01-26 10:54:18 +00:00
VERSIONDIR="version"
2016-01-20 19:55:30 +00:00
VERSIONGO="version/version.go"
2016-01-26 10:54:18 +00:00
if [ ! -d "$VERSIONDIR" ]; then
mkdir $VERSIONDIR
fi
2016-01-20 19:55:30 +00:00
echo "package version" >$VERSIONGO
echo "" >>$VERSIONGO
echo "const (" >>$VERSIONGO
echo -n " FlokatiVersion = \"" >>$VERSIONGO
echo -n `git rev-parse --abbrev-ref HEAD` >>$VERSIONGO
echo "\"" >>$VERSIONGO
echo -n " FlokatiBuild = \"" >>$VERSIONGO
echo -n `git rev-list HEAD --count` >>$VERSIONGO
echo "\"" >>$VERSIONGO
echo ")" >>$VERSIONGO