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

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