File tree Expand file tree Collapse file tree 1 file changed +38
-17
lines changed Expand file tree Collapse file tree 1 file changed +38
-17
lines changed Original file line number Diff line number Diff line change 3
3
#
4
4
5
5
RELEASE_VERSION=
6
+ buildpath=
7
+ builddir=
8
+
9
+ function setuptree() {
10
+ mkdir -p $buildpath
11
+ rm -rf ${buildpath:? } /*
12
+ b=$( mktemp -d $buildpath /gh-ostXXXXXX ) || return 1
13
+ mkdir -p $b /gh-ost
14
+ mkdir -p $b /gh-ost/usr/bin
15
+ echo $b
16
+ }
6
17
7
18
function build {
8
- osname=$1
9
- osshort=$2
10
- GOOS=$3
11
- GOARCH=$4
19
+ osname=$1
20
+ osshort=$2
21
+ GOOS=$3
22
+ GOARCH=$4
12
23
13
- if ! go version | egrep -q ' go(1[.]9|1[.]1[0-9])' ; then
14
- echo " go version is too low. Must use 1.9 or above"
15
- exit 1
16
- fi
24
+ builddir=$( setuptree)
25
+
26
+
27
+ if ! go version | egrep -q ' go(1[.]9|1[.]1[0-9])' ; then
28
+ echo " go version is too low. Must use 1.9 or above"
29
+ exit 1
30
+ fi
17
31
18
- echo " Building ${osname} binary"
19
- export GOOS
20
- export GOARCH
21
- go build -ldflags " $ldflags " -o $buildpath /$target go/cmd/gh-ost/main.go
32
+ echo " Building ${osname} binary"
33
+ export GOOS
34
+ export GOARCH
35
+ go build -ldflags " $ldflags " -o $buildpath /$target go/cmd/gh-ost/main.go
22
36
23
- if [ $? -ne 0 ]; then
24
- echo " Build failed for ${osname} "
25
- exit 1
26
- fi
37
+ if [ $? -ne 0 ]; then
38
+ echo " Build failed for ${osname} "
39
+ exit 1
40
+ fi
27
41
28
- (cd $buildpath && tar cfz ./gh-ost-binary-${osshort} -${timestamp} .tar.gz $target )
42
+ (cd $buildpath && tar cfz ./gh-ost-binary-${osshort} -${timestamp} .tar.gz $target )
43
+
44
+ if [ " $GOOS " == " linux" ] ; then
45
+ echo " Creating Distro full packages"
46
+ cp $buildpath /$target $builddir /gh-ost/usr/bin
47
+ fpm -v " ${RELEASE_VERSION} " --epoch 1 -f -s dir -n gh-ost -m shlomi-noach --description " GitHub's Online Schema Migrations for MySQL " --url " https://github.com/github/gh-ost" --vendor " GitHub" --license " Apache 2.0" -C $builddir /gh-ost --prefix=/ -t rpm .
48
+ fpm -v " ${RELEASE_VERSION} " --epoch 1 -f -s dir -n gh-ost -m shlomi-noach --description " GitHub's Online Schema Migrations for MySQL " --url " https://github.com/github/gh-ost" --vendor " GitHub" --license " Apache 2.0" -C $builddir /gh-ost --prefix=/ -t deb --deb-no-default-config-files .
49
+ fi
29
50
}
30
51
31
52
main () {
You can’t perform that action at this time.
0 commit comments