Blob Blame History Raw
From 29d7f951999d0c8aad33fd1d0cb25a9b50db693f Mon Sep 17 00:00:00 2001
From: Jakub Hrozek <jhrozek@redhat.com>
Date: Wed, 5 Nov 2014 17:57:44 +0100
Subject: [PATCH 89/92] BUILD: Use separate chown to make changing ownership to
 the sssd user non-fatal
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

When the SSSD is built in the build system using a non-root user, the
user doesn't exist in the build system and file ownership will be
maintained by the downstream packaging instead.

We need to make sure that setting the ownership to the sssd user is a
separate step from creating the directories in this case in order to
make failure to set the ownership non-fatal.

Related:
https://fedorahosted.org/sssd/ticket/2370

Reviewed-by: Lukáš Slebodník <lslebodn@redhat.com>
---
 Makefile.am | 35 ++++++++++++++++++-----------------
 1 file changed, 18 insertions(+), 17 deletions(-)

diff --git a/Makefile.am b/Makefile.am
index 5325d51e7240ae39a546e68b2a2aea202b3dfdfa..6ce3a42f3833fc9041efd908c2e3de4a85193d42 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -82,11 +82,6 @@ INSTALL = @INSTALL@
 
 SSSD_USER = @SSSD_USER@
 
-INSTALL_USER_DIR_FLAGS = -d
-if SSSD_USER
-INSTALL_USER_DIR_FLAGS += -o $(SSSD_USER) -g $(SSSD_USER)
-endif
-
 AM_CFLAGS =
 if WANT_AUX_INFO
     AM_CFLAGS += -aux-info $@.X
@@ -2798,6 +2793,18 @@ src/sysv/systemd/journal.conf: src/sysv/systemd/journal.conf.in Makefile
 	@$(MKDIR_P) src/sysv/systemd/
 	$(replace_script)
 
+SSSD_USER_DIRS = \
+    $(DESTDIR)$(dbpath) \
+    $(DESTDIR)$(mcpath) \
+    $(DESTDIR)$(pipepath) \
+    $(DESTDIR)$(pipepath)/private \
+    $(DESTDIR)$(pubconfpath) \
+    $(DESTDIR)$(pubconfpath)/krb5.include.d \
+    $(DESTDIR)$(gpocachepath) \
+    $(DESTDIR)$(sssdconfdir) \
+    $(DESTDIR)$(logpath) \
+    $(NULL)
+
 installsssddirs::
 	$(MKDIR_P) \
     $(DESTDIR)$(includedir) \
@@ -2815,18 +2822,12 @@ installsssddirs::
     $(DESTDIR)$(sssddatadir) \
     $(DESTDIR)$(sudolibdir) \
     $(DESTDIR)$(autofslibdir) \
-    $(NULL); \
-	$(INSTALL) $(INSTALL_USER_DIR_FLAGS) \
-    $(DESTDIR)$(dbpath) \
-    $(DESTDIR)$(mcpath) \
-    $(DESTDIR)$(pipepath) \
-    $(DESTDIR)$(pipepath)/private \
-    $(DESTDIR)$(pubconfpath) \
-    $(DESTDIR)$(pubconfpath)/krb5.include.d \
-    $(DESTDIR)$(gpocachepath) \
-    $(DESTDIR)$(sssdconfdir) \
-    $(DESTDIR)$(logpath) \
-    $(NULL)
+    $(SSSD_USER_DIRS) \
+    $(NULL);
+if SSSD_USER
+	-chown $(SSSD_USER):$(SSSD_USER) \
+	$(SSSD_USER_DIRS)
+endif
 
 if HAVE_DOXYGEN
 docs:
-- 
1.9.3