File tree 3 files changed +102
-0
lines changed
3 files changed +102
-0
lines changed Original file line number Diff line number Diff line change
1
+ #! /bin/bash
2
+ #
3
+ # 在xgo容器内部编译所有
4
+ # Author: alex
5
+ # Created Time: 2017年07月05日 星期三 11时43分21秒
6
+
7
+ export GOPATH=/var/www/
8
+
9
+ # 获取版本号
10
+ version=$1
11
+ targets=" linux/amd64,windows/*,darwin/*"
12
+ package=github.com/ibbd-dev/csv2es/csv2es
13
+
14
+ xgo -out csv2es-" $version " --targets=" $targets " " $package "
15
+
16
+ path=/var/www/build/elasticsearch/$version
17
+ if [ ! -d $path ]; then
18
+ mkdir -p $path
19
+ fi
20
+ mv /build/* $path
21
+
22
+ echo
23
+ echo " Finish!"
Original file line number Diff line number Diff line change
1
+ #! /bin/bash
2
+ #
3
+ # 在本地环境编译所有工具
4
+ # Author: alex
5
+ # Created Time: 2017年07月05日 星期三 11时47分58秒
6
+
7
+
8
+ # 判断容器是否已经创建
9
+ if
10
+ sudo docker ps -a| grep ' ibbd-xgo' ;
11
+ then
12
+ echo " ibbd-xgo is exist"
13
+ else
14
+ # 容器还没创建
15
+ echo ' begin to run ibbd-xgo:'
16
+ echo " 可能需要手动启动"
17
+ if
18
+ sudo docker run -ti --name=ibbd-xgo -v /var/www/:/var/www/ karalabe/xgo-latest /bin/bash
19
+ then
20
+ echo ' build success!'
21
+ exit 0
22
+ else
23
+ echo ' build failure!'
24
+ exit 1
25
+ fi
26
+ fi
27
+
28
+ # 判断容器是否正在运行
29
+ if
30
+ sudo docker ps| grep ' ibbd-xgo'
31
+ then
32
+ echo ' ibbd-xgo is running!'
33
+ else
34
+ if
35
+ sudo docker start ibbd-xgo;
36
+ then
37
+ echo ' ibbd-xgo start success!'
38
+ else
39
+ echo ' ibbd-xgo start failure!'
40
+ exit 1
41
+ fi
42
+ fi
43
+
44
+ if [ ! -d /var/www/build/elasticsearch ]; then
45
+ mkdir -p /var/www/build/elasticsearch
46
+ fi
47
+
48
+
49
+ version=` cat ./csv2es/cmd/root.go| grep " Version: " | cut -d' "' -f2`
50
+ if [ ${# version} = 0 ]; then
51
+ echo " version is empty"
52
+ exit 1
53
+ fi
54
+
55
+ echo " current version: $version "
56
+
57
+ # 执行编译
58
+ curr_path=$PWD
59
+ echo " Begin compile:"
60
+ sudo docker exec -ti ibbd-xgo " $curr_path /build_in_xgo.sh" $version
61
+
62
+ user=` whoami`
63
+ sudo chown -R $user :$user /var/www/build/elasticsearch
64
+
65
+ # 处理相关文件
66
+ path=/var/www/build/elasticsearch/$version
67
+ if [ ! -d $path ]; then
68
+ echo " $path is not existed!"
69
+ exit 1
70
+ fi
71
+ path=/var/www/build/elasticsearch/$version /examples
72
+ if [ ! -d $path ]; then
73
+ mkdir $path
74
+ fi
75
+ cp ./examples/test* $path /
76
+
77
+ # 本地编译
78
+ go get github.com/ibbd-dev/csv2es/csv2es
Original file line number Diff line number Diff line change
1
+ #
You can’t perform that action at this time.
0 commit comments