@cryptotaxi247 / netdata-1 / commits / 8c8bc8dc2

added script to build RPM

Costa Tsaousis (ktsaou) committed Jan 3, 2018 at 17:14 UTC 8c8bc8dc24042bf17727cafe476b6f881cbd1a7c
2 files changed +41
contrib/Makefile.am
+1
@@ -17,6 +17,7 @@ dist_noinst_DATA = \
17 debian/netdata.service \
18 debian/changelog \
19 debian/netdata.postrm \
20 + rhel/build-netdata-rpm.sh \
21 $(NULL)
22
23 dist_noinst_SCRIPTS = \
contrib/rhel/build-netdata-rpm.sh new
+40
@@ -0,0 +1,40 @@
1 +#!/usr/bin/env bash
2 +
3 +# docker run -it --rm centos:6.9 /bin/sh
4 +# yum -y install rpm-build redhat-rpm-config yum-utils autoconf automake curl gcc git libmnl-devel libuuid-devel make pkgconfig zlib-devel
5 +
6 +set -e
7 +
8 +cd $(dirname $0)/../../
9 +source "installer/functions.sh"
10 +
11 +run ./autogen.sh
12 +run ./configure --enable-maintainer-mode
13 +run make dist
14 +
15 +version=$(grep PACKAGE_VERSION < config.h | cut -d '"' -f 2)
16 +if [ -z "${version}" ]
17 +then
18 + echo >&2 "Cannot find netdata version."
19 + exit 1
20 +fi
21 +
22 +tgz="netdata-${version}.tar.gz"
23 +if [ ! -f "${tgz}" ]
24 +then
25 + echo >&2 "Cannot find the generated tar.gz file '${tgz}'"
26 + exit 1
27 +fi
28 +
29 +srpm=$(run rpmbuild -ts "${tgz}" | cut -d ' ' -f 2)
30 +if [ -z "${srpm}" -o ! -f "${srpm}" ]
31 +then
32 + echo >&2 "Cannot find the generated SRPM file '${srpm}'"
33 + exit 1
34 +fi
35 +
36 +run yum-builddep "${srpm}"
37 +
38 +run rpmbuild --rebuild "${srpm}"
39 +
40 +echo >&2 "All done!"