-
Notifications
You must be signed in to change notification settings - Fork 19
/
Copy pathbuild.sh
executable file
·32 lines (24 loc) · 885 Bytes
/
build.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
#!/bin/bash
echo Target version: $BEATS_VERSION
go get github.com/magefile/mage
BRANCH=$(echo $BEATS_VERSION | awk -F \. {'print $1 "." $2'})
echo Target branch: $BRANCH
if [ ! -d "$GOPATH/src/github.com/elastic/beats" ]; then go get -v github.com/elastic/beats; fi
cd $GOPATH/src/github.com/elastic/beats
git checkout $BRANCH
IFS=","
BEATS_ARRAY=($BEATS)
for BEAT in "${BEATS_ARRAY[@]}"
do
# build
cd $GOPATH/src/github.com/elastic/beats/$BEAT
make
cp $BEAT /build
# package
DOWNLOAD=$BEAT-$BEATS_VERSION-linux-x86.tar.gz
if [ ! -e $DOWNLOAD ]; then wget --no-verbose https://artifacts.elastic.co/downloads/beats/$BEAT/$DOWNLOAD; fi
tar xf $DOWNLOAD
cp $BEAT $BEAT-$BEATS_VERSION-linux-x86
tar zcf $BEAT-$BEATS_VERSION-linux-arm$GOARM.tar.gz $BEAT-$BEATS_VERSION-linux-x86
cp $BEAT-$BEATS_VERSION-linux-arm$GOARM.tar.gz /build
done