Last active
July 11, 2016 11:04
-
-
Save agustik/5bbb5dc19a2a7b9bb1db9f64fadb6286 to your computer and use it in GitHub Desktop.
Netdata Spec file
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
%define netdata_user netdata | |
%define netdata_group %{netdata_user} | |
%define netdata_logdir %{_localstatedir}/log/netdata | |
%define netdata_confdir %{_sysconfdir}/netdata | |
%define netdata_datadir %{_datadir}/netdata | |
%define netdata_web %{_datadir}/netdata/web | |
%define netdata_cache %{_localstatedir}/cache/netdata | |
%define netdata_plugins %{_libexecdir}/netdata | |
%define netdata_bin %{_sbindir}/netdata | |
# distribution specific definitions | |
%define use_systemd (0%{?fedora} && 0%{?fedora} >= 18) || (0%{?rhel} && 0%{?rhel} >= 7) || (0%{?suse_version} == 1315) | |
%if 0%{?rhel} == 7 | |
Group: System Environment/Daemons | |
Requires: systemd | |
BuildRequires: systemd | |
%endif | |
Name: netdata | |
Version: {{version}} | |
Release: %{?release_suffix}%{?dist} | |
License: GPLv2+ | |
URL: http://firehol.org | |
Summary: Linux real time system monitoring, over the web | |
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) | |
BuildRequires: libmnl-devel libnetfilter_queue-devel zlib-devel gcc make autoconf automake pkgconfig libuuid-devel | |
Requires: libmnl | |
Requires: libnetfilter_queue | |
Requires: zlib | |
Source0: %{name}-%{version}.tar.gz | |
Source1: %{name}-systemd | |
Source2: %{name}.conf | |
Source3: %{name}.init | |
%description | |
Linux real time system monitoring, over the web! | |
%pre | |
getent group netdata > /dev/null || groupadd -r netdata | |
getent passwd netdata > /dev/null || useradd -r -g netdata -c netdata -s /sbin/nologin -d / netdata | |
%prep | |
%setup -q -n %{name}-%{version} | |
%build | |
pwd && ls | |
export DESTDIR=%{buildroot} | |
./autogen.sh | |
./configure \ | |
--prefix="/usr" \ | |
--sysconfdir="/etc" \ | |
--localstatedir="/var" \ | |
--with-zlib --with-math --with-user=netdata \ | |
CFLAGS="" | |
%install | |
rm -rf %{buildroot} | |
make install DESTDIR=%{buildroot} | |
find "%{buildroot}" -name .keep -exec rm {} \; | |
#%{__install} -p -D -m 0644 %{SOURCE1} %{buildroot}%{_sysconfdir}/sysconfig/%{name} | |
#%{__install} -p -m 0644 %{SOURCE2} %{buildroot}%{netdata_confdir} | |
cp %{SOURCE2} %{buildroot}%{netdata_confdir} | |
%if %{use_systemd} | |
%{__mkdir} -p %{buildroot}%{_unitdir} | |
cp %{SOURCE1} %{buildroot}%{_unitdir}/%{name}.service | |
%else | |
%{__mkdir} -p %{buildroot}%{_initrddir} | |
%{__install} -m755 %{SOURCE2} \ | |
$RPM_BUILD_ROOT%{_initrddir}/%{name} | |
%endif | |
%clean | |
rm -rf %{buildroot} | |
%files | |
%defattr(-,root,root,-) | |
%{netdata_datadir}/ | |
#%{netdata_logdir} | |
#%{netdata_cache} | |
%{netdata_plugins} | |
%{netdata_bin} | |
#%dir %{netdata_confdir} | |
#%dir %{netdata_logdir} | |
#%dir %{netdata_cache} | |
#%dir %{netdata_web} | |
#%dir %{netdata_plugins}/charts.d | |
#%dir %{netdata_plugins}/node.d | |
#%dir %{netdata_plugins}/plugins.d | |
%attr(-,%{netdata_user},%{netdata_group}) %config(noreplace) %{netdata_confdir}/*.conf | |
%attr(-,%{netdata_user},%{netdata_group}) %{netdata_web} | |
%attr(-,%{netdata_user},%{netdata_group}) %dir %{netdata_confdir} | |
%attr(-,%{netdata_user},%{netdata_group}) %dir %{netdata_cache} | |
%attr(-,%{netdata_user},%{netdata_group}) %dir %{netdata_logdir} | |
%if %{use_systemd} | |
%{_unitdir}/%{name}.service | |
%else | |
%{_initrddir}/%{name} | |
%endif | |
%post | |
# Register the netdata service | |
if [ $1 -eq 1 ]; then | |
%if %{use_systemd} | |
/usr/bin/systemctl preset netdata.service >/dev/null 2>&1 ||: | |
%else | |
/sbin/chkconfig --add netdata | |
%endif | |
fi | |
%changelog |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment