Blame SOURCES/0241-do-not-symlink-var-log-to-run-log.patch

712866
From 9eb6db5b9ac5372793aa2fc6f479a2a82a369695 Mon Sep 17 00:00:00 2001
712866
From: Harald Hoyer <harald@redhat.com>
712866
Date: Mon, 1 Dec 2014 12:36:20 +0100
712866
Subject: [PATCH] do not symlink /var/log to /run/log
712866
712866
some programs e.g. systemd-journald expect a directory in /var/log as
712866
the marker to do some actions. Here journald tries to flush
712866
/run/log/journal to /var/log/journal, if the directory is seen.
712866
712866
/var/log is now a symlink to /run/initramfs/log.
712866
712866
(cherry picked from commit 99d4fd6bb791ca8ce07e07e13b58445f3e20894a)
712866
---
712866
 dracut.sh                                |  1 -
712866
 modules.d/98systemd/dracut-tmpfiles.conf |  3 +++
712866
 modules.d/98systemd/module-setup.sh      |  5 +++++
712866
 modules.d/99base/dracut-lib.sh           | 11 +++++++++++
712866
 4 files changed, 19 insertions(+), 1 deletion(-)
712866
 create mode 100644 modules.d/98systemd/dracut-tmpfiles.conf
712866
712866
diff --git a/dracut.sh b/dracut.sh
5c6c2a
index 74c59a0c..27c2bf45 100755
712866
--- a/dracut.sh
712866
+++ b/dracut.sh
712866
@@ -1217,7 +1217,6 @@ if [[ $kernel_only != yes ]]; then
712866
 
712866
     ln -sfn ../run "$initdir/var/run"
712866
     ln -sfn ../run/lock "$initdir/var/lock"
712866
-    ln -sfn ../run/log "$initdir/var/log"
712866
 else
712866
     for d in lib "$libdir"; do
712866
         [[ -e "${initdir}${prefix}/$d" ]] && continue
712866
diff --git a/modules.d/98systemd/dracut-tmpfiles.conf b/modules.d/98systemd/dracut-tmpfiles.conf
712866
new file mode 100644
5c6c2a
index 00000000..3c21ce81
712866
--- /dev/null
712866
+++ b/modules.d/98systemd/dracut-tmpfiles.conf
712866
@@ -0,0 +1,3 @@
712866
+d /run/initramfs     0755 root root -
712866
+d /run/initramfs/log 0755 root root -
712866
+L /var/log           -    -    -    - ../run/initramfs/log
712866
diff --git a/modules.d/98systemd/module-setup.sh b/modules.d/98systemd/module-setup.sh
5c6c2a
index f62f5511..aae0319a 100755
712866
--- a/modules.d/98systemd/module-setup.sh
712866
+++ b/modules.d/98systemd/module-setup.sh
712866
@@ -121,6 +121,8 @@ install() {
712866
         $systemdsystemunitdir/slices.target \
712866
         $systemdsystemunitdir/system.slice \
712866
         \
712866
+        $tmpfilesdir/systemd.conf \
712866
+        \
712866
         journalctl systemctl echo swapoff systemd-cgls systemd-tmpfiles
712866
 
712866
     inst_multiple -o \
712866
@@ -230,6 +232,9 @@ install() {
712866
         ln_r "$systemdsystemunitdir/${i}" "$systemdsystemunitdir/initrd.target.wants/${i}"
712866
     done
712866
 
712866
+    inst_simple "$moddir/dracut-tmpfiles.conf" "$tmpfilesdir/dracut-tmpfiles.conf"
712866
+
712866
+
712866
     mkdir -p "$initdir/etc/systemd"
712866
     # turn off RateLimit for journal
712866
     {
712866
diff --git a/modules.d/99base/dracut-lib.sh b/modules.d/99base/dracut-lib.sh
5c6c2a
index b0ac08a0..b490e824 100755
712866
--- a/modules.d/99base/dracut-lib.sh
712866
+++ b/modules.d/99base/dracut-lib.sh
712866
@@ -4,6 +4,17 @@
712866
 
712866
 export DRACUT_SYSTEMD
712866
 export NEWROOT
712866
+if [ -n "$NEWROOT" ]; then
712866
+    [ -d $NEWROOT ] || mkdir -p -m 0755 $NEWROOT
712866
+fi
712866
+
712866
+if ! [ -d /run/initramfs ]; then
712866
+    mkdir -p -m 0755 /run/initramfs/log
712866
+    ln -sfn /run/initramfs/log /var/log
712866
+fi
712866
+
712866
+[ -d /run/lock ] || mkdir -p -m 0755 /run/lock
712866
+[ -d /run/log ] || mkdir -p -m 0755 /run/log
712866
 
712866
 debug_off() {
712866
     set +x