Make install now will install firewalld and systemctl service. Also,
it will create base file structure to run kimchi (what was being created
at rpm spec).
---
Makefile.am | 50 +++++++++++++++++++++++++++----------------
configure.ac | 9 ++++++++
contrib/kimchi.spec.fedora.in | 16 --------------
contrib/kimchi.spec.suse.in | 18 ----------------
4 files changed, 41 insertions(+), 52 deletions(-)
diff --git a/Makefile.am b/Makefile.am
index 91a0fa2..46b0b5b 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -115,27 +115,41 @@ ChangeLog:
fi
install-data-local:
- @if test -d /usr/lib/systemd/system/ ; then \
- $(INSTALL_DATA) contrib/kimchid.service.fedora /usr/lib/systemd/system/kimchid.service;
\
- systemctl daemon-reload; \
- elif test -d /etc/systemd/system; then \
- $(INSTALL_DATA) contrib/kimchid.service.fedora /etc/systemd/system/kimchid.service; \
- systemctl daemon-reload; \
- else \
- $(INSTALL_DATA) contrib/kimchid.sysvinit /etc/init.d/kimchid; \
- chmod +x /etc/init.d/kimchid; \
- fi
+ @if test -d $(systemdsystemunitdir) ; then \
+ mkdir -p $(DESTDIR)/$(systemdsystemunitdir); \
+ $(INSTALL_DATA) contrib/kimchid.service.fedora
$(DESTDIR)/$(systemdsystemunitdir)/kimchid.service; \
+ else \
+ mkdir -p $(DESTDIR)/etc/init.d/ \
+ $(INSTALL_DATA) contrib/kimchid.sysvinit $(DESTDIR)/etc/init.d/kimchid; \
+ chmod +x $(DESTDIR)/etc/init.d/kimchid; \
+ fi; \
+ if test -d /usr/lib/firewalld/services/; then \
+ mkdir -p $(DESTDIR)/usr/lib/firewalld/services/; \
+ $(INSTALL_DATA) src/firewalld.xml $(DESTDIR)/usr/lib/firewalld/services/kimchid.xml; \
+ fi; \
+ mkdir -p $(DESTDIR)/var/lib/kimchi/{debugreports,screenshots,vnc-tokens,isos}
+ touch $(DESTDIR)/var/lib/kimchi/objectstore
+ mkdir -p $(DESTDIR)/var/log/kimchi/
+ touch $(DESTDIR)/var/log/kimchi/kimchi-access.log
+ touch $(DESTDIR)/var/log/kimchi/kimchi-error.log
+ mkdir -p $(DESTDIR)/etc/kimchi/
+ touch $(DESTDIR)/etc/nginx/conf.d/kimchi.conf
uninstall-local:
- @if test -f /usr/lib/systemd/system/kimchid.service; then \
- $(RM) /usr/lib/systemd/system/kimchid.service; \
- systemctl daemon-reload; \
- elif test -f /etc/systemd/system/kimchid.service; then \
- $(RM) /etc/systemd/system/kimchid.service; \
+ @if test -f $(systemdsystemunitdir)/kimchid.service; then \
+ $(RM) $(DESTDIR)/$(systemdsystemunitdir)/kimchid.service; \
elif test -f /etc/init.d/kimchid; then \
- $(RM) /etc/init.d/kimchid; \
- fi
-
+ $(RM) $(DESTDIR)/etc/init.d/kimchid; \
+ $(RM) $(DESTDIR)/etc/init/kimchi.conf; \
+ fi; \
+ if test -d /usr/lib/firewalld/services/; then \
+ $(RM) $(DESTDIR)/usr/lib/firewalld/services/kimchid.xml; \
+ fi; \
+ $(RM) -rf $(DESTDIR)/var/lib/kimchi
+ $(RM) -rf $(DESTDIR)/var/log/kimchi
+ $(RM) -rf $(DESTDIR)/etc/kimchi
+ $(RM) $(DESTDIR)/etc/nginx/conf.d/kimchi.conf
+
VERSION:
@if test -d .git; then \
git describe --abbrev=0 > $@; \
diff --git a/configure.ac b/configure.ac
index f5091b8..0261b5f 100644
--- a/configure.ac
+++ b/configure.ac
@@ -64,6 +64,15 @@ else
AC_SUBST([ENABLE_SAMPLE], [False])
fi
+# check for systemd
+PKG_PROG_PKG_CONFIG
+AC_ARG_WITH([systemdsystemunitdir],
+ AS_HELP_STRING([--with-systemdsystemunitdir=DIR], [Directory for systemd service
files]),
+ [], [with_systemdsystemunitdir=$($PKG_CONFIG --variable=systemdsystemunitdir
systemd)])
+if test "x$with_systemdsystemunitdir" != xno; then
+ AC_SUBST([systemdsystemunitdir], [$with_systemdsystemunitdir])
+fi
+
AC_ARG_WITH(
[spice-html5],
[AS_HELP_STRING([--with-spice-html5],
diff --git a/contrib/kimchi.spec.fedora.in b/contrib/kimchi.spec.fedora.in
index 30f8417..dc5533a 100644
--- a/contrib/kimchi.spec.fedora.in
+++ b/contrib/kimchi.spec.fedora.in
@@ -85,22 +85,6 @@ make DESTDIR=%{buildroot} install
%if 0%{?with_systemd}
-# create /var/lib/kimchi structure
-mkdir -p
%{buildroot}/%{_sharedstatedir}/kimchi/{debugreports,screenshots,vnc-tokens,isos}
-touch %{buildroot}/%{_sharedstatedir}/kimchi/objectstore
-
-# create /var/log/kimchi structure
-mkdir -p %{buildroot}/%{_localstatedir}/log/kimchi/
-touch %{buildroot}/%{_localstatedir}/log/kimchi/kimchi-access.log
-touch %{buildroot}/%{_localstatedir}/log/kimchi/kimchi-error.log
-
-# create /etc/kimchi structure
-mkdir -p %{buildroot}/%{_sysconfdir}/kimchi/
-touch %{buildroot}/%{_sysconfdir}/nginx/conf.d/kimchi.conf
-
-# Install the systemd scripts
-install -Dm 0644 contrib/kimchid.service.fedora %{buildroot}%{_unitdir}/kimchid.service
-install -Dm 0640 src/firewalld.xml
%{buildroot}%{_prefix}/lib/firewalld/services/kimchid.xml
%endif
%if 0%{?rhel} == 6
diff --git a/contrib/kimchi.spec.suse.in b/contrib/kimchi.spec.suse.in
index bf85661..5681a60 100644
--- a/contrib/kimchi.spec.suse.in
+++ b/contrib/kimchi.spec.suse.in
@@ -54,24 +54,6 @@ make
rm -rf %{buildroot}
make DESTDIR=%{buildroot} install
-# create /var/lib/kimchi structure
-mkdir -p %{buildroot}/%{_var}/lib/kimchi/{debugreports,screenshots,vnc-tokens,isos}
-touch %{buildroot}/%{_var}/lib/kimchi/objectstore
-
-# create /var/log/kimchi structure
-mkdir -p %{buildroot}/%{_localstatedir}/log/kimchi/
-touch %{buildroot}/%{_localstatedir}/log/kimchi/kimchi-access.log
-touch %{buildroot}/%{_localstatedir}/log/kimchi/kimchi-error.log
-
-# create /etc/kimchi structure
-mkdir -p %{buildroot}/%{_sysconfdir}/kimchi/
-
-# create nginx configuration
-touch %{buildroot}/%{_sysconfdir}/nginx/conf.d/kimchi.conf
-
-# Install the SysV init scripts
-install -Dm 0755 contrib/kimchid.sysvinit %{buildroot}%{_initrddir}/kimchid
-
%post
chkconfig kimchid on
--
2.1.0