123456789101112131415161718192021222324252627282930313233343536373839 |
- folder=$(echo $PWD) ;
- #echo $folder;
- filepath=$folder/../.git/refs/heads/master;
- #echo $filepath;
- VERSIONCODE="v1.0"
- if [ -f "$filepath" ]; then
- gitversion=$(cat $folder/../.git/refs/heads/master)
- # echo $gitversion
- VERSIONCODE=$gitversion
- else
- echo "not found file "$filepath
- VERSIONCODE="v1.0-develop"
- fi
- echo $VERSIONCODE
- VERSIONINFO=$(echo "#define IVVERSION \"$VERSIONCODE\"")
- echo $VERSIONINFO
- if [ ! -f "ivversion_def.h" ]; then
- echo "ivversion_def.h not exit."
- echo "#ifndef IVVERSION_DEF_H" >> ivversion_def.h
- echo "#define IVVERSION_DEF_H" >> ivversion_def.h
- echo $VERSIONINFO >> ivversion_def.h
- echo "#endif" >> ivversion_def.h
- else
- echo "file exist."
- OLDVERSIONINFO=$(sed -n "3p" ivversion_def.h)
- echo "old:"$OLDVERSIONINFO
- if [ ! "$OLDVERSIONINFO"x = "$VERSIONINFO"x ]; then
- cat /dev/null > ivversion_def.h
- echo "#ifndef IVVERSION_DEF_H" >> ivversion_def.h
- echo "#define IVVERSION_DEF_H" >> ivversion_def.h
- echo $VERSIONINFO >> ivversion_def.h
- echo "#endif" >> ivversion_def.h
- else
- echo "VERSION Not Change. so not need update ivversion_def.h"
- fi
- fi
|