forked from erikkugel/SlackBuilds
-
Notifications
You must be signed in to change notification settings - Fork 0
/
metricbeat.SlackBuild
executable file
·42 lines (37 loc) · 1.58 KB
/
metricbeat.SlackBuild
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
#!/bin/bash
#
# Ernest Kugel, 2019
PRGNAM='metricbeat'
VERSION='6.5.4'
APP_URL="https://artifacts.elastic.co/downloads/metricbeat/${PRGNAM}-${VERSION}-$(uname -s | tr '[:upper:]' '[:lower:]')-$(uname -m).tar.gz"
BUILD_DIR="/tmp/SlackBuild-${PRGNAM}-$(date +%s)"
TAG='1_x'
set -e
# Download
if ! [ -f ${PRGNAM}-${VERSION}-$(uname -s | tr '[:upper:]' '[:lower:]')-$(uname -m).tar.gz ]; then
wget ${APP_URL}
fi
mkdir -v -p ${BUILD_DIR}/install\
${BUILD_DIR}/etc/rc.d\
${BUILD_DIR}/tmp
tar -v -x -z -C ${BUILD_DIR}/tmp -f ./${PRGNAM}-${VERSION}-$(uname -s | tr '[:upper:]' '[:lower:]')-$(uname -m).tar.gz
cp -v ./slack-desc ${BUILD_DIR}/install/slack-desc
cp -v ./doinst.sh ${BUILD_DIR}/install/doinst.sh
cp -v ./rc.metricbeat ${BUILD_DIR}/etc/rc.d
# Stage
cd ${BUILD_DIR}/tmp/${PRGNAM}-${VERSION}-$(uname -s | tr '[:upper:]' '[:lower:]')-$(uname -m)
mkdir -v -p ${BUILD_DIR}/usr/bin ${BUILD_DIR}/etc/metricbeat ${BUILD_DIR}/usr/share/metricbeat
cp -v -a metricbeat ${BUILD_DIR}/usr/bin
cp -v -a metricbeat.yml ${BUILD_DIR}/etc/metricbeat/metricbeat.yml.new
cp -v -a fields.yml ${BUILD_DIR}/etc/metricbeat/fields.yml.new
cp -v -a modules.d ${BUILD_DIR}/etc/metricbeat/modules.d
cp -v -a LICENSE.txt ${BUILD_DIR}/usr/share/metricbeat
cp -v -a NOTICE.txt ${BUILD_DIR}/usr/share/metricbeat
cp -v -a README.md ${BUILD_DIR}/usr/share/metricbeat
cp -v -a metricbeat.reference.yml ${BUILD_DIR}/usr/share/metricbeat
cp -v -a kibana ${BUILD_DIR}/usr/share/metricbeat
# Create package
cd ${BUILD_DIR}
rm -r -f tmp
/sbin/makepkg -l y -c n /tmp/${PRGNAM}-${VERSION}-$(uname -m)-${TAG}.txz
rm -v -r -f ${BUILD_DIR}