spec: Test for /var being writable before making /var/log/journal

rpm-ostree has `/var` be read-only during package installs, because
a whole part of the "transactional update" model is that your system's
data stays untouched, and `/var` is system data.

See e.g. https://src.fedoraproject.org/rpms/mock/pull-request/2
and the tracker https://bugzilla.redhat.com/show_bug.cgi?id=1352154

Just to squash some error spew during tree composes.
This commit is contained in:
Colin Walters 2018-08-10 19:52:58 +00:00 committed by Zbigniew Jędrzejewski-Szmek
parent 184871e826
commit 48ac1cebde
1 changed files with 4 additions and 3 deletions

View File

@ -482,9 +482,10 @@ systemctl daemon-reexec &>/dev/null || :
journalctl --update-catalog &>/dev/null || :
systemd-tmpfiles --create &>/dev/null || :
if [ $1 -eq 1 ] ; then
# create /var/log/journal only on initial installation
mkdir -p %{_localstatedir}/log/journal
# create /var/log/journal only on initial installation,
# and only if it's writable (it won't be in rpm-ostree).
if [ $1 -eq 1 ] && [ -w %{_localstatedir} ]; then
mkdir -p %{_localstatedir}/log/journal
fi
# Make sure new journal files will be owned by the "systemd-journal" group