move all /dev/.initramfs to /dev/.run/initramfs
authorHarald Hoyer <harald@redhat.com>
Thu, 10 Mar 2011 10:11:32 +0000 (11:11 +0100)
committerHarald Hoyer <harald@redhat.com>
Thu, 10 Mar 2011 11:40:47 +0000 (12:40 +0100)
We want all "/var/run" information to live in /dev/.run, until the real
root is mounted.
Therefore we mount a tmpfs on /dev/.run, which can/will be bind/move mounted
on /var/run later on.

modules.d/40network/dhclient-script
modules.d/40network/ifup
modules.d/45ifcfg/write-ifcfg.sh
modules.d/50plymouth/plymouth-pretrigger.sh
modules.d/90dmsquash-live/dmsquash-live-root
modules.d/90mdraid/mdmon-pre-udev.sh
modules.d/95fcoe/fcoe-up
modules.d/95iscsi/iscsiroot
modules.d/95rootfs-block/mount-root.sh
modules.d/99base/init
modules.d/99base/module-setup.sh

index 81917e0..a05a3ae 100755 (executable)
@@ -47,7 +47,7 @@ setup_interface() {
 PATH=$PATH:/sbin:/usr/sbin
 
 export PS4="dhclient.$interface.$$ + "
-exec >>/dev/.initramfs/initlog.pipe 2>>/dev/.initramfs/initlog.pipe
+exec >>/dev/.run/initramfs/initlog.pipe 2>>/dev/.run/initramfs/initlog.pipe
 . /lib/dracut-lib.sh
 
 # We already need a set netif here
index dc71109..5feeb2a 100755 (executable)
@@ -83,7 +83,7 @@ do_static() {
 PATH=$PATH:/sbin:/usr/sbin
 
 export PS4="ifup.$1.$$ + "
-exec >>/dev/.initramfs/initlog.pipe 2>>/dev/.initramfs/initlog.pipe
+exec >>/dev/.run/initramfs/initlog.pipe 2>>/dev/.run/initramfs/initlog.pipe
 . /lib/dracut-lib.sh
 
 # Huh? No $1?
index bc67dd6..b845ccb 100755 (executable)
@@ -134,9 +134,9 @@ for netif in $IFACES ; do
 done
 
 # Pass network opts
-mkdir -p /dev/.initramfs
-cp /tmp/net.* /dev/.initramfs/ >/dev/null 2>&1
-mkdir -p /dev/.initramfs/state/etc/sysconfig/network-scripts/
-cp /tmp/net.$netif.resolv.conf /dev/.initramfs/state/etc/ >/dev/null 2>&1
-echo "files /etc/sysconfig/network-scripts" > /dev/.initramfs/rwtab
-cp -a /tmp/ifcfg/* /dev/.initramfs/state/etc/sysconfig/network-scripts/ >/dev/null 2>&1
+mkdir -p /dev/.run/initramfs
+cp /tmp/net.* /dev/.run/initramfs/ >/dev/null 2>&1
+mkdir -p /dev/.run/initramfs/state/etc/sysconfig/network-scripts/
+cp /tmp/net.$netif.resolv.conf /dev/.run/initramfs/state/etc/ >/dev/null 2>&1
+echo "files /etc/sysconfig/network-scripts" > /dev/.run/initramfs/rwtab
+cp -a /tmp/ifcfg/* /dev/.run/initramfs/state/etc/sysconfig/network-scripts/ >/dev/null 2>&1
index c224875..f7f7997 100755 (executable)
@@ -18,8 +18,7 @@ if getargbool 1 rd.plymouth -n rd_NO_PLYMOUTH; then
 
     info "Starting plymouth daemon"
     [ -x /bin/plymouthd ] && /bin/plymouthd --attach-to-session
-    mkdir -m 0755 /dev/.systemd >/dev/null 2>&1
-    >/dev/.systemd/plymouth
+    >/dev/.run/initramfs/plymouth
     /lib/udev/console_init tty0
     /bin/plymouth --show-splash 2>&1 | vinfo
 fi
index c857e48..06893d5 100755 (executable)
@@ -43,7 +43,7 @@ getarg ro && liverw=ro
 getarg rw && liverw=rw
 [ -z "$liverw" ] && liverw=ro
 # mount the backing of the live image first
-mkdir -p /dev/.initramfs/live
+mkdir -p /dev/.run/initramfs/live
 if [ -f $livedev ]; then
     # no mount needed - we've already got the LiveOS image in initramfs
     case $livedev in
@@ -51,7 +51,7 @@ if [ -f $livedev ]; then
         *ext3fs.img|*btrfs.img) FSIMG=$livedev ;;
     esac
 else
-    mount -n -t $fstype -o $liverw $livedev /dev/.initramfs/live
+    mount -n -t $fstype -o $liverw $livedev /dev/.run/initramfs/live
     RES=$?
     if [ "$RES" != "0" ]; then
         die "Failed to mount block device of live image"
@@ -116,8 +116,8 @@ do_live_from_base_loop() {
 }
 
 # we might have a genMinInstDelta delta file for anaconda to take advantage of
-if [ -e /dev/.initramfs/live/${live_dir}/osmin.img ]; then
-    OSMINSQFS=/dev/.initramfs/live/${live_dir}/osmin.img
+if [ -e /dev/.run/initramfs/live/${live_dir}/osmin.img ]; then
+    OSMINSQFS=/dev/.run/initramfs/live/${live_dir}/osmin.img
 fi
 
 if [ -n "$OSMINSQFS" ]; then
@@ -133,10 +133,10 @@ if [ -n "$OSMINSQFS" ]; then
 fi
 
 # we might have an embedded fs image to use as rootfs (uncompressed live)
-if [ -e /dev/.initramfs/live/${live_dir}/ext3fs.img ]; then
-    FSIMG="/dev/.initramfs/live/${live_dir}/ext3fs.img"
-elif [ -e /dev/.initramfs/live/${live_dir}/btrfs.img ]; then
-    FSIMG="/dev/.initramfs/live/${live_dir}/btrfs.img"
+if [ -e /dev/.run/initramfs/live/${live_dir}/ext3fs.img ]; then
+    FSIMG="/dev/.run/initramfs/live/${live_dir}/ext3fs.img"
+elif [ -e /dev/.run/initramfs/live/${live_dir}/btrfs.img ]; then
+    FSIMG="/dev/.run/initramfs/live/${live_dir}/btrfs.img"
 fi
 
 if [ -n "$FSIMG" ] ; then
@@ -147,8 +147,8 @@ if [ -n "$FSIMG" ] ; then
 fi
 
 # we might have an embedded fs image on squashfs (compressed live)
-if [ -e /dev/.initramfs/live/${live_dir}/squashfs.img ]; then
-    SQUASHED="/dev/.initramfs/live/${live_dir}/squashfs.img"
+if [ -e /dev/.run/initramfs/live/${live_dir}/squashfs.img ]; then
+    SQUASHED="/dev/.run/initramfs/live/${live_dir}/squashfs.img"
 fi
 
 if [ -e "$SQUASHED" ] ; then
@@ -156,7 +156,7 @@ if [ -e "$SQUASHED" ] ; then
         echo "Copying live image to RAM..."
         echo "(this may take a few minutes)"
         dd if=$SQUASHED of=/squashed.img bs=512 2> /dev/null
-        umount -n /dev/.initramfs/live
+        umount -n /dev/.run/initramfs/live
         echo "Done copying live image to RAM."
         eject -p $livedev || :
         SQUASHED="/squashed.img"
index bda61b2..4bd9197 100755 (executable)
@@ -2,6 +2,6 @@
 # -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
 # ex: ts=8 sw=4 sts=4 et filetype=sh
 # save state dir for mdmon/mdadm for the real root
-mkdir /dev/.mdadm
-[ -e /var/run/mdadm ] && rm -fr /var/run/mdadm
-ln -s /dev/.mdadm /var/run/mdadm
+mkdir -m 0755 /dev/.run/mdadm
+# backward compat link
+ln -s .run/mdadm /dev/.mdadm
index b4eaa09..ad72317 100755 (executable)
@@ -14,7 +14,7 @@ PATH=$PATH:/sbin:/usr/sbin
 [ -z "$1" -o -z "$2" ] && exit 1
 
 export PS4="fcoe-up.$1.$$ + "
-exec >>/dev/.initramfs/initlog.pipe 2>>/dev/.initramfs/initlog.pipe
+exec >>/dev/.run/initramfs/initlog.pipe 2>>/dev/.run/initramfs/initlog.pipe
 . /lib/dracut-lib.sh
 
 netif=$1
index bf82c8f..a2006fd 100755 (executable)
@@ -151,7 +151,8 @@ handle_netroot()
         iscsi_lun=0
     fi
 
-    echo "InitiatorName='$iscsi_initiator'" > /dev/.initiatorname.iscsi
+    echo "InitiatorName='$iscsi_initiator'" > /dev/.run/initiatorname.iscsi
+    ln -s .run/initiatorname.iscsi /dev/.initiatorname.iscsi
 
 # FIXME $iscsi_protocol??
 
index fecc347..e694a83 100755 (executable)
@@ -117,8 +117,8 @@ if [ -n "$root" -a -z "${root%%block:*}" ]; then
         info fsck -T -t noopts=_netdev -A $fsckoptions
         out=$(fsck -T -t noopts=_netdev -A $fsckoptions) 
         export RD_ROOTFS_FSCK=$?
-        mkdir -p /dev/.initramfs
-        echo $RD_ROOTFS_FSCK > /dev/.initramfs/fsck
+        mkdir -p /dev/.run/initramfs
+        echo $RD_ROOTFS_FSCK > /dev/.run/initramfs/fsck
         
         # A return of 4 or higher means there were serious problems.
         if [ $RD_ROOTFS_FSCK -gt 3 ]; then
index eb7d9c0..f4da4cc 100755 (executable)
@@ -33,7 +33,7 @@ wait_for_loginit()
         done
         set -x
     fi
-    rm -f /dev/.initramfs/initlog.pipe
+    rm -f /dev/.run/initramfs/initlog.pipe
 }
 
 emergency_shell()
@@ -105,15 +105,24 @@ ln -s /proc/self/fd /dev/fd >/dev/null 2>&1
 ln -s /proc/self/fd/0 /dev/stdin >/dev/null 2>&1
 ln -s /proc/self/fd/1 /dev/stdout >/dev/null 2>&1
 ln -s /proc/self/fd/2 /dev/stderr >/dev/null 2>&1
-mkdir -m 0755 /dev/shm /dev/pts /dev/.udev /dev/.udev/rules.d /dev/.initramfs
+mkdir -m 0755 /dev/shm /dev/pts /dev/.run 
 mount -t devpts -o gid=5,mode=620,noexec,nosuid devpts /dev/pts >/dev/null 2>&1
 mount -t tmpfs -o mode=1777,nosuid,nodev  tmpfs /dev/shm >/dev/null 2>&1
 
+# creat /dev/.run which will be /var/run
+mount -t tmpfs -o mode=0755,nodev,noexec,nosuid tmpfs /dev/.run >/dev/null 2>&1
+mkdir -m 0755 /dev/.run/udev /dev/.run/udev/rules.d  /dev/.run/initramfs
+
+# create compat symlinks
+ln -s .run/initramfs /dev/.initramfs
+ln -s /dev/.run /var/run
+ln -s .run/udev /dev/.udev
+
 if getargbool 0 rd.debug -y rdinitdebug -y rdnetdebug; then
     getarg quiet && DRACUT_QUIET="yes"
-    mkfifo /dev/.initramfs/initlog.pipe
-    /sbin/loginit $DRACUT_QUIET </dev/.initramfs/initlog.pipe >/dev/console 2>&1 &
-    exec >/dev/.initramfs/initlog.pipe 2>&1
+    mkfifo /dev/.run/initramfs/initlog.pipe
+    /sbin/loginit $DRACUT_QUIET </dev/.run/initramfs/initlog.pipe >/dev/console 2>&1 &
+    exec >/dev/.run/initramfs/initlog.pipe 2>&1
 else
     exec 0<>/dev/console 1<>/dev/console 2<>/dev/console
 fi
@@ -335,7 +344,7 @@ fi
 
 # Debug: Copy state
 if getargbool 0 rd.copystate -y rdcopystate; then
-    cp /tmp/* /dev/.initramfs/ >/dev/null 2>&1
+    cp /tmp/* /dev/.run/initramfs/ >/dev/null 2>&1
 fi
 
 if getargbool 1 rd.timestamp; then
index a55cdc4..db5fab8 100755 (executable)
@@ -39,7 +39,7 @@ install() {
     inst "$moddir/dracut-lib.sh" "/lib/dracut-lib.sh"
     inst_hook cmdline 10 "$moddir/parse-root-opts.sh"
     inst_hook cmdline 20 "$moddir/parse-blacklist.sh"
-    mkdir -p "${initdir}/var/run"
+    mkdir -p "${initdir}/var"
     [ -x /lib/systemd/systemd-timestamp ] && inst /lib/systemd/systemd-timestamp
 }