
openSuSE spec was not considering systemctl systems. So, a condition argument add systemd files if present. Also, change os version detection to the correct macros. Signed-off-by: Ramon Medeiros <ramonn@linux.vnet.ibm.com> --- contrib/kimchi.spec.suse.in | 40 ++++++++++++++++++++++++++++++++++++---- 1 file changed, 36 insertions(+), 4 deletions(-) diff --git a/contrib/kimchi.spec.suse.in b/contrib/kimchi.spec.suse.in index fa55cc5..f42d386 100644 --- a/contrib/kimchi.spec.suse.in +++ b/contrib/kimchi.spec.suse.in @@ -37,10 +37,16 @@ BuildRequires: libxslt-tools BuildRequires: openssl BuildRequires: python-lxml -%if 0%{?sles_version} == 11 +%if 0%{?suse_version} == 1100 Requires: python-ordereddict %endif +%if 0%{?suse_version} > 1140 +%global with_systemd 1 +BuildRequires: systemd-rpm-macros +%{?systemd_requires} +%endif + %description Web server application to manage KVM/Qemu virtual machines @@ -56,10 +62,30 @@ rm -rf %{buildroot} make DESTDIR=%{buildroot} install %post -chkconfig kimchid on +%if 0%{?with_systemd} + %service_add_post kimchid.service + /bin/systemctl daemon-reload >/dev/null 2>&1 || : +%else + chkconfig kimchid on +%endif +exit 0 + %preun -service kimchid stop +%if 0%{?with_systemd} + %service_del_preun kimchid.service +%else + service kimchid stop +%endif +exit 0 + + +%postun +%if 0%{?with_systemd} + %service_del_postun kimchid.service +%endif +exit 0 + %clean rm -rf $RPM_BUILD_ROOT @@ -94,7 +120,6 @@ rm -rf $RPM_BUILD_ROOT %{_sysconfdir}/kimchi/distros.d/ubuntu.json %{_sysconfdir}/kimchi/distros.d/gentoo.json %{_sysconfdir}/kimchi -%{_initrddir}/kimchid %{_sysconfdir}/kimchi/ %{_var}/lib/kimchi/debugreports/ %{_var}/lib/kimchi/screenshots/ @@ -105,6 +130,13 @@ rm -rf $RPM_BUILD_ROOT %{_localstatedir}/log/kimchi/ %{_mandir}/man8/kimchid.8.gz +%if 0%{?with_systemd} +%{_unitdir}/kimchid.service +%else +%{_initrddir}/kimchid +%endif + + %changelog * Thu Feb 26 2015 Frédéric Bonnard <frediz@linux.vnet.ibm.com> 1.4.0 - Add man page for kimchid -- 2.1.0