@cryptotaxi247 / netdata-1 / commits / a8ff719ef

Spec: OpenSUSE support

Ben Reedy committed Dec 10, 2016 at 23:59 UTC a8ff719ef56db0d56e1dc022f2a0827ffc6d437b
1 file changed +24 -7
netdata.spec.in
+24 -7
@@ -1,4 +1,15 @@
1 %define contentdir %{_datadir}/netdata
2 +%if 0%{?suse_version}
3 +%define distro_post %service_add_post netdata.service
4 +%define distro_preun %service_del_preun netdata.service
5 +%define distro_postun %service_del_postun netdata.service
6 +%define distro_buildrequires BuildRequires:\ systemd-rpm-macros
7 +%else
8 +%define distro_post %systemd_post netdata.service
9 +%define distro_preun %systemd_preun netdata.service
10 +%define distro_postun %systemd_postun_with_restart netdata.service
11 +%define distro_buildrequires %{nil}
12 +%endif
13
14 # This is temporary and should eventually be resolved. This bypasses
15 # the default rhel __os_install_post which throws a python compile
@@ -10,7 +21,7 @@
21 %bcond_without systemd # systemd
22 %bcond_with nfacct # build with nfacct plugin
23
13 -%if 0%{?fedora} || 0%{?rhel} >= 7
24 +%if 0%{?fedora} || 0%{?rhel} >= 7 || 0%{?suse_version} >= 1140
25 %else
26 %undefine with_systemd
27 %endif
@@ -23,6 +34,7 @@ License: GPL v3+
34 Group: Applications/System
35 Source0: http://firehol.org/download/netdata/releases/v@PACKAGE_VERSION@/%{name}-@PACKAGE_VERSION@.tar.xz
36 URL: http://my-netdata.io/
37 +%distro_buildrequires
38 BuildRequires: pkgconfig
39 BuildRequires: xz
40 BuildRequires: zlib-devel
@@ -42,9 +54,13 @@ Requires(pre): /usr/sbin/groupadd
54 Requires(pre): /usr/sbin/useradd
55
56 %if %{with systemd}
57 +%if 0%{?suse_version}
58 +%{?systemd_requires}
59 +%else
60 Requires(preun): systemd-units
61 Requires(postun): systemd-units
62 Requires(post): systemd-units
63 +%endif
64 %else
65 Requires(post): chkconfig
66 %endif
@@ -79,9 +95,7 @@ rm -rf $RPM_BUILD_ROOT
95 find $RPM_BUILD_ROOT -name .keep -print0 | xargs --null --no-run-if-empty rm
96
97 install -m 644 -p system/netdata.conf $RPM_BUILD_ROOT%{_sysconfdir}/%{name}
82 -
83 -mkdir -p $RPM_BUILD_ROOT%{_sysconfdir}/logrotate.d
84 -install -m 644 -p system/netdata.logrotate $RPM_BUILD_ROOT%{_sysconfdir}/logrotate.d/%{name}
98 +install -Dm 644 -p system/netdata.logrotate $RPM_BUILD_ROOT%{_sysconfdir}/logrotate.d/%{name}
99
100 %if %{with systemd}
101 install -d $RPM_BUILD_ROOT%{_unitdir}
@@ -101,13 +115,13 @@ install -m755 system/netdata-init-d \
115 -s /sbin/nologin -r -d %{contentdir} netdata 2> /dev/null || :
116
117 %post
104 -%systemd_post netdata.service
118 +o%distro_post
119
120 %preun
107 -%systemd_preun netdata.service
121 +%distro_preun
122
123 %postun
110 -%systemd_postun_with_restart netdata.service
124 +%distro_postun
125 %else
126 %pre
127 # Add the "netdata" user
@@ -150,6 +164,9 @@ rm -rf $RPM_BUILD_ROOT
164 %defattr(-,root,root)
165
166 %dir %{_sysconfdir}/%{name}
167 +%dir %{_sysconfdir}/%{name}/health.d
168 +%dir %{_sysconfdir}/%{name}/python.d
169 +
170 %config(noreplace) %{_sysconfdir}/%{name}/*.conf
171 #%config(noreplace) %{_sysconfdir}/%{name}/charts.d/*.conf
172 %config(noreplace) %{_sysconfdir}/%{name}/health.d/*.conf