From 1009363968839fab2a0b28ddb2461a792252d40b Mon Sep 17 00:00:00 2001
Message-Id: <1009363968839fab2a0b28ddb2461a792252d40b.1372244120.git.minovotn@redhat.com>
In-Reply-To: <24977988cb53a0f50e2996977c2221c5a358a4b8.1372244120.git.minovotn@redhat.com>
References: <24977988cb53a0f50e2996977c2221c5a358a4b8.1372244120.git.minovotn@redhat.com>
From: Laszlo Ersek <lersek@redhat.com>
Date: Fri, 7 Jun 2013 12:23:59 +0200
Subject: [PATCH 07/12] Makefile: create ".../var/run" when installing the
 POSIX guest agent

RH-Author: Laszlo Ersek <lersek@redhat.com>
Message-id: <1370607840-30295-8-git-send-email-lersek@redhat.com>
Patchwork-id: 51780
O-Subject: [RHEL-6.5 qemu-kvm PATCH 7/8] Makefile: create ".../var/run" when installing the POSIX guest agent
Bugzilla: 962669
RH-Acked-by: Paolo Bonzini <pbonzini@redhat.com>
RH-Acked-by: Gal Hammer <ghammer@redhat.com>
RH-Acked-by: Michal Novotny <minovotn@redhat.com>

Otherwise the default local state directory of POSIX qga won't exist after
installation with a non-standard ${prefix} or DESTDIR.

For now qga is the only user of ".../var" (= $qemu_localstatedir) too, so
don't create that directory either unless we're installing the agent.

Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>

RHEL-6 note:
- manual port of f2e3978b5a72870b061d29948075dccc0a72db8e.
---
 Makefile |    9 ++++++++-
 1 files changed, 8 insertions(+), 1 deletions(-)

Signed-off-by: Michal Novotny <minovotn@redhat.com>
---
 Makefile | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/Makefile b/Makefile
index ca1839e..597bd13 100644
--- a/Makefile
+++ b/Makefile
@@ -381,7 +381,14 @@ ifdef CONFIG_POSIX
 	$(INSTALL_DATA) qemu-nbd.8 "$(DESTDIR)$(mandir)/man8"
 endif
 
-install: all $(if $(BUILD_DOCS),install-doc)
+install-localstatedir:
+ifdef CONFIG_POSIX
+ifneq (,$(findstring qemu-ga,$(TOOLS)))
+	$(INSTALL_DIR) "$(DESTDIR)$(qemu_localstatedir)"/run
+endif
+endif
+
+install: all $(if $(BUILD_DOCS),install-doc) install-localstatedir
 	$(INSTALL_DIR) "$(DESTDIR)$(bindir)"
 ifneq ($(TOOLS),)
 	$(INSTALL_PROG) $(STRIP_OPT) $(TOOLS) "$(DESTDIR)$(bindir)"
-- 
1.7.11.7

