[Kimchi-devel] [PATCH 1/2] Issue #670: openSUSE: problem while building Kimchi

Ramon Medeiros ramonn at linux.vnet.ibm.com
Mon Jun 29 18:55:06 UTC 2015


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 at linux.vnet.ibm.com>
---
 contrib/kimchi.spec.suse.in | 38 ++++++++++++++++++++++++++++++++++----
 1 file changed, 34 insertions(+), 4 deletions(-)

diff --git a/contrib/kimchi.spec.suse.in b/contrib/kimchi.spec.suse.in
index fa55cc5..54228ae 100644
--- a/contrib/kimchi.spec.suse.in
+++ b/contrib/kimchi.spec.suse.in
@@ -37,10 +37,14 @@ 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
+%endif
+
 %description
 Web server application to manage KVM/Qemu virtual machines
 
@@ -56,10 +60,30 @@ rm -rf %{buildroot}
 make DESTDIR=%{buildroot} install
 
 %post
-chkconfig kimchid on
+%if 0%{?with_systemd}
+    /bin/systemctl enable kimchid.service >/dev/null 2>&1 || :
+    /bin/systemctl daemon-reload >/dev/null 2>&1 || :
+%else
+    chkconfig kimchid on
+%endif
+exit 0
+
 
 %preun
-service kimchid stop
+%if 0%{?with_systemd}
+    /bin/systemctl --no-reload disable kimchid.service > /dev/null 2>&1 || :
+    /bin/systemctl stop kimchid.service > /dev/null 2>&1 || :
+%else
+    service kimchid stop
+%endif
+exit 0
+
+
+%postun
+%if 0%{?with_systemd}
+    /bin/systemctl try-restart kimchid.service >/dev/null 2>&1 || :
+%endif
+exit 0
 
 %clean
 rm -rf $RPM_BUILD_ROOT
@@ -94,7 +118,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 +128,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 at linux.vnet.ibm.com> 1.4.0
 - Add man page for kimchid
-- 
2.1.0




More information about the Kimchi-devel mailing list