2.get_release.sh 5.1 KB
Newer Older
潘栩锋's avatar
潘栩锋 committed
1 2
#!/bin/bash
#获取git 最后一个 tag 的描述!!!!
潘栩锋's avatar
潘栩锋 committed
3
#LatestTag=$(git describe --tags `git rev-list --tags --max-count=1`)
潘栩锋's avatar
潘栩锋 committed
4

潘栩锋's avatar
潘栩锋 committed
5
#install_dir="和美安装包_"$LatestTag
6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23

version=$1
if [ -z "$version" ]; then
 echo "format error: version is empty"
 echo "Usage: ./2.get_release.sh 7.3.0"
 exit
fi

install_dir="和美安装包"

# 对 $install_dir_root 重命名为 ${install_dir_root}_v${version}_yyyyMMdd
# date参考 https://www.cnblogs.com/zuiyue_jing/p/12557430.html
suffix=$(date +%Y%m%d)
install_dir=${install_dir}_v${version}_${suffix}

install_dir_root=$install_dir


潘栩锋's avatar
潘栩锋 committed
24 25 26 27 28
if [ -e $install_dir ]; then
	rm -rf $install_dir
fi
#复制 install 到 测厚仪安装包
cp -rf install $install_dir
潘栩锋's avatar
潘栩锋 committed
29

30
#复制 版本描述
31
cp 版本描述.md $install_dir
潘栩锋's avatar
潘栩锋 committed
32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70

install_dir=$install_dir"/佛山市枫莱尔自动化技术有限公司/windows"

copy_to()
{
    src_dir=$1
    dest_dir=$2
    files=$3

	#检测文件夹是否存在
	#存在,删除全部数据,再新创建;
	#不存在,创建。
	if [ -e $dest_dir ]; then
        rm -rf $dest_dir
    fi

	mkdir -p $dest_dir
	
	echo 复制 $dest_dir

	for f in ${files[*]}; do
		file_path=$src_dir"/"$f
		cp -rf $file_path $dest_dir
		if [ $? != 0 ]; then
			echo 复制失败
			exit 1
		fi
	done
}

copy_to2()
{
    src_dir=$1
	dest_dir=$2
    files=$3

    src_dir=$src_dir"/bin/Debug" 
	dest_dir=$install_dir"/"$dest_dir
    copy_to $src_dir $dest_dir $files
71 72

	#第2步,复制 release_conf 对应的出厂默认配置文件
73 74 75 76 77
    src_dir="release_conf/"$2
	if [ ! -d $src_dir ]; then
      return
    fi
	src_dir=$src_dir"/*" 
78
	cp -Rf $src_dir $dest_dir 
潘栩锋's avatar
潘栩锋 committed
79 80 81 82 83 84 85
}

# Project.FLY.Thick.Blowing

src_dir="../Project.FLY.Thick.Blowing/FLY.Thick.Blowing.UI.Fix.Client"
dest_dir="FLY.Thick.Blowing.UI.Fix.Client"
files=(\
86
	"x64" "x86" \
潘栩锋's avatar
潘栩锋 committed
87
	"FLY.Thick.Blowing.UI.Fix.Client.exe" \
88
	"nlog.config" \
潘栩锋's avatar
潘栩锋 committed
89 90 91 92 93 94 95
	)
copy_to2 $src_dir $dest_dir $files


src_dir="../Project.FLY.Thick.Blowing/FLY.Thick.Blowing.UI.Fix.Server" 
dest_dir="FLY.Thick.Blowing.UI.Fix.Server" 
files=(\
96
	"x64" "x86" \
潘栩锋's avatar
潘栩锋 committed
97
	"FLY.Thick.Blowing.UI.Fix.Server.exe" \
98
	"nlog.config" \
潘栩锋's avatar
潘栩锋 committed
99 100 101 102 103 104 105
	)
copy_to2 $src_dir $dest_dir $files

#Project.FLY.FeedbackRenZiJia
src_dir="../Project.FLY.FeedbackRenZiJia/FLY.FeedbackRenZiJia.UI.Server"
dest_dir="FLY.FeedbackRenZiJia.UI.Server"
files=(\
106
	"x64" "x86" \
潘栩锋's avatar
潘栩锋 committed
107
	"FLY.FeedbackRenZiJia.UI.Server.exe" \
108
	"nlog.config" \
潘栩锋's avatar
潘栩锋 committed
109 110 111 112 113 114 115
	)
copy_to2 $src_dir $dest_dir $files

#Project.FLY.Weight
src_dir="../Project.FLY.Weight/FLY.Weight.UI.Server"
dest_dir="FLY.Weight.UI.Server"
files=(\
116
	"x64" "x86" \
潘栩锋's avatar
潘栩锋 committed
117
	"FLY.Weight.UI.Server.exe" \
118
	"nlog.config" \
潘栩锋's avatar
潘栩锋 committed
119 120 121
	)
copy_to2 $src_dir $dest_dir $files

潘栩锋's avatar
潘栩锋 committed
122 123 124 125
#Project.FLY.Weight2
src_dir="../Project.FLY.Weight2/FLY.Weight2.UI.Server"
dest_dir="FLY.Weight2.UI.Server"
files=(\
126
	"x64" "x86" \
潘栩锋's avatar
潘栩锋 committed
127
	"FLY.Weight2.UI.Server.exe" \
128
	"nlog.config" \
潘栩锋's avatar
潘栩锋 committed
129 130 131 132
	)
copy_to2 $src_dir $dest_dir $files


潘栩锋's avatar
潘栩锋 committed
133
#Project.FLY.Winder
134
src_dir="../Project.FLY.Winder/FLY.Winder.UI.Server"
潘栩锋's avatar
潘栩锋 committed
135 136
dest_dir="FLY.Winder.UI.Server"
files=(\
137
	"x64" "x86" \
潘栩锋's avatar
潘栩锋 committed
138
	"FLY.Winder.UI.Server.exe" \
139
	"nlog.config" \
潘栩锋's avatar
潘栩锋 committed
140 141 142 143 144 145 146
	)
copy_to2 $src_dir $dest_dir $files

#Project.FLY.IBC
src_dir="../Project.FLY.IBC/FLY.IBC.UI.Server"
dest_dir="FLY.IBC.UI.Server"
files=(\
147
	"x64" "x86" \
潘栩锋's avatar
潘栩锋 committed
148
	"FLY.IBC.UI.Server.exe" \
149
	"nlog.config" \
潘栩锋's avatar
潘栩锋 committed
150 151 152
	)
copy_to2 $src_dir $dest_dir $files

153

154

潘栩锋's avatar
潘栩锋 committed
155 156 157

# Project.FLY.Thick.BlowingScan

158 159 160
src_dir="../Project.FLY.Thick.BlowingScan/FLY.Thick.BlowingScan.UI.Client"
dest_dir="FLY.Thick.BlowingScan.UI.Client"
files=(\
161
	"x64" "x86" \
162
	"FLY.Thick.BlowingScan.UI.Client.exe" \
163
	"nlog.config" \
164 165 166 167 168 169 170
	)
copy_to2 $src_dir $dest_dir $files


src_dir="../Project.FLY.Thick.BlowingScan/FLY.Thick.BlowingScan.UI.Server" 
dest_dir="FLY.Thick.BlowingScan.UI.Server" 
files=(\
171
	"x64" "x86" \
172
	"FLY.Thick.BlowingScan.UI.Server.exe" \
173
	"nlog.config" \
174 175
	)
copy_to2 $src_dir $dest_dir $files
176 177 178 179 180 181 182 183 184


src_dir="../Project.FLY.Blowing.DbViewer/FLY.Blowing.DbViewer" 
dest_dir="FLY.Blowing.DbViewer" 
files=(\
	"x64" "x86" \
	"FLY.Blowing.DbViewer.exe" \
	)
copy_to2 $src_dir $dest_dir $files
潘栩锋's avatar
潘栩锋 committed
185

186 187 188 189 190 191 192 193
src_dir="../Project.FLY.DownBlowing/FLY.DownBlowing.UI.Server" 
dest_dir="FLY.DownBlowing.UI.Server" 
files=(\
	"x64" "x86" \
	"FLY.DownBlowing.UI.Server.exe" \
	)
copy_to2 $src_dir $dest_dir $files

194 195
# 修改 $install_dir_root/install.json 中的版本号
# 参考 https://www.cnblogs.com/thePeaceOftheLord/p/11107737.html
196 197
# 正则表达式 https://www.cnblogs.com/zd520pyx1314/p/6061339.html
sed -i 's/"InstallZipVersion":".*"/"InstallZipVersion":"'${version}'"/g' ${install_dir_root}/install.json
198 199 200 201 202 203 204 205 206 207 208 209

# 复制 $install_dir_root/install.json 到 $install_dir/FLY.Thick.Blowing.UI.Fix.Client/update
cp ${install_dir_root}/install.json $install_dir/FLY.Thick.Blowing.UI.Fix.Client/update
cp ${install_dir_root}/install.json $install_dir/FLY.Thick.BlowingScan.UI.Client/update

fileName7z=${install_dir_root}.7z
if [ -e $fileName7z ]; then
	rm $fileName7z
fi

# 进入安装包内 用7z压缩
cd ${install_dir_root}
潘栩锋's avatar
潘栩锋 committed
210
"C:\Program Files\7-Zip\7z.exe" a ../${fileName7z} ./*
潘栩锋's avatar
潘栩锋 committed
211

212 213 214 215 216 217
cd ..

# 修改 hemeiInstallZipVersionInfo.json
sed -i 's/"InstallZipVersion":".*"/"InstallZipVersion":"'${version}'"/g' hemeiInstallZipVersionInfo.json
sed -i 's/"InstallZipUrl":".*"/"InstallZipUrl":"http:\/\/server.flyautomation.net:8889\/download\/'${fileName7z}'"/g' hemeiInstallZipVersionInfo.json

潘栩锋's avatar
潘栩锋 committed
218
echo 完成