drogon/get_version.sh

16 lines
337 B
Bash
Raw Normal View History

2018-05-28 06:34:47 +00:00
#!/bin/sh
2018-08-28 09:42:39 +00:00
GIT_VER=`git log|grep commit|wc -l|sed -e "s/^ *//"`
2018-05-28 06:34:47 +00:00
MD5=`git log|head -1|awk '{printf $2}'`
TMP_FILE=/tmp/version
2018-05-30 07:55:27 +00:00
echo "#define VERSION \"0.9.0.$GIT_VER\"" > $TMP_FILE
2018-05-28 06:34:47 +00:00
echo "#define VERSION_MD5 \"$MD5\"" >> $TMP_FILE
if [ ! -f $1 ];then
mv -f $TMP_FILE $1
else
diff $TMP_FILE $1
if [ $? -eq 1 ];then
mv -f $TMP_FILE $1
fi
2018-05-30 07:55:27 +00:00
fi