summaryrefslogtreecommitdiffstats
path: root/contrib
diff options
context:
space:
mode:
authorCosta Tsaousis (ktsaou) <costa@tsaousis.gr>2018-01-03 17:14:56 +0200
committerCosta Tsaousis (ktsaou) <costa@tsaousis.gr>2018-01-03 17:14:56 +0200
commit8c8bc8dc24042bf17727cafe476b6f881cbd1a7c (patch)
tree2f3f47a9cab1ceba2fea57b1c4abc6582bb0c67e /contrib
parentdeb4b2518e55ca3550dcffccf5af4f1bdc2b264d (diff)
added script to build RPM
Diffstat (limited to 'contrib')
-rw-r--r--contrib/Makefile.am1
-rw-r--r--contrib/rhel/build-netdata-rpm.sh40
2 files changed, 41 insertions, 0 deletions
diff --git a/contrib/Makefile.am b/contrib/Makefile.am
index 15e9c00089..d9250179b4 100644
--- a/contrib/Makefile.am
+++ b/contrib/Makefile.am
@@ -17,6 +17,7 @@ dist_noinst_DATA = \
debian/netdata.service \
debian/changelog \
debian/netdata.postrm \
+ rhel/build-netdata-rpm.sh \
$(NULL)
dist_noinst_SCRIPTS = \
diff --git a/contrib/rhel/build-netdata-rpm.sh b/contrib/rhel/build-netdata-rpm.sh
new file mode 100644
index 0000000000..b15b651b28
--- /dev/null
+++ b/contrib/rhel/build-netdata-rpm.sh
@@ -0,0 +1,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!"