summaryrefslogtreecommitdiffstats
path: root/contrib/rhel/build-netdata-rpm.sh
blob: b15b651b28237a9c54634ca34726cae75328c08f (plain)
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
#!/usr/bin/env bash

# docker run -it --rm centos:6.9 /bin/sh
# yum -y install rpm-build redhat-rpm-config yum-utils autoconf automake curl gcc git libmnl-devel libuuid-devel make pkgconfig zlib-devel

set -e

cd $(dirname $0)/../../
source "installer/functions.sh"

run ./autogen.sh
run ./configure --enable-maintainer-mode
run make dist

version=$(grep PACKAGE_VERSION < config.h | cut -d '"' -f 2)
if [ -z "${version}" ]
then
    echo >&2 "Cannot find netdata version."
    exit 1
fi

tgz="netdata-${version}.tar.gz"
if [ ! -f "${tgz}" ]
then
	echo >&2 "Cannot find the generated tar.gz file '${tgz}'"
	exit 1
fi

srpm=$(run rpmbuild -ts "${tgz}" | cut -d ' ' -f 2)
if [ -z "${srpm}" -o ! -f "${srpm}" ]
then
	echo >&2 "Cannot find the generated SRPM file '${srpm}'"
	exit 1
fi

run yum-builddep "${srpm}"

run rpmbuild --rebuild "${srpm}"

echo >&2 "All done!"