Blame 0047-systemd-check-that-prefix-does-not-contain-run.patch

Harald Hoyer 2d3fda
From e09048aaf5cbc6c98fc03bdf89250e5c0e70f8c0 Mon Sep 17 00:00:00 2001
Harald Hoyer 2d3fda
From: Harald Hoyer <harald@redhat.com>
Harald Hoyer 2d3fda
Date: Fri, 6 Jul 2012 13:49:03 +0200
Harald Hoyer 2d3fda
Subject: [PATCH] systemd: check, that --prefix= does not contain /run
Harald Hoyer 2d3fda
Harald Hoyer 2d3fda
systemd will mount /run before dracut has a chance to copy over the
Harald Hoyer 2d3fda
original content.
Harald Hoyer 2d3fda
---
Harald Hoyer 2d3fda
 dracut.sh                           |    3 ++-
Harald Hoyer 2d3fda
 modules.d/98systemd/module-setup.sh |   10 +++++++---
Harald Hoyer 2d3fda
 2 files changed, 9 insertions(+), 4 deletions(-)
Harald Hoyer 2d3fda
Harald Hoyer 2d3fda
diff --git a/dracut.sh b/dracut.sh
Harald Hoyer 2d3fda
index db2e33b..0b43f44 100755
Harald Hoyer 2d3fda
--- a/dracut.sh
Harald Hoyer 2d3fda
+++ b/dracut.sh
Harald Hoyer 2d3fda
@@ -779,7 +779,8 @@ export initdir dracutbasedir dracutmodules drivers \
Harald Hoyer 2d3fda
     use_fstab fstab_lines libdirs fscks nofscks \
Harald Hoyer 2d3fda
     stdloglvl sysloglvl fileloglvl kmsgloglvl logfile \
Harald Hoyer 2d3fda
     debug host_fs_types host_devs sshkey add_fstab \
Harald Hoyer 2d3fda
-    DRACUT_VERSION udevdir systemdutildir systemdsystemunitdir
Harald Hoyer 2d3fda
+    DRACUT_VERSION udevdir systemdutildir systemdsystemunitdir \
Harald Hoyer 2d3fda
+    prefix
Harald Hoyer 2d3fda
 
Harald Hoyer 2d3fda
 # Create some directory structure first
Harald Hoyer 2d3fda
 [[ $prefix ]] && mkdir -m 0755 -p "${initdir}${prefix}"
Harald Hoyer 2d3fda
diff --git a/modules.d/98systemd/module-setup.sh b/modules.d/98systemd/module-setup.sh
Harald Hoyer 2d3fda
index d20d18d..b2111a9 100755
Harald Hoyer 2d3fda
--- a/modules.d/98systemd/module-setup.sh
Harald Hoyer 2d3fda
+++ b/modules.d/98systemd/module-setup.sh
Harald Hoyer 2d3fda
@@ -4,10 +4,9 @@
Harald Hoyer 2d3fda
 
Harald Hoyer 2d3fda
 check() {
Harald Hoyer 2d3fda
     [[ $mount_needs ]] && return 1
Harald Hoyer 2d3fda
-    if [[ -x /lib/systemd/systemd ]] || [[ -x /usr/lib/systemd/systemd ]]; then
Harald Hoyer 2d3fda
-        return 255
Harald Hoyer 2d3fda
+    if [[ -x $systemdutildir/systemd ]]; then
Harald Hoyer 2d3fda
+       return 255
Harald Hoyer 2d3fda
     fi
Harald Hoyer 2d3fda
-    [[ $systemdutildir ]] && return 255
Harald Hoyer 2d3fda
 
Harald Hoyer 2d3fda
     return 1
Harald Hoyer 2d3fda
 }
Harald Hoyer 2d3fda
@@ -17,6 +16,11 @@ depends() {
Harald Hoyer 2d3fda
 }
Harald Hoyer 2d3fda
 
Harald Hoyer 2d3fda
 install() {
Harald Hoyer 2d3fda
+    if strstr "$prefix" "/run/"; then
Harald Hoyer 2d3fda
+        dfatal "systemd does not work a prefix, which contains \"/run\"!!"
Harald Hoyer 2d3fda
+        exit 1
Harald Hoyer 2d3fda
+    fi
Harald Hoyer 2d3fda
+
Harald Hoyer 2d3fda
     dracut_install -o \
Harald Hoyer 2d3fda
         $systemdutildir/systemd \
Harald Hoyer 2d3fda
         $systemdutildir/systemd-cgroups-agent \