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

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