drogon/get_version.sh

18 lines
371 B
Bash
Raw Normal View History

2018-05-28 14:34:47 +08:00
#!/bin/sh
2018-08-28 17:42:39 +08:00
GIT_VER=`git log|grep commit|wc -l|sed -e "s/^ *//"`
2018-05-28 14:34:47 +08:00
MD5=`git log|head -1|awk '{printf $2}'`
TMP_FILE=/tmp/version
2018-12-19 16:03:45 +08:00
echo "#define VERSION \"0.9.10.$GIT_VER\"" > ${TMP_FILE}
2018-10-02 20:02:43 +08:00
echo "#define VERSION_MD5 \"$MD5\"" >> ${TMP_FILE}
2018-05-28 14:34:47 +08:00
if [ ! -f $1 ];then
2018-10-02 20:02:43 +08:00
mv -f ${TMP_FILE} $1
2018-05-28 14:34:47 +08:00
else
2018-10-02 20:02:43 +08:00
diff ${TMP_FILE} $1
2018-05-28 14:34:47 +08:00
if [ $? -eq 1 ];then
2018-10-02 20:02:43 +08:00
mv -f ${TMP_FILE} $1
2018-10-02 19:44:33 +08:00
else
2018-10-02 20:02:43 +08:00
rm -f ${TMP_FILE}
2018-05-28 14:34:47 +08:00
fi
2018-05-30 15:55:27 +08:00
fi