[Kimchi-devel] [PATCH] Add DESTDIR to make install
Ramon Medeiros
ramonn at linux.vnet.ibm.com
Wed May 27 20:25:24 UTC 2015
Commit 04d29530 was incomplete by not using DESTDIR on installation.
This can cause trouble when creating the rpm. Also, make install now is
installing correctly service and firewall configuration files.
---
Makefile.am | 54 +++++++++++++++++++++++++++++++------------
contrib/kimchi.spec.fedora.in | 3 ---
2 files changed, 39 insertions(+), 18 deletions(-)
diff --git a/Makefile.am b/Makefile.am
index 91a0fa2..46e0e0e 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -116,26 +116,50 @@ ChangeLog:
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; \
+ mkdir -p $(DESTDIR)/usr/lib/systemd/system/; \
+ $(INSTALL_DATA) contrib/kimchid.service.fedora $(DESTDIR)/usr/lib/systemd/system/kimchid.service; \
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
+ mkdir -p $(DESTDIR)/etc/systemd/system/; \
+ $(INSTALL_DATA) contrib/kimchid.service.fedora $(DESTDIR)/etc/systemd/system/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; \
+ if test -f /etc/fedora-release || test -f /etc/redhat-release; then \
+ $(INSTALL_DATA) contrib/kimchid-upstart.conf.fedora $(DESTDIR)/etc/init/kimchi.conf; \
+ elif test -f /etc/debian_version; then \
+ $(INSTALL_DATA) contrib/kimchid-upstart.conf.debian $(DESTDIR)/etc/init/kimchi.conf; \
+ fi; \
+ 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; \
+ $(RM) $(DESTDIR)/usr/lib/systemd/system/kimchid.service; \
+ elif test -f $(DESTDIR)/etc/systemd/system/kimchid.service; then \
+ $(RM) $(DESTDIR)/etc/systemd/system/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/contrib/kimchi.spec.fedora.in b/contrib/kimchi.spec.fedora.in
index 30f8417..4e12327 100644
--- a/contrib/kimchi.spec.fedora.in
+++ b/contrib/kimchi.spec.fedora.in
@@ -98,9 +98,6 @@ touch %{buildroot}/%{_localstatedir}/log/kimchi/kimchi-error.log
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
--
2.1.0
More information about the Kimchi-devel
mailing list