summaryrefslogtreecommitdiffstats
path: root/init
diff options
context:
space:
mode:
authorPetr Spacek <pspacek@redhat.com>2016-11-04 15:19:51 +0100
committerMartin Babinsky <mbabinsk@redhat.com>2016-11-09 13:08:32 +0100
commit6cb0271509fe95ae38fc743f2a13faf32fe29a99 (patch)
tree66c1d3c6583850cad99b44c969e8ffc059455506 /init
parent288d624336d502a7df9856cdc2f6543b6e7c0b79 (diff)
downloadfreeipa-6cb0271509fe95ae38fc743f2a13faf32fe29a99.tar.gz
freeipa-6cb0271509fe95ae38fc743f2a13faf32fe29a99.tar.xz
freeipa-6cb0271509fe95ae38fc743f2a13faf32fe29a99.zip
Build: create /var/run directories at install time
Directory creating was moved from SPEC file to install-data-hook. At the same time, it is using systemd-tmpfiles to create the directories so we do not risk any inconsistency between SPEC file and tmpfilesd configuration. systemd-tmpfiles call is non-critical on purpose: The build would fail when run under unprivileged user because systemd-tmpfiles tries to change ownership. Luckily it creates all the files and just do not change ownership so it works even under unprivileged user. Interestingly, systemd-tmpfiles continues if user does not have sufficient permissions to change ownership but fails if target username does not exist at all. For this reason there is BuildRequires on httpd. https://fedorahosted.org/freeipa/ticket/6418 Reviewed-By: Martin Basti <mbasti@redhat.com> Reviewed-By: Christian Heimes <cheimes@redhat.com>
Diffstat (limited to 'init')
-rw-r--r--init/tmpfilesd/Makefile.am10
1 files changed, 10 insertions, 0 deletions
diff --git a/init/tmpfilesd/Makefile.am b/init/tmpfilesd/Makefile.am
index 40b9cd5a5..82afa6ad5 100644
--- a/init/tmpfilesd/Makefile.am
+++ b/init/tmpfilesd/Makefile.am
@@ -8,3 +8,13 @@ CLEANFILES = $(systemdtmpfiles_DATA)
%: %.in Makefile
sed -e 's|@localstatedir[@]|$(localstatedir)|g' '$(srcdir)/$@.in' >$@
+
+# create empty directories as needed
+# DESTDIR might not be set, in that case default to system root
+DESTDIR ?= /
+install-data-hook:
+ for conf in $(systemdtmpfiles_DATA); do \
+ systemd-tmpfiles --remove --create --boot \
+ --root $(DESTDIR) \
+ $(DESTDIR)$(systemdtmpfilesdir)/$${conf} || :; \
+ done