forked from stagemonitor/stagemonitor-kibana
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.sh
executable file
·48 lines (37 loc) · 1.33 KB
/
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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
#!/usr/bin/env bash
set -o errexit
set -o nounset
echo "building archive ..."
if [ -z "${1-}" ] || [ -z "${2-}" ]; then
echo "Usage: ./build.sh KIBANA_VERSION PLUGIN_VERSION"
exit
else
VERSION_KIBANA="$1"
VERSION_PLUGIN="$2"
ARRAY_VERSION_KIBANA=(${VERSION_KIBANA//./ })
fi;
FILENAME=/tmp/stagemonitor-kibana-${VERSION_PLUGIN}-${VERSION_KIBANA}.zip
echo "building archive for $VERSION_KIBANA ..."
BASEDIR=$(dirname "$0")
rm -rf /tmp/kibana &> /dev/null || true
rm $FILENAME &> /dev/null || true
mkdir /tmp/kibana
cp -r "$BASEDIR" /tmp/kibana/stagemonitor-kibana
if [ ${ARRAY_VERSION_KIBANA[0]} -ge 6 ]; then
echo "use Kibana 6 template"
sed "s/@@VERSION@@/$VERSION_KIBANA/g" /tmp/kibana/stagemonitor-kibana/package.json.template6 > /tmp/kibana/stagemonitor-kibana/package.json
else
echo "use Kibana 5 template"
sed "s/@@VERSION@@/$VERSION_KIBANA/g" /tmp/kibana/stagemonitor-kibana/package.json.template > /tmp/kibana/stagemonitor-kibana/package.json
fi;
# clean unneeded data
rm -rf /tmp/kibana/stagemonitor-kibana/.git
rm -rf /tmp/kibana/stagemonitor-kibana/tests
rm -rf /tmp/kibana/stagemonitor-kibana/package.json.template*
cd /tmp
zip -r $FILENAME kibana > /dev/null
echo ""
echo "The built archive is here: $FILENAME"
echo "Install it in kibana with:"
echo ""
echo "\$KIBANA_DIR/bin/kibana-plugin install file://$FILENAME"