summaryrefslogtreecommitdiffstats
path: root/packaging/repoconfig/build-rpm.sh
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2021-12-01 06:15:04 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2021-12-01 06:15:04 +0000
commite970e0b37b8bd7f246feb3f70c4136418225e434 (patch)
tree0b67c0ca45f56f2f9d9c5c2e725279ecdf52d2eb /packaging/repoconfig/build-rpm.sh
parentAdding upstream version 1.31.0. (diff)
downloadnetdata-e970e0b37b8bd7f246feb3f70c4136418225e434.tar.xz
netdata-e970e0b37b8bd7f246feb3f70c4136418225e434.zip
Adding upstream version 1.32.0.upstream/1.32.0
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'packaging/repoconfig/build-rpm.sh')
-rwxr-xr-xpackaging/repoconfig/build-rpm.sh26
1 files changed, 26 insertions, 0 deletions
diff --git a/packaging/repoconfig/build-rpm.sh b/packaging/repoconfig/build-rpm.sh
new file mode 100755
index 000000000..6c07c6619
--- /dev/null
+++ b/packaging/repoconfig/build-rpm.sh
@@ -0,0 +1,26 @@
+#!/bin/sh
+
+prefix='/root/rpmbuild'
+
+if command -v dnf > /dev/null ; then
+ dnf distro-sync -y --nodocs || exit 1
+ dnf install -y --nodocs --setopt=install_weak_deps=False rpm-build || exit 1
+elif command -v yum > /dev/null ; then
+ yum distro-sync -y || exit 1
+ yum install -y rpm-build || exit 1
+elif command -v zypper > /dev/null ; then
+ zypper update -y || exit 1
+ zypper install -y rpm-build || exit 1
+ prefix="/usr/src/packages"
+fi
+
+mkdir -p "${prefix}/BUILD" "${prefix}/RPMS" "${prefix}/SRPMS" "${prefix}/SPECS" "${prefix}/SOURCES" || exit 1
+cp -a /netdata/packaging/repoconfig/netdata-repo.spec "${prefix}/SPECS" || exit 1
+cp -a /netdata/packaging/repoconfig/* "${prefix}/SOURCES/" || exit 1
+
+rpmbuild -bb --rebuild "${prefix}/SPECS/netdata-repo.spec" || exit 1
+
+[ -d /netdata/artifacts ] || mkdir -p /netdata/artifacts
+find "${prefix}/RPMS/" -type f -name '*.rpm' -exec cp '{}' /netdata/artifacts \; || exit 1
+
+chown -R --reference=/netdata /netdata/artifacts