Blob Blame History Raw
From 56903458d7e67f805a7e484cd025a059a5621d73 Mon Sep 17 00:00:00 2001
From: Harald Hoyer <harald@redhat.com>
Date: Wed, 16 Oct 2013 11:47:01 +0200
Subject: [PATCH] mkdir basic dirs in /run

for systemd initramfs, /run is also mounted
for non-systemd the contents of /run is copied over, when mounting /run
---
 modules.d/98systemd/dracut-cmdline.sh |  5 -----
 modules.d/99base/dracut-lib.sh        |  7 +++++++
 modules.d/99base/init.sh              | 10 +++-------
 3 files changed, 10 insertions(+), 12 deletions(-)

diff --git a/modules.d/98systemd/dracut-cmdline.sh b/modules.d/98systemd/dracut-cmdline.sh
index 50b8d6c..aa8a02b 100755
--- a/modules.d/98systemd/dracut-cmdline.sh
+++ b/modules.d/98systemd/dracut-cmdline.sh
@@ -2,11 +2,6 @@
 # -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
 # ex: ts=8 sw=4 sts=4 et filetype=sh
 
-[ -d $NEWROOT ] || mkdir -p -m 0755 $NEWROOT
-[ -d /run/initramfs ] || mkdir -p -m 0755 /run/initramfs
-[ -d /run/lock ] || mkdir -p -m 0755 /run/lock
-[ -d /run/log ] || mkdir -p -m 0755 /run/log
-
 if [ -f /dracut-state.sh ]; then
     . /dracut-state.sh 2>/dev/null
 fi
diff --git a/modules.d/99base/dracut-lib.sh b/modules.d/99base/dracut-lib.sh
index 74d7d35..0670cf2 100755
--- a/modules.d/99base/dracut-lib.sh
+++ b/modules.d/99base/dracut-lib.sh
@@ -4,6 +4,13 @@
 
 export DRACUT_SYSTEMD
 export NEWROOT
+if [ -n "$NEWROOT" ]; then
+    [ -d $NEWROOT ] || mkdir -p -m 0755 $NEWROOT
+fi
+
+[ -d /run/initramfs ] || mkdir -p -m 0755 /run/initramfs
+[ -d /run/lock ] || mkdir -p -m 0755 /run/lock
+[ -d /run/log ] || mkdir -p -m 0755 /run/log
 
 debug_off() {
     set +x
diff --git a/modules.d/99base/init.sh b/modules.d/99base/init.sh
index 3ba440a..2364f4f 100755
--- a/modules.d/99base/init.sh
+++ b/modules.d/99base/init.sh
@@ -56,17 +56,17 @@ fi
 
 if ! ismounted /dev/pts; then
     mkdir -m 0755 /dev/pts
-    mount -t devpts -o gid=5,mode=620,noexec,nosuid devpts /dev/pts >/dev/null 
+    mount -t devpts -o gid=5,mode=620,noexec,nosuid devpts /dev/pts >/dev/null
 fi
 
 if ! ismounted /dev/shm; then
     mkdir -m 0755 /dev/shm
-    mount -t tmpfs -o mode=1777,nosuid,nodev,strictatime tmpfs /dev/shm >/dev/null 
+    mount -t tmpfs -o mode=1777,nosuid,nodev,strictatime tmpfs /dev/shm >/dev/null
 fi
 
 if ! ismounted /run; then
     mkdir -m 0755 /newrun
-    mount -t tmpfs -o mode=0755,nosuid,nodev,strictatime tmpfs /newrun >/dev/null 
+    mount -t tmpfs -o mode=0755,nosuid,nodev,strictatime tmpfs /newrun >/dev/null
     cp -a /run/* /newrun >/dev/null 2>&1
     mount --move /newrun /run
     rm -fr -- /newrun
@@ -88,10 +88,6 @@ fi
 
 trap "action_on_fail Signal caught!" 0
 
-[ -d /run/initramfs ] || mkdir -p -m 0755 /run/initramfs
-[ -d /run/log ] || mkdir -p -m 0755 /run/log
-[ -d /run/lock ] || mkdir -p -m 0755 /run/lock
-
 export UDEVVERSION=$(udevadm --version)
 if [ $UDEVVERSION -gt 166 ]; then
     # newer versions of udev use /run/udev/rules.d