summaryrefslogtreecommitdiffstats
path: root/0015-mkdir-basic-dirs-in-run.patch
blob: 224db8d729ee414cec15f93fec398c76fa61121b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
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