move all /dev/.initramfs to /dev/.run/initramfs

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.
master
Harald Hoyer 2011-03-10 11:11:32 +01:00
parent 9fe4f5ff25
commit b177e9133e
11 changed files with 44 additions and 35 deletions

View File

@ -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

View File

@ -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?

View File

@ -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

View File

@ -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

View File

@ -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"

View File

@ -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

View File

@ -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

View File

@ -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??


View File

@ -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

View File

@ -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

View File

@ -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
}