v3:
Test if string is empty instead of testing directory
v2:
Do not use systemd macros. Copy systemd commands from fedora spec
Ramon Medeiros (2):
Issue #670: openSUSE: problem while building Kimchi
Issue #670: openSUSE: problem while building Kimchi
Makefile.am | 4 ++--
contrib/kimchi.spec.suse.in | 38 ++++++++++++++++++++++++++++++++++----
2 files changed, 36 insertions(+), 6 deletions(-)
--
2.1.0
Show replies by date
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(a)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(a)linux.vnet.ibm.com> 1.4.0
- Add man page for kimchid
--
2.1.0
Fix directory checking on Makefile.
Signed-off-by: Ramon Medeiros <ramonn(a)linux.vnet.ibm.com>
---
Makefile.am | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/Makefile.am b/Makefile.am
index 1a0c8e7..5a1ff70 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -115,11 +115,11 @@ ChangeLog:
fi
install-data-local:
- @if test -d $(systemdsystemunitdir) ; then \
+ @if test $(systemdsystemunitdir) ; then \
mkdir -p $(DESTDIR)/$(systemdsystemunitdir); \
$(INSTALL_DATA) contrib/kimchid.service.fedora
$(DESTDIR)/$(systemdsystemunitdir)/kimchid.service; \
else \
- mkdir -p $(DESTDIR)/etc/init.d/ \
+ mkdir -p $(DESTDIR)/etc/init.d/; \
$(INSTALL_DATA) contrib/kimchid.sysvinit $(DESTDIR)/etc/init.d/kimchid; \
chmod +x $(DESTDIR)/etc/init.d/kimchid; \
fi; \
--
2.1.0
Applied. Thanks.
Regards,
Aline Manera