Blame 0024-do-not-symlink-var-log-to-run-log.patch

Harald Hoyer eeb1c2
From 99d4fd6bb791ca8ce07e07e13b58445f3e20894a Mon Sep 17 00:00:00 2001
Harald Hoyer eeb1c2
From: Harald Hoyer <harald@redhat.com>
Harald Hoyer eeb1c2
Date: Mon, 1 Dec 2014 12:36:20 +0100
Harald Hoyer eeb1c2
Subject: [PATCH] do not symlink /var/log to /run/log
Harald Hoyer eeb1c2
Harald Hoyer eeb1c2
some programs e.g. systemd-journald expect a directory in /var/log as
Harald Hoyer eeb1c2
the marker to do some actions. Here journald tries to flush
Harald Hoyer eeb1c2
/run/log/journal to /var/log/journal, if the directory is seen.
Harald Hoyer eeb1c2
Harald Hoyer eeb1c2
/var/log is now a symlink to /run/initramfs/log.
Harald Hoyer eeb1c2
---
Harald Hoyer eeb1c2
 dracut.sh                                | 1 -
Harald Hoyer eeb1c2
 modules.d/98systemd/dracut-tmpfiles.conf | 3 +++
Harald Hoyer eeb1c2
 modules.d/98systemd/module-setup.sh      | 5 +++++
Harald Hoyer eeb1c2
 modules.d/99base/dracut-lib.sh           | 6 +++++-
Harald Hoyer eeb1c2
 4 files changed, 13 insertions(+), 2 deletions(-)
Harald Hoyer eeb1c2
 create mode 100644 modules.d/98systemd/dracut-tmpfiles.conf
Harald Hoyer eeb1c2
Harald Hoyer eeb1c2
diff --git a/dracut.sh b/dracut.sh
Harald Hoyer eeb1c2
index 2357987..a542f33 100755
Harald Hoyer eeb1c2
--- a/dracut.sh
Harald Hoyer eeb1c2
+++ b/dracut.sh
Harald Hoyer eeb1c2
@@ -1300,7 +1300,6 @@ if [[ $kernel_only != yes ]]; then
Harald Hoyer eeb1c2
 
Harald Hoyer eeb1c2
     ln -sfn ../run "$initdir/var/run"
Harald Hoyer eeb1c2
     ln -sfn ../run/lock "$initdir/var/lock"
Harald Hoyer eeb1c2
-    ln -sfn ../run/log "$initdir/var/log"
Harald Hoyer eeb1c2
 else
Harald Hoyer eeb1c2
     for d in lib "$libdir"; do
Harald Hoyer eeb1c2
         [[ -e "${initdir}${prefix}/$d" ]] && continue
Harald Hoyer eeb1c2
diff --git a/modules.d/98systemd/dracut-tmpfiles.conf b/modules.d/98systemd/dracut-tmpfiles.conf
Harald Hoyer eeb1c2
new file mode 100644
Harald Hoyer eeb1c2
index 0000000..3c21ce8
Harald Hoyer eeb1c2
--- /dev/null
Harald Hoyer eeb1c2
+++ b/modules.d/98systemd/dracut-tmpfiles.conf
Harald Hoyer eeb1c2
@@ -0,0 +1,3 @@
Harald Hoyer eeb1c2
+d /run/initramfs     0755 root root -
Harald Hoyer eeb1c2
+d /run/initramfs/log 0755 root root -
Harald Hoyer eeb1c2
+L /var/log           -    -    -    - ../run/initramfs/log
Harald Hoyer eeb1c2
diff --git a/modules.d/98systemd/module-setup.sh b/modules.d/98systemd/module-setup.sh
Harald Hoyer eeb1c2
index bd4433e..8052984 100755
Harald Hoyer eeb1c2
--- a/modules.d/98systemd/module-setup.sh
Harald Hoyer eeb1c2
+++ b/modules.d/98systemd/module-setup.sh
Harald Hoyer eeb1c2
@@ -123,6 +123,8 @@ install() {
Harald Hoyer eeb1c2
         $systemdsystemunitdir/slices.target \
Harald Hoyer eeb1c2
         $systemdsystemunitdir/system.slice \
Harald Hoyer eeb1c2
         \
Harald Hoyer eeb1c2
+        $tmpfilesdir/systemd.conf \
Harald Hoyer eeb1c2
+        \
Harald Hoyer eeb1c2
         journalctl systemctl echo swapoff systemd-cgls systemd-tmpfiles
Harald Hoyer eeb1c2
 
Harald Hoyer eeb1c2
     inst_multiple -o \
Harald Hoyer eeb1c2
@@ -232,6 +234,9 @@ install() {
Harald Hoyer eeb1c2
         ln_r "$systemdsystemunitdir/${i}" "$systemdsystemunitdir/initrd.target.wants/${i}"
Harald Hoyer eeb1c2
     done
Harald Hoyer eeb1c2
 
Harald Hoyer eeb1c2
+    inst_simple "$moddir/dracut-tmpfiles.conf" "$tmpfilesdir/dracut-tmpfiles.conf"
Harald Hoyer eeb1c2
+
Harald Hoyer eeb1c2
+
Harald Hoyer eeb1c2
     mkdir -p "$initdir/etc/systemd"
Harald Hoyer eeb1c2
     # turn off RateLimit for journal
Harald Hoyer eeb1c2
     {
Harald Hoyer eeb1c2
diff --git a/modules.d/99base/dracut-lib.sh b/modules.d/99base/dracut-lib.sh
Harald Hoyer eeb1c2
index 8bc6b26..0a89cc8 100755
Harald Hoyer eeb1c2
--- a/modules.d/99base/dracut-lib.sh
Harald Hoyer eeb1c2
+++ b/modules.d/99base/dracut-lib.sh
Harald Hoyer eeb1c2
@@ -6,7 +6,11 @@ if [ -n "$NEWROOT" ]; then
Harald Hoyer eeb1c2
     [ -d $NEWROOT ] || mkdir -p -m 0755 $NEWROOT
Harald Hoyer eeb1c2
 fi
Harald Hoyer eeb1c2
 
Harald Hoyer eeb1c2
-[ -d /run/initramfs ] || mkdir -p -m 0755 /run/initramfs
Harald Hoyer eeb1c2
+if ! [ -d /run/initramfs ]; then
Harald Hoyer eeb1c2
+    mkdir -p -m 0755 /run/initramfs/log
Harald Hoyer eeb1c2
+    ln -sfn /run/initramfs/log /var/log
Harald Hoyer eeb1c2
+fi
Harald Hoyer eeb1c2
+
Harald Hoyer eeb1c2
 [ -d /run/lock ] || mkdir -p -m 0755 /run/lock
Harald Hoyer eeb1c2
 [ -d /run/log ] || mkdir -p -m 0755 /run/log
Harald Hoyer eeb1c2