From ee76a087a9baab9ef268d6126d2efe4c0d17e6bd Mon Sep 17 00:00:00 2001 From: Harald Hoyer Date: Mar 08 2012 12:52:09 +0000 Subject: dracut-017-39.git20120308 - kill dhclient silently - cleanup and fix network config writeout to /run/initramfs/state Resolves: rhbz#799989 - various cleanups --- diff --git a/0022-40network-kill-dhclient.sh-kill-dhclient-silently.patch b/0022-40network-kill-dhclient.sh-kill-dhclient-silently.patch new file mode 100644 index 0000000..78e0946 --- /dev/null +++ b/0022-40network-kill-dhclient.sh-kill-dhclient-silently.patch @@ -0,0 +1,29 @@ +From a3f00efc99ac4736be3a1e24259d691bb9a9e19d Mon Sep 17 00:00:00 2001 +From: Harald Hoyer +Date: Thu, 8 Mar 2012 10:58:16 +0100 +Subject: [PATCH] 40network/kill-dhclient.sh: kill dhclient silently + +--- + modules.d/40network/kill-dhclient.sh | 4 ++-- + 1 files changed, 2 insertions(+), 2 deletions(-) + +diff --git a/modules.d/40network/kill-dhclient.sh b/modules.d/40network/kill-dhclient.sh +index 2f834c1..78060f5 100755 +--- a/modules.d/40network/kill-dhclient.sh ++++ b/modules.d/40network/kill-dhclient.sh +@@ -5,7 +5,7 @@ + for f in /tmp/dhclient.*.pid; do + [ -e $f ] || continue + read PID < $f; +- kill $PID; ++ kill $PID >/dev/null 2>&1 + done + + sleep 0.1 +@@ -13,5 +13,5 @@ sleep 0.1 + for f in /tmp/dhclient.*.pid; do + [ -e $f ] || continue + read PID < $f; +- kill -9 $PID; ++ kill -9 $PID >/dev/null 2>&1 + done diff --git a/0023-write-ifcfg.sh-cleanups.patch b/0023-write-ifcfg.sh-cleanups.patch new file mode 100644 index 0000000..75234a2 --- /dev/null +++ b/0023-write-ifcfg.sh-cleanups.patch @@ -0,0 +1,34 @@ +From d37ad6aea04932196df06139b27d3869385617f9 Mon Sep 17 00:00:00 2001 +From: Will Woods +Date: Wed, 7 Mar 2012 17:21:53 -0500 +Subject: [PATCH] write-ifcfg.sh: cleanups + +mkdir -p creates intermediate directories and never returns an error, so +we don't need to create the intermediate directories ourself. +--- + modules.d/45ifcfg/write-ifcfg.sh | 15 +++++++-------- + 1 files changed, 7 insertions(+), 8 deletions(-) + +diff --git a/modules.d/45ifcfg/write-ifcfg.sh b/modules.d/45ifcfg/write-ifcfg.sh +index d633a96..0f431e3 100755 +--- a/modules.d/45ifcfg/write-ifcfg.sh ++++ b/modules.d/45ifcfg/write-ifcfg.sh +@@ -134,11 +134,10 @@ for netif in $IFACES ; do + done + + # Pass network opts +-[ -d /run/initramfs ] || mkdir -m 0755 -p /run/initramfs +-cp /tmp/net.* /run/initramfs/ >/dev/null 2>&1 +-for i in /run/initramfs/state /run/initramfs/state/etc/ /run/initramfs/state/etc/sysconfig /run/initramfs/state/etc/sysconfig/network-scripts; do +- [ -d $i ] || mkdir -m 0755 -p $i +-done +-cp /tmp/net.$netif.resolv.conf /run/initramfs/state/etc/ >/dev/null 2>&1 +-echo "files /etc/sysconfig/network-scripts" > /run/initramfs/rwtab +-cp -a -t /run/initramfs/state/etc/sysconfig/network-scripts/ /tmp/ifcfg/* >/dev/null 2>&1 ++mkdir -m 0755 -p /run/initramfs/state/etc/sysconfig/network-scripts ++echo "files /etc/sysconfig/network-scripts" >> /run/initramfs/rwtab ++{ ++ cp /tmp/net.* /run/initramfs/ ++ cp /tmp/net.$netif.resolv.conf /run/initramfs/state/etc/ ++ cp -a -t /run/initramfs/state/etc/sysconfig/network-scripts/ /tmp/ifcfg/* ++} > /dev/null 2>&1 diff --git a/0024-write-ifcfg.sh-add-UUID-.-and-save-the-lease-files-w.patch b/0024-write-ifcfg.sh-add-UUID-.-and-save-the-lease-files-w.patch new file mode 100644 index 0000000..67388e4 --- /dev/null +++ b/0024-write-ifcfg.sh-add-UUID-.-and-save-the-lease-files-w.patch @@ -0,0 +1,62 @@ +From 66666c670a462548df4ea4c8069d54b8c309ecf4 Mon Sep 17 00:00:00 2001 +From: Will Woods +Date: Wed, 7 Mar 2012 17:21:54 -0500 +Subject: [PATCH] write-ifcfg.sh: add UUID=.. and save the lease files with + the same uuid + +As described in https://bugzilla.redhat.com/show_bug.cgi?id=541410#c2, +if you want NetworkManager to take over an interface that you're using +for NFS root (or other network root device), you need to: + +a) set UUID= in ifcfg-, and +b) save the lease file as /var/lib/dhclient--.lease + +This patch should make write-ifcfg handle both these things. +--- + modules.d/45ifcfg/write-ifcfg.sh | 7 +++++++ + 1 files changed, 7 insertions(+), 0 deletions(-) + +diff --git a/modules.d/45ifcfg/write-ifcfg.sh b/modules.d/45ifcfg/write-ifcfg.sh +index 0f431e3..fe986df 100755 +--- a/modules.d/45ifcfg/write-ifcfg.sh ++++ b/modules.d/45ifcfg/write-ifcfg.sh +@@ -18,11 +18,13 @@ if [ -e /tmp/bridge.info ]; then + fi + + mkdir -m 0755 -p /tmp/ifcfg/ ++mkdir -m 0755 -p /tmp/ifcfg-leases/ + + for netif in $IFACES ; do + # bridge? + unset bridge + unset bond ++ uuid=$(cat /proc/sys/kernel/random/uuid) + if [ "$netif" = "$bridgename" ]; then + bridge=yes + elif [ "$netif" = "$bondname" ]; then +@@ -35,10 +37,12 @@ for netif in $IFACES ; do + echo "DEVICE=$netif" + echo "ONBOOT=yes" + echo "NETBOOT=yes" ++ echo "UUID=$uuid" + if [ -f /tmp/net.$netif.lease ]; then + strstr "$ip" '*:*:*' && + echo "DHCPV6C=yes" + echo "BOOTPROTO=dhcp" ++ cp /tmp/net.$netif.lease /tmp/ifcfg-leases/dhclient-$uuid-$netif.lease + else + echo "BOOTPROTO=none" + # If we've booted with static ip= lines, the override file is there +@@ -135,9 +139,12 @@ done + + # Pass network opts + mkdir -m 0755 -p /run/initramfs/state/etc/sysconfig/network-scripts ++mkdir -m 0755 -p /run/initramfs/state/var/lib/dhclient + echo "files /etc/sysconfig/network-scripts" >> /run/initramfs/rwtab ++echo "files /var/lib/dhclient" >> /run/initramfs/rwtab + { + cp /tmp/net.* /run/initramfs/ + cp /tmp/net.$netif.resolv.conf /run/initramfs/state/etc/ + cp -a -t /run/initramfs/state/etc/sysconfig/network-scripts/ /tmp/ifcfg/* ++ cp /tmp/ifcfg-leases/* /run/initramfs/state/var/lib/dhclient + } > /dev/null 2>&1 diff --git a/0025-fix-apply-live-updates-failing-because-of-lib-symlin.patch b/0025-fix-apply-live-updates-failing-because-of-lib-symlin.patch new file mode 100644 index 0000000..b3b431f --- /dev/null +++ b/0025-fix-apply-live-updates-failing-because-of-lib-symlin.patch @@ -0,0 +1,40 @@ +From b43d651511df184fcdc1677e11166bae2f61073a Mon Sep 17 00:00:00 2001 +From: Will Woods +Date: Wed, 7 Mar 2012 17:22:18 -0500 +Subject: [PATCH] fix apply-live-updates failing because of /lib symlink + +Since cp won't copy a directory over a symlink, any updates that were +supposed to go into e.g. /lib would get dropped if you had /updates/lib +as an actual directory, but the target system had /lib->/usr/lib. +--- + modules.d/90dmsquash-live/apply-live-updates.sh | 20 ++++++++++++++------ + 1 files changed, 14 insertions(+), 6 deletions(-) + +diff --git a/modules.d/90dmsquash-live/apply-live-updates.sh b/modules.d/90dmsquash-live/apply-live-updates.sh +index f840d1a..144e8b9 100755 +--- a/modules.d/90dmsquash-live/apply-live-updates.sh ++++ b/modules.d/90dmsquash-live/apply-live-updates.sh +@@ -1,9 +1,17 @@ + #!/bin/sh +-if [ -b /dev/mapper/live-rw ]; then +- if [ -d /updates ]; then +- echo "Applying updates to live image..." ++ ++. /tmp/root.info ++ ++if [ -b /dev/mapper/live-rw ] && [ -d /updates ]; then ++ info "Applying updates to live image..." ++ # avoid overwriting symlinks (e.g. /lib -> /usr/lib) with directories ++ ( + cd /updates +- /bin/cp -a -t $NEWROOT . +- cd - +- fi ++ find . -depth -type d | while read dir; do ++ [ -d "$NEWROOT/$dir" ] || mkdir -p "$NEWROOT/$dir" ++ done ++ find . -depth \! -type d | while read file; do ++ cp -a "$file" "$NEWROOT/$file" ++ done ++ ) + fi diff --git a/0026-40network-net-genrules.sh-move-ifup-in-the-initqueue.patch b/0026-40network-net-genrules.sh-move-ifup-in-the-initqueue.patch new file mode 100644 index 0000000..23e49ff --- /dev/null +++ b/0026-40network-net-genrules.sh-move-ifup-in-the-initqueue.patch @@ -0,0 +1,47 @@ +From af8c8ed9f651b1617296a2d7654a981f006c5ad3 Mon Sep 17 00:00:00 2001 +From: Harald Hoyer +Date: Fri, 2 Mar 2012 11:39:11 +0100 +Subject: [PATCH] 40network/net-genrules.sh: move ifup in the initqueue + +--- + modules.d/40network/net-genrules.sh | 12 ++++++------ + 1 files changed, 6 insertions(+), 6 deletions(-) + +diff --git a/modules.d/40network/net-genrules.sh b/modules.d/40network/net-genrules.sh +index 323d185..6c46d9a 100755 +--- a/modules.d/40network/net-genrules.sh ++++ b/modules.d/40network/net-genrules.sh +@@ -36,27 +36,27 @@ fix_bootif() { + if [ -n "$BOOTIF" ] ; then + BOOTIF=$(fix_bootif "$BOOTIF") + if [ -n "$netroot" ]; then +- printf 'ACTION=="add", SUBSYSTEM=="net", ATTR{address}=="%s", OPTIONS+="event_timeout=360", RUN+="/sbin/ifup $env{INTERFACE}"\n' "$BOOTIF" ++ printf 'ACTION=="add", SUBSYSTEM=="net", ATTR{address}=="%s", OPTIONS+="event_timeout=360", RUN+="/sbin/initqueue --onetime /sbin/ifup $env{INTERFACE}"\n' "$BOOTIF" + else +- printf 'ACTION=="add", SUBSYSTEM=="net", ATTR{address}=="%s", OPTIONS+="event_timeout=360", RUN+="/sbin/ifup $env{INTERFACE} -m"\n' "$BOOTIF" ++ printf 'ACTION=="add", SUBSYSTEM=="net", ATTR{address}=="%s", OPTIONS+="event_timeout=360", RUN+="/sbin/initqueue --onetime /sbin/ifup $env{INTERFACE} -m"\n' "$BOOTIF" + fi + + # If we have to handle multiple interfaces, handle only them. + elif [ -n "$IFACES" ] ; then + for iface in $IFACES ; do + if [ -n "$netroot" ]; then +- printf 'SUBSYSTEM=="net", ENV{INTERFACE}=="%s", OPTIONS+="event_timeout=360", RUN+="/sbin/ifup $env{INTERFACE}"\n' "$iface" ++ printf 'SUBSYSTEM=="net", ENV{INTERFACE}=="%s", OPTIONS+="event_timeout=360", RUN+="/sbin/initqueue --onetime /sbin/ifup $env{INTERFACE}"\n' "$iface" + else +- printf 'SUBSYSTEM=="net", ENV{INTERFACE}=="%s", OPTIONS+="event_timeout=360", RUN+="/sbin/ifup $env{INTERFACE} -m"\n' "$iface" ++ printf 'SUBSYSTEM=="net", ENV{INTERFACE}=="%s", OPTIONS+="event_timeout=360", RUN+="/sbin/initqueue --onetime /sbin/ifup $env{INTERFACE} -m"\n' "$iface" + fi + done + + # Default: We don't know the interface to use, handle all + else + if [ -n "$netroot" ]; then +- printf 'SUBSYSTEM=="net", OPTIONS+="event_timeout=360", RUN+="/sbin/ifup $env{INTERFACE}"\n' ++ printf 'SUBSYSTEM=="net", OPTIONS+="event_timeout=360", RUN+="/sbin/initqueue --onetime /sbin/ifup $env{INTERFACE}"\n' + else +- printf 'SUBSYSTEM=="net", OPTIONS+="event_timeout=360", RUN+="/sbin/ifup $env{INTERFACE} -m"\n' ++ printf 'SUBSYSTEM=="net", OPTIONS+="event_timeout=360", RUN+="/sbin/initqueue --onetime /sbin/ifup $env{INTERFACE} -m"\n' + fi + fi + diff --git a/0027-dracut-functions.sh-check-for-.kernelmodseen-dir-bef.patch b/0027-dracut-functions.sh-check-for-.kernelmodseen-dir-bef.patch new file mode 100644 index 0000000..1923c0a --- /dev/null +++ b/0027-dracut-functions.sh-check-for-.kernelmodseen-dir-bef.patch @@ -0,0 +1,24 @@ +From 6a2c23d12521c564a3c8bbfc349c677b0e9ac3ad Mon Sep 17 00:00:00 2001 +From: Harald Hoyer +Date: Fri, 2 Mar 2012 12:01:49 +0100 +Subject: [PATCH] dracut-functions.sh: check for .kernelmodseen dir, before + using it + +--- + dracut-functions.sh | 3 ++- + 1 files changed, 2 insertions(+), 1 deletions(-) + +diff --git a/dracut-functions.sh b/dracut-functions.sh +index 20fc6e1..5cf24a7 100755 +--- a/dracut-functions.sh ++++ b/dracut-functions.sh +@@ -994,7 +994,8 @@ install_kmod_with_fw() { + fi + fi + +- > "$initdir/.kernelmodseen/${1##*/}" ++ [ -d "$initdir/.kernelmodseen" ] && \ ++ > "$initdir/.kernelmodseen/${1##*/}" + + inst_simple "$1" "/lib/modules/$kernel/${1##*/lib/modules/$kernel/}" \ + || return $? diff --git a/0028-ifup.sh-check-for-m-to-set-manualup.patch b/0028-ifup.sh-check-for-m-to-set-manualup.patch new file mode 100644 index 0000000..790ddc4 --- /dev/null +++ b/0028-ifup.sh-check-for-m-to-set-manualup.patch @@ -0,0 +1,22 @@ +From 5861184e87e9d9164c093d3600d85c670c828886 Mon Sep 17 00:00:00 2001 +From: Harald Hoyer +Date: Fri, 2 Mar 2012 12:03:38 +0100 +Subject: [PATCH] ifup.sh: check for "-m" to set manualup + +--- + modules.d/40network/ifup.sh | 2 +- + 1 files changed, 1 insertions(+), 1 deletions(-) + +diff --git a/modules.d/40network/ifup.sh b/modules.d/40network/ifup.sh +index b138e8e..b55362c 100755 +--- a/modules.d/40network/ifup.sh ++++ b/modules.d/40network/ifup.sh +@@ -50,7 +50,7 @@ fi + + # disable manual ifup while netroot is set for simplifying our logic + # in netroot case we prefer netroot to bringup $netif automaticlly +-[ -n "$2" ] && [ -z "$netroot" ] && manualup="$2" ++[ -n "$2" -a "$2" = "-m" ] && [ -z "$netroot" ] && manualup="$2" + [ -z "$netroot" ] && [ -z "$manualup" ] && exit 0 + [ -n "$manualup" ] && >/tmp/net.$netif.manualup + diff --git a/0029-get-rid-of-tmp-root.info.patch b/0029-get-rid-of-tmp-root.info.patch new file mode 100644 index 0000000..554baab --- /dev/null +++ b/0029-get-rid-of-tmp-root.info.patch @@ -0,0 +1,130 @@ +From 2c0317213ebe3a6cd0f0db5fb5b7a3da0d42cdda Mon Sep 17 00:00:00 2001 +From: Harald Hoyer +Date: Fri, 2 Mar 2012 14:25:57 +0100 +Subject: [PATCH] get rid of /tmp/root.info + +--- + modules.d/40network/ifup.sh | 2 -- + modules.d/40network/netroot.sh | 2 -- + modules.d/90dmsquash-live/apply-live-updates.sh | 2 -- + modules.d/90dmsquash-live/dmsquash-live-root.sh | 2 -- + modules.d/90livenet/livenetroot.sh | 1 - + modules.d/95iscsi/iscsiroot.sh | 5 +---- + modules.d/99base/init.sh | 11 ++--------- + 7 files changed, 3 insertions(+), 22 deletions(-) + +diff --git a/modules.d/40network/ifup.sh b/modules.d/40network/ifup.sh +index b55362c..ffae15c 100755 +--- a/modules.d/40network/ifup.sh ++++ b/modules.d/40network/ifup.sh +@@ -45,8 +45,6 @@ fi + # bail immediately if the interface is already up + # or we don't need the network + [ -f "/tmp/net.$netif.up" ] && exit 0 +-[ -f "/tmp/root.info" ] || exit 0 +-. /tmp/root.info + + # disable manual ifup while netroot is set for simplifying our logic + # in netroot case we prefer netroot to bringup $netif automaticlly +diff --git a/modules.d/40network/netroot.sh b/modules.d/40network/netroot.sh +index f44a97b..c5ee84c 100755 +--- a/modules.d/40network/netroot.sh ++++ b/modules.d/40network/netroot.sh +@@ -15,8 +15,6 @@ type getarg >/dev/null 2>&1 || . /lib/dracut-lib.sh + # instead of real netroot; If It's called without $2, then there's + # no sense in doing something if no (net)root info is available + # or root is already there +-[ -e /tmp/root.info ] || exit 1 +-. /tmp/root.info + if [ -z "$2" ]; then + [ -d $NEWROOT/proc ] && exit 0 + [ -z "$netroot" ] && exit 1 +diff --git a/modules.d/90dmsquash-live/apply-live-updates.sh b/modules.d/90dmsquash-live/apply-live-updates.sh +index 144e8b9..61da4bf 100755 +--- a/modules.d/90dmsquash-live/apply-live-updates.sh ++++ b/modules.d/90dmsquash-live/apply-live-updates.sh +@@ -1,7 +1,5 @@ + #!/bin/sh + +-. /tmp/root.info +- + if [ -b /dev/mapper/live-rw ] && [ -d /updates ]; then + info "Applying updates to live image..." + # avoid overwriting symlinks (e.g. /lib -> /usr/lib) with directories +diff --git a/modules.d/90dmsquash-live/dmsquash-live-root.sh b/modules.d/90dmsquash-live/dmsquash-live-root.sh +index e3606cf..8a21e44 100755 +--- a/modules.d/90dmsquash-live/dmsquash-live-root.sh ++++ b/modules.d/90dmsquash-live/dmsquash-live-root.sh +@@ -5,8 +5,6 @@ + type getarg >/dev/null 2>&1 || . /lib/dracut-lib.sh + type det_fs >/dev/null 2>&1 || . /lib/fs-lib.sh + +-[ -f /tmp/root.info ] && . /tmp/root.info +- + PATH=/usr/sbin:/usr/bin:/sbin:/bin + + if getargbool 0 rd.live.debug -y rdlivedebug; then +diff --git a/modules.d/90livenet/livenetroot.sh b/modules.d/90livenet/livenetroot.sh +index bc62760..617be62 100755 +--- a/modules.d/90livenet/livenetroot.sh ++++ b/modules.d/90livenet/livenetroot.sh +@@ -2,7 +2,6 @@ + # livenetroot - fetch a live image from the network and run it + + type getarg >/dev/null 2>&1 || . /lib/dracut-lib.sh +-[ -f /tmp/root.info ] && . /tmp/root.info + + . /lib/url-lib.sh + +diff --git a/modules.d/95iscsi/iscsiroot.sh b/modules.d/95iscsi/iscsiroot.sh +index 7b8f63e..1bd6dd3 100755 +--- a/modules.d/95iscsi/iscsiroot.sh ++++ b/modules.d/95iscsi/iscsiroot.sh +@@ -37,9 +37,6 @@ iroot=${iroot#iscsi:} + # figured out a way how to check whether this is built-in or not + modprobe crc32c 2>/dev/null + +- +-[ -e /tmp/root.info ] && . /tmp/root.info +- + [ -e /sys/module/bnx2i ] && iscsiuio + + if getargbool 0 rd.iscsi.firmware -y iscsi_firmware ; then +@@ -54,7 +51,7 @@ fi + + unset iscsi_initiator iscsi_target_name iscsi_target_ip iscsi_target_port + unset iscsi_target_group iscsi_protocol iscsirw iscsi_lun +-unset iscsi_username iscsi_password ++unset iscsi_username iscsi_password + unset iscsi_in_username iscsi_in_password + + # override conf settings by command line options +diff --git a/modules.d/99base/init.sh b/modules.d/99base/init.sh +index d197497..96fd5f2 100755 +--- a/modules.d/99base/init.sh ++++ b/modules.d/99base/init.sh +@@ -131,15 +131,7 @@ source_hook cmdline + [ -z "$root" ] && die "No or empty root= argument" + [ -z "$rootok" ] && die "Don't know how to handle 'root=$root'" + +-# Network root scripts may need updated root= options, +-# so deposit them where they can see them (udev purges the env) +-{ +- echo "root='$root'" +- echo "rflags='$rflags'" +- echo "fstype='$fstype'" +- echo "netroot='$netroot'" +- echo "NEWROOT='$NEWROOT'" +-} > /tmp/root.info ++export root rflags fstype netroot NEWROOT + + # pre-udev scripts run before udev starts, and are run only once. + getarg 'rd.break=pre-udev' 'rdbreak=pre-udev' && emergency_shell -n pre-udev "Break before pre-udev" +@@ -314,6 +306,7 @@ else + fi + + export RD_TIMESTAMP ++export -n root rflags fstype netroot NEWROOT + set +x # Turn off debugging for this section + # Clean up the environment + for i in $(export -p); do diff --git a/0030-TEST-20-NFS-use-ext3-on-server-and-fsck-after-kill.patch b/0030-TEST-20-NFS-use-ext3-on-server-and-fsck-after-kill.patch new file mode 100644 index 0000000..05fa279 --- /dev/null +++ b/0030-TEST-20-NFS-use-ext3-on-server-and-fsck-after-kill.patch @@ -0,0 +1,47 @@ +From b8a9dc2d3fdd7596d4d968f761f56f6ced06e9db Mon Sep 17 00:00:00 2001 +From: Harald Hoyer +Date: Fri, 2 Mar 2012 13:58:48 +0100 +Subject: [PATCH] TEST-20-NFS: use ext3 on server and fsck after kill + +--- + test/TEST-20-NFS/test.sh | 11 ++++++----- + 1 files changed, 6 insertions(+), 5 deletions(-) + +diff --git a/test/TEST-20-NFS/test.sh b/test/TEST-20-NFS/test.sh +index c6a9670..fcd424f 100755 +--- a/test/TEST-20-NFS/test.sh ++++ b/test/TEST-20-NFS/test.sh +@@ -12,8 +12,9 @@ run_server() { + # Start server first + echo "NFS TEST SETUP: Starting DHCP/NFS server" + ++ fsck $TESTDIR/server.ext3 || return 1 + $testdir/run-qemu \ +- -hda $TESTDIR/server.ext2 -m 256M -nographic \ ++ -hda $TESTDIR/server.ext3 -m 256M -nographic \ + -net nic,macaddr=52:54:00:12:34:56,model=e1000 \ + -net socket,listen=127.0.0.1:12320 \ + -serial $SERIAL \ +@@ -203,10 +204,10 @@ test_run() { + + test_setup() { + # Make server root +- dd if=/dev/null of=$TESTDIR/server.ext2 bs=1M seek=60 +- mke2fs -F $TESTDIR/server.ext2 ++ dd if=/dev/null of=$TESTDIR/server.ext3 bs=1M seek=60 ++ mke2fs -j -F $TESTDIR/server.ext3 + mkdir $TESTDIR/mnt +- sudo mount -o loop $TESTDIR/server.ext2 $TESTDIR/mnt ++ sudo mount -o loop $TESTDIR/server.ext3 $TESTDIR/mnt + + kernel=$KVERSION + ( +@@ -307,7 +308,7 @@ test_setup() { + # Make server's dracut image + $basedir/dracut.sh -l -i $TESTDIR/overlay / \ + -m "dash udev-rules base rootfs-block debug kernel-modules" \ +- -d "piix ide-gd_mod ata_piix ext2 sd_mod e1000" \ ++ -d "piix ide-gd_mod ata_piix ext3 sd_mod e1000" \ + -f $TESTDIR/initramfs.server $KVERSION || return 1 + + # Make client's dracut image diff --git a/0031-add-initqueue-to-hookdirs-and-create-them-in-dracut-.patch b/0031-add-initqueue-to-hookdirs-and-create-them-in-dracut-.patch new file mode 100644 index 0000000..4ec1d08 --- /dev/null +++ b/0031-add-initqueue-to-hookdirs-and-create-them-in-dracut-.patch @@ -0,0 +1,60 @@ +From 4fed3ddf16431524f07fc8bbad6aec913b6c0777 Mon Sep 17 00:00:00 2001 +From: Harald Hoyer +Date: Fri, 2 Mar 2012 14:46:11 +0100 +Subject: [PATCH] add "initqueue/*" to hookdirs and create them in dracut + itsself + +now we can just use + inst_hook initqueue/settled 99 "$moddir/pollcdrom.sh" +--- + dracut-functions.sh | 6 ++++-- + dracut.sh | 3 +++ + modules.d/99base/module-setup.sh | 4 ---- + 3 files changed, 7 insertions(+), 6 deletions(-) + +diff --git a/dracut-functions.sh b/dracut-functions.sh +index 5cf24a7..05c1d3a 100755 +--- a/dracut-functions.sh ++++ b/dracut-functions.sh +@@ -34,8 +34,10 @@ fi + + # export standard hookdirs + [[ $hookdirs ]] || { +- hookdirs="cmdline pre-udev pre-trigger netroot initqueue pre-mount" +- hookdirs+=" pre-pivot mount emergency shutdown-emergency shutdown cleanup" ++ hookdirs="cmdline pre-udev pre-trigger netroot " ++ hookdirs+="initqueue initqueue/settled initqueue/finished initqueue/timeout " ++ hookdirs+="pre-mount pre-pivot mount " ++ hookdirs+="emergency shutdown-emergency shutdown cleanup " + export hookdirs + } + +diff --git a/dracut.sh b/dracut.sh +index 88691ae..417008c 100755 +--- a/dracut.sh ++++ b/dracut.sh +@@ -674,6 +674,9 @@ fi + + if [[ $kernel_only != yes ]]; then + mkdir -p "${initdir}/etc/cmdline.d" ++ for _d in $hookdirs; do ++ mkdir -m 0755 -p ${initdir}/lib/dracut/hooks/$_d ++ done + fi + + mkdir -p "$initdir/.kernelmodseen" +diff --git a/modules.d/99base/module-setup.sh b/modules.d/99base/module-setup.sh +index fd92644..5a97770 100755 +--- a/modules.d/99base/module-setup.sh ++++ b/modules.d/99base/module-setup.sh +@@ -33,10 +33,6 @@ install() { + [ -e "${initdir}/lib" ] || mkdir -m 0755 -p ${initdir}/lib + mkdir -m 0755 -p ${initdir}/lib/dracut + mkdir -m 0755 -p ${initdir}/lib/dracut/hooks +- for _d in $hookdirs emergency \ +- initqueue initqueue/timeout initqueue/finished initqueue/settled; do +- mkdir -m 0755 -p ${initdir}/lib/dracut/hooks/$_d +- done + + mkdir -p ${initdir}/tmp + diff --git a/0032-98pollcdrom-factored-out-the-ugly-cdrom-polling-in-t.patch b/0032-98pollcdrom-factored-out-the-ugly-cdrom-polling-in-t.patch new file mode 100644 index 0000000..8091033 --- /dev/null +++ b/0032-98pollcdrom-factored-out-the-ugly-cdrom-polling-in-t.patch @@ -0,0 +1,90 @@ +From 74db72dd0b22973cfd9f3cbe832b09096c4e7ab9 Mon Sep 17 00:00:00 2001 +From: Harald Hoyer +Date: Fri, 2 Mar 2012 14:53:22 +0100 +Subject: [PATCH] 98pollcdrom: factored out the ugly cdrom polling in the main + loop + +--- + modules.d/98pollcdrom/module-setup.sh | 16 ++++++++++++++++ + modules.d/98pollcdrom/pollcdrom.sh | 23 +++++++++++++++++++++++ + modules.d/99base/init.sh | 14 -------------- + 3 files changed, 39 insertions(+), 14 deletions(-) + create mode 100755 modules.d/98pollcdrom/module-setup.sh + create mode 100644 modules.d/98pollcdrom/pollcdrom.sh + +diff --git a/modules.d/98pollcdrom/module-setup.sh b/modules.d/98pollcdrom/module-setup.sh +new file mode 100755 +index 0000000..e80ae16 +--- /dev/null ++++ b/modules.d/98pollcdrom/module-setup.sh +@@ -0,0 +1,16 @@ ++#!/bin/bash ++# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*- ++# ex: ts=8 sw=4 sts=4 et filetype=sh ++ ++check() { ++ return 255 ++} ++ ++depends() { ++ return 0 ++} ++ ++install() { ++ inst_hook initqueue/settled 99 "$moddir/pollcdrom.sh" ++} ++ +diff --git a/modules.d/98pollcdrom/pollcdrom.sh b/modules.d/98pollcdrom/pollcdrom.sh +new file mode 100644 +index 0000000..4abc9d7 +--- /dev/null ++++ b/modules.d/98pollcdrom/pollcdrom.sh +@@ -0,0 +1,23 @@ ++#!/bin/sh ++# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*- ++# ex: ts=8 sw=4 sts=4 et filetype=sh ++# ++# Licensed under the GPLv2 ++# ++# Copyright 2008-2012, Red Hat, Inc. ++# Harald Hoyer ++ ++if [ ! -e /sys/module/block/parameters/events_dfl_poll_msecs ]; then ++ # if the kernel does not support autopolling ++ # then we have to do a ++ # dirty hack for some cdrom drives, ++ # which report no medium for quiet ++ # some time. ++ for cdrom in /sys/block/sr*; do ++ [ -e "$cdrom" ] || continue ++ # skip, if cdrom medium was already found ++ strstr "$(udevadm info --query=env --path=${cdrom##/sys})" \ ++ ID_CDROM_MEDIA && continue ++ echo change > "$cdrom/uevent" ++ done ++fi +diff --git a/modules.d/99base/init.sh b/modules.d/99base/init.sh +index 96fd5f2..f6e4027 100755 +--- a/modules.d/99base/init.sh ++++ b/modules.d/99base/init.sh +@@ -199,20 +199,6 @@ while :; do + # no more udev jobs and queues empty. + sleep 0.5 + +- if [ ! -e /sys/module/block/parameters/events_dfl_poll_msecs ]; then +- # if the kernel does not support autopolling +- # then we have to do a +- # dirty hack for some cdrom drives, +- # which report no medium for quiet +- # some time. +- for cdrom in /sys/block/sr*; do +- [ -e "$cdrom" ] || continue +- # skip, if cdrom medium was already found +- strstr "$(udevadm info --query=env --path=${cdrom##/sys})" \ +- ID_CDROM_MEDIA && continue +- echo change > "$cdrom/uevent" +- done +- fi + + if [ $main_loop -gt $(($RDRETRY/2)) ]; then + for job in $hookdir/initqueue/timeout/*.sh; do diff --git a/0033-move-wait_for_loginit-to-dracut-lib.sh.patch b/0033-move-wait_for_loginit-to-dracut-lib.sh.patch new file mode 100644 index 0000000..e022898 --- /dev/null +++ b/0033-move-wait_for_loginit-to-dracut-lib.sh.patch @@ -0,0 +1,88 @@ +From 4d518aec8614cafe96f585458f97e43d80fe3aa5 Mon Sep 17 00:00:00 2001 +From: Harald Hoyer +Date: Fri, 2 Mar 2012 15:08:25 +0100 +Subject: [PATCH] move wait_for_loginit() to dracut-lib.sh + +--- + modules.d/99base/dracut-lib.sh | 28 ++++++++++++++++++++++++++++ + modules.d/99base/init.sh | 28 ---------------------------- + 2 files changed, 28 insertions(+), 28 deletions(-) + +diff --git a/modules.d/99base/dracut-lib.sh b/modules.d/99base/dracut-lib.sh +index c31854e..80e093b 100755 +--- a/modules.d/99base/dracut-lib.sh ++++ b/modules.d/99base/dracut-lib.sh +@@ -754,6 +754,34 @@ need_shutdown() { + >/run/initramfs/.need_shutdown + } + ++wait_for_loginit() ++{ ++ set +x ++ [ "$RD_DEBUG" = "yes" ] || return ++ [ -e /run/initramfs/loginit.pipe ] || return ++ echo "DRACUT_LOG_END" ++ exec 0<>/dev/console 1<>/dev/console 2<>/dev/console ++ # wait for loginit ++ i=0 ++ while [ $i -lt 10 ]; do ++ if [ ! -e /run/initramfs/loginit.pipe ]; then ++ j=$(jobs) ++ [ -z "$j" ] && break ++ [ -z "${j##*Running*}" ] || break ++ fi ++ sleep 0.1 ++ i=$(($i+1)) ++ done ++ ++ if [ $i -eq 10 ]; then ++ kill %1 >/dev/null 2>&1 ++ kill $(while read line;do echo $line;done /tmp/export.orig + +-wait_for_loginit() +-{ +- set +x +- [ "$RD_DEBUG" = "yes" ] || return +- [ -e /run/initramfs/loginit.pipe ] || return +- echo "DRACUT_LOG_END" +- exec 0<>/dev/console 1<>/dev/console 2<>/dev/console +- # wait for loginit +- i=0 +- while [ $i -lt 10 ]; do +- if [ ! -e /run/initramfs/loginit.pipe ]; then +- j=$(jobs) +- [ -z "$j" ] && break +- [ -z "${j##*Running*}" ] || break +- fi +- sleep 0.1 +- i=$(($i+1)) +- done +- +- if [ $i -eq 10 ]; then +- kill %1 >/dev/null 2>&1 +- kill $(while read line;do echo $line;done +Date: Tue, 6 Mar 2012 18:25:24 -0500 +Subject: [PATCH] network: refactor stuff from netroot/parse-ip-opts to + net-lib + +Add new functions: all_ifaces_up, get_netroot_ip, ip_is_local, ifdown, +setup_net, set_ifname, ibft_to_cmdline + +Use them in netroot.sh and parse-ip-opts.sh. + +There's also a couple little unrelated cleanups. +--- + modules.d/40network/net-lib.sh | 108 ++++++++++++++++++++++++++++++++++ + modules.d/40network/netroot.sh | 71 ++-------------------- + modules.d/40network/parse-ip-opts.sh | 46 ++------------- + 3 files changed, 120 insertions(+), 105 deletions(-) + +diff --git a/modules.d/40network/net-lib.sh b/modules.d/40network/net-lib.sh +index e3987a4..e51ce94 100644 +--- a/modules.d/40network/net-lib.sh ++++ b/modules.d/40network/net-lib.sh +@@ -31,3 +31,111 @@ iface_has_link() { + [ "$(cat $interface/carrier)" = 1 ] || return 1 + # XXX Do we need to reset the flags here? anaconda never bothered.. + } ++ ++all_ifaces_up() { ++ local iface="" IFACES="" ++ [ -e "/tmp/net.ifaces" ] && read IFACES < /tmp/net.ifaces ++ for iface in $IFACES; do ++ [ -e /tmp/net.$iface.up ] || return 1 ++ done ++} ++ ++get_netroot_ip() { ++ local prefix="" server="" rest="" ++ splitsep "$1" ":" prefix server rest ++ case $server in ++ [0-9]*\.[0-9]*\.[0-9]*\.[0-9]*) echo "$server"; return 0 ;; ++ esac ++ return 1 ++} ++ ++ip_is_local() { ++ strstr "$(ip route get $1 2>/dev/null)" " via " ++} ++ ++ifdown() { ++ local netif="$1" ++ # ip down/flush ensures that routing info goes away as well ++ ip link set $netif down ++ ip addr flush dev $netif ++ echo "#empty" > /etc/resolv.conf ++ # TODO: send "offline" uevent? ++} ++ ++setup_net() { ++ local netif="$1" f="" gw_ip="" netroot_ip="" iface="" IFACES="" ++ [ -e /tmp/net.$netif.up ] || return 1 ++ [ -e "/tmp/net.ifaces" ] && read IFACES < /tmp/net.ifaces ++ [ -z "$IFACES" ] && IFACES="$netif" ++ for iface in $IFACES ; do ++ . /tmp/net.$iface.up ++ done ++ # run the scripts written by ifup ++ [ -e /tmp/net.$netif.gw ] && . /tmp/net.$netif.gw ++ [ -e /tmp/net.$netif.hostname ] && . /tmp/net.$netif.hostname ++ [ -e /tmp/net.$netif.override ] && . /tmp/net.$netif.override ++ [ -e /tmp/dhclient.$netif.dhcpopts ] && . /tmp/dhclient.$netif.dhcpopts ++ # set up resolv.conf ++ [ -e /tmp/net.$netif.resolv.conf ] && \ ++ cp -f /tmp/net.$netif.resolv.conf /etc/resolv.conf ++ ++ # Handle STP Timeout: arping the default gateway. ++ # (or the root server, if a) it's local or b) there's no gateway.) ++ # Note: This assumes that if no router is present the ++ # root server is on the same subnet. ++ ++ # Get DHCP-provided router IP, or the cmdline-provided "gw=" argument ++ [ -n "$new_routers" ] && gw_ip=${new_routers%%,*} ++ [ -n "$gw" ] && gw_ip=$gw ++ ++ # Get the "netroot" IP (if there's an IP address in there) ++ netroot_ip=$(get_netroot_ip $netroot) ++ ++ # try netroot if it's local (or there's no gateway) ++ if ip_is_local $netroot_ip || [ -z "$gw_ip" ]; then ++ dest="$netroot_ip" ++ else ++ dest="$gw_ip" ++ fi ++ if [ -n "$dest" ] && ! arping -q -f -w 60 -I $netif $dest ; then ++ info "Resolving $dest via ARP on $netif failed" ++ fi ++} ++ ++set_ifname() { ++ local name="$1" mac="$2" num=0 n="" ++ # if it's already set, return the existing name ++ for n in $(getargs ifname=); do ++ strstr "$n" "$mac" && echo ${n%%:*} && return ++ done ++ # otherwise, pick a new name and use that ++ while [ -e /sys/class/$name$num ]; do num=$(($num+1)); done ++ echo "ifname=$name$num:$mac" >> /etc/cmdline.d/45-ifname.conf ++ echo "$name$num" ++} ++ ++ibft_to_cmdline() { ++ local iface="" mac="" dev="" ++ local dhcp="" ip="" gw="" mask="" hostname="" ++ modprobe -q iscsi_ibft ++ ( ++ for iface in /sys/firmware/ibft/ethernet*; do ++ [ -e ${iface}/mac ] || continue ++ mac=$(read a < ${iface}/mac; echo $a) ++ [ -z "$ifname_mac" ] && continue ++ dev=$(set_ifname ibft $ifname_mac) ++ dhcp=$(read a < ${iface}/dhcp; echo $a) ++ if [ -n "$dhcp" ]; then ++ echo "ip=$dev:dhcp" ++ else ++ ip=$(read a < ${iface}/ip-addr; echo $a) ++ gw=$(read a < ${iface}/gateway; echo $a) ++ mask=$(read a < ${iface}/subnet-mask; echo $a) ++ hostname=$(read a < ${iface}/hostname; echo $a) ++ echo "ip=$ip::$gw:$mask:$hostname:$dev:none" ++ fi ++ done ++ ) >> /etc/cmdline.d/40-ibft.conf ++ # reread cmdline ++ unset CMDLINE ++} +diff --git a/modules.d/40network/netroot.sh b/modules.d/40network/netroot.sh +index c5ee84c..ac1c215 100755 +--- a/modules.d/40network/netroot.sh ++++ b/modules.d/40network/netroot.sh +@@ -3,14 +3,12 @@ + # ex: ts=8 sw=4 sts=4 et filetype=sh + + PATH=/usr/sbin:/usr/bin:/sbin:/bin +-type getarg >/dev/null 2>&1 || . /lib/dracut-lib.sh ++command -v getarg >/dev/null || . /lib/dracut-lib.sh ++command -v setup_net >/dev/null || . /lib/net-lib.sh + + # Huh? Empty $1? + [ -z "$1" ] && exit 1 + +-# Huh? No interface config? +-[ ! -e /tmp/net.$1.up ] && exit 1 +- + # [ ! -z $2 ] means this is for manually bringing up network + # instead of real netroot; If It's called without $2, then there's + # no sense in doing something if no (net)root info is available +@@ -23,10 +21,7 @@ fi + # Let's see if we have to wait for other interfaces + # Note: exit works just fine, since the last interface to be + # online'd should see all files +-[ -e "/tmp/net.ifaces" ] && read IFACES < /tmp/net.ifaces +-for iface in $IFACES ; do +- [ -e /tmp/net.$iface.up ] || exit 1 +-done ++all_ifaces_up || exit 1 + + # Set or override primary interface + netif=$1 +@@ -78,62 +73,13 @@ if [ -z "$2" ]; then + fi + + # We're here, so we can assume that upping interfaces is now ok +-[ -z "$IFACES" ] && IFACES="$netif" +-for iface in $IFACES ; do +- . /tmp/net.$iface.up +-done +- +-[ -e /tmp/net.$netif.gw ] && . /tmp/net.$netif.gw +-[ -e /tmp/net.$netif.hostname ] && . /tmp/net.$netif.hostname +-[ -e /tmp/net.$netif.resolv.conf ] && cp -f /tmp/net.$netif.resolv.conf /etc/resolv.conf +- +-# Load interface options +-[ -e /tmp/net.$netif.override ] && . /tmp/net.$netif.override +-[ -e /tmp/dhclient.$netif.dhcpopts ] && . /tmp/dhclient.$netif.dhcpopts +- +-# Handle STP Timeout: arping the default router if root server is +-# unknown or not local, or if not available the root server. +-# Note: This assumes that if no router is present the +-# root server is on the same subnet. +-# +-# TODO There's some netroot variants that don't (yet) have their +-# server-ip netroot +- +-# Get router IP if set +-[ -n "$new_routers" ] && gw_ip=${new_routers%%,*} +-[ -n "$gw" ] && gw_ip=$gw +-# Get root server IP if set +-if [ -n "$netroot" ]; then +- dummy=${netroot#*:} +- dummy=${dummy%%:*} +- case "$dummy" in +- [0-9]*\.[0-9]*\.[0-9]*\.[0-9]*) netroot_ip=$dummy;; +- esac +-fi +-# Default arping dest to router +-dest="$gw_ip" +-# Change to arping root server if appropriate +-if [ -n "$netroot_ip" ]; then +- if [ -z "$dest" ]; then +- # no gateway so check root server +- dest="$netroot_ip" +- else +- r=$(ip route get "$netroot_ip") +- if ! strstr "$r" ' via ' ; then +- # local root server, so don't arping gateway +- dest="$netroot_ip" +- fi +- fi +-fi +-if [ -n "$dest" ] && ! arping -q -f -w 60 -I $netif $dest ; then +- dinfo "Resolving $dest via ARP on $netif failed" +-fi ++setup_net $netif + + # exit in case manually bring up network + [ -n "$2" ] && exit 0 + + # Source netroot hooks before we start the handler +-source_all $hookdir/netroot ++source_hook netroot + + # Run the handler; don't store the root, it may change from device to device + # XXX other variables to export? +@@ -149,11 +95,6 @@ if $handler $netif $netroot $NEWROOT; then + else + warn "Mounting root via '$netif' failed" + # If we're trying with multiple interfaces, put that one down. +- # ip down/flush ensures that routeing info goes away as well +- if [ -z "$BOOTDEV" ] ; then +- ip link set $netif down +- ip addr flush dev $netif +- echo "#empty" > /etc/resolv.conf +- fi ++ [ -z "$BOOTDEV" ] && ifdown $netif + fi + exit 0 +diff --git a/modules.d/40network/parse-ip-opts.sh b/modules.d/40network/parse-ip-opts.sh +index c97941e..7851329 100755 +--- a/modules.d/40network/parse-ip-opts.sh ++++ b/modules.d/40network/parse-ip-opts.sh +@@ -14,7 +14,8 @@ + # routing,dns,dhcp-options,etc. + # + +-type getarg >/dev/null 2>&1 || . /lib/dracut-lib.sh ++command -v getarg >/dev/null || . /lib/dracut-lib.sh ++command -v ibft_to_cmdline >/dev/null || . /lib/net-lib.sh + + # Check if ip= lines should be used + if getarg ip= >/dev/null ; then +@@ -52,50 +53,15 @@ if [ -n "$NEEDBOOTDEV" ] ; then + [ -z "$BOOTDEV" ] && die "Bootdev argument is empty" + fi + +-if [ "ibft" = "$(getarg ip=)" ]; then +- modprobe iscsi_ibft +- num=0 +- ( +- for iface in /sys/firmware/ibft/ethernet*; do +- [ -e ${iface}/mac ] || continue +- ifname_mac=$(read a < ${iface}/mac; echo $a) +- [ -z "$ifname_mac" ] && continue +- unset dev +- for ifname in $(getargs ifname=); do +- if strstr "$ifname" "$ifname_mac"; then +- dev=${ifname%%:*} +- break +- fi +- done +- if [ -z "$dev" ]; then +- ifname_if=ibft$num +- num=$(( $num + 1 )) +- echo "ifname=$ifname_if:$ifname_mac" +- dev=$ifname_if +- fi +- +- dhcp=$(read a < ${iface}/dhcp; echo $a) +- if [ -n "$dhcp" ]; then +- echo "ip=$dev:dhcp" +- else +- ip=$(read a < ${iface}/ip-addr; echo $a) +- gw=$(read a < ${iface}/gateway; echo $a) +- mask=$(read a < ${iface}/subnet-mask; echo $a) +- hostname=$(read a < ${iface}/hostname; echo $a) +- echo "ip=$ip::$gw:$mask:$hostname:$dev:none" +- fi +- done +- ) >> /etc/cmdline +- # reread cmdline +- unset CMDLINE +-fi ++# If ibft is requested, read ibft vals and write ip=XXX cmdline args ++[ "ibft" = "$(getarg ip=)" ] && ibft_to_cmdline + + # Check ip= lines + # XXX Would be nice if we could errorcheck ip addresses here as well + for p in $(getargs ip=); do + ip_to_var $p + +- # skip ibft ++ # skip ibft since we did it above + [ "$autoconf" = "ibft" ] && continue + + # We need to have an ip= line for the specified bootdev +@@ -111,7 +77,7 @@ for p in $(getargs ip=); do + case $autoconf in + error) die "Error parsing option 'ip=$p'";; + bootp|rarp|both) die "Sorry, ip=$autoconf is currenty unsupported";; +- none|off) \ ++ none|off) + [ -z "$ip" ] && \ + die "For argument 'ip=$p'\nValue '$autoconf' without static configuration does not make sense" + [ -z "$mask" ] && \ diff --git a/0035-add-initqueue-env-and-online-hook.patch b/0035-add-initqueue-env-and-online-hook.patch new file mode 100644 index 0000000..f2bda1d --- /dev/null +++ b/0035-add-initqueue-env-and-online-hook.patch @@ -0,0 +1,109 @@ +From 6e3cc00f4882edbabea75945308f8ae7c353bf82 Mon Sep 17 00:00:00 2001 +From: Will Woods +Date: Tue, 6 Mar 2012 18:25:25 -0500 +Subject: [PATCH] add initqueue --env and "online" hook + +The "online" hook runs whenever a network interface comes online (that +is, once it's actually up and configured). + +The initqueue --env argument is used to set "$netif" to the name of the +newly-online network interface. +--- + dracut-functions.sh | 2 +- + modules.d/40network/net-genrules.sh | 24 +++++++++--------------- + modules.d/99base/initqueue.sh | 15 +++++++-------- + 3 files changed, 17 insertions(+), 24 deletions(-) + +diff --git a/dracut-functions.sh b/dracut-functions.sh +index 05c1d3a..f4ccf53 100755 +--- a/dracut-functions.sh ++++ b/dracut-functions.sh +@@ -35,7 +35,7 @@ fi + # export standard hookdirs + [[ $hookdirs ]] || { + hookdirs="cmdline pre-udev pre-trigger netroot " +- hookdirs+="initqueue initqueue/settled initqueue/finished initqueue/timeout " ++ hookdirs+="initqueue initqueue/settled initqueue/online initqueue/finished initqueue/timeout " + hookdirs+="pre-mount pre-pivot mount " + hookdirs+="emergency shutdown-emergency shutdown cleanup " + export hookdirs +diff --git a/modules.d/40network/net-genrules.sh b/modules.d/40network/net-genrules.sh +index 6c46d9a..84fd3ac 100755 +--- a/modules.d/40network/net-genrules.sh ++++ b/modules.d/40network/net-genrules.sh +@@ -31,33 +31,27 @@ fix_bootif() { + IFACES=${bondslaves%% *} + fi + ++ ifup='/sbin/ifup $env{INTERFACE}' ++ [ -z "$netroot" ] && ifup="$ifup -m" ++ + # BOOTIF says everything, use only that one + BOOTIF=$(getarg 'BOOTIF=') + if [ -n "$BOOTIF" ] ; then + BOOTIF=$(fix_bootif "$BOOTIF") +- if [ -n "$netroot" ]; then +- printf 'ACTION=="add", SUBSYSTEM=="net", ATTR{address}=="%s", OPTIONS+="event_timeout=360", RUN+="/sbin/initqueue --onetime /sbin/ifup $env{INTERFACE}"\n' "$BOOTIF" +- else +- printf 'ACTION=="add", SUBSYSTEM=="net", ATTR{address}=="%s", OPTIONS+="event_timeout=360", RUN+="/sbin/initqueue --onetime /sbin/ifup $env{INTERFACE} -m"\n' "$BOOTIF" +- fi ++ printf 'ACTION=="add", SUBSYSTEM=="net", ATTR{address}=="%s", RUN+="%s"\n' "$BOOTIF" "/sbin/initqueue --onetime $ifup" + + # If we have to handle multiple interfaces, handle only them. + elif [ -n "$IFACES" ] ; then + for iface in $IFACES ; do +- if [ -n "$netroot" ]; then +- printf 'SUBSYSTEM=="net", ENV{INTERFACE}=="%s", OPTIONS+="event_timeout=360", RUN+="/sbin/initqueue --onetime /sbin/ifup $env{INTERFACE}"\n' "$iface" +- else +- printf 'SUBSYSTEM=="net", ENV{INTERFACE}=="%s", OPTIONS+="event_timeout=360", RUN+="/sbin/initqueue --onetime /sbin/ifup $env{INTERFACE} -m"\n' "$iface" +- fi ++ printf 'SUBSYSTEM=="net", ENV{INTERFACE}=="%s", RUN+="%s"\n' "$iface" "/sbin/initqueue --onetime $ifup" + done + + # Default: We don't know the interface to use, handle all + else +- if [ -n "$netroot" ]; then +- printf 'SUBSYSTEM=="net", OPTIONS+="event_timeout=360", RUN+="/sbin/initqueue --onetime /sbin/ifup $env{INTERFACE}"\n' +- else +- printf 'SUBSYSTEM=="net", OPTIONS+="event_timeout=360", RUN+="/sbin/initqueue --onetime /sbin/ifup $env{INTERFACE} -m"\n' +- fi ++ printf 'SUBSYSTEM=="net", RUN+="%s"\n' "/sbin/initqueue --onetime $ifup" + fi + ++ # Run the "online" hook ++ printf 'SUBSYSTEM=="net", ACTION=="online", RUN+="/sbin/initqueue --onetime --env netif=$env{INTERFACE} source_hook initqueue/online"\n' ++ + } > /etc/udev/rules.d/60-net.rules +diff --git a/modules.d/99base/initqueue.sh b/modules.d/99base/initqueue.sh +index 2c06a0b..3387e88 100755 +--- a/modules.d/99base/initqueue.sh ++++ b/modules.d/99base/initqueue.sh +@@ -25,6 +25,8 @@ while [ $# -gt 0 ]; do + unique="yes";; + --name) + name="$2";shift;; ++ --env) ++ env="$2"; shift;; + *) + break;; + esac +@@ -43,14 +45,11 @@ shift + + [ -x "$exe" ] || exe=$(command -v $exe) + +-if [ -n "$onetime" ]; then +- { +- echo '[ -e "$job" ] && rm "$job"' +- echo "$exe $@" +- } > "/tmp/$$-${job}.sh" +-else +- echo "$exe $@" > "/tmp/$$-${job}.sh" +-fi ++{ ++ [ -n "$onetime" ] && echo '[ -e "$job" ] && rm "$job"' ++ [ -n "$env" ] && echo "$env" ++ echo "$exe $@" ++} > "/tmp/$$-${job}.sh" + + mv -f "/tmp/$$-${job}.sh" "$hookdir/initqueue${qname}/${job}.sh" + [ -z "$qname" ] && >> $hookdir/initqueue/work diff --git a/0036-TEST-20-NFS-test.sh-fsck-with-a.patch b/0036-TEST-20-NFS-test.sh-fsck-with-a.patch new file mode 100644 index 0000000..ad5b997 --- /dev/null +++ b/0036-TEST-20-NFS-test.sh-fsck-with-a.patch @@ -0,0 +1,22 @@ +From 0635530dda6e12e2475b43bd65ca4943ce36a7e7 Mon Sep 17 00:00:00 2001 +From: Harald Hoyer +Date: Thu, 8 Mar 2012 12:25:30 +0100 +Subject: [PATCH] TEST-20-NFS/test.sh: fsck with "-a" + +--- + test/TEST-20-NFS/test.sh | 2 +- + 1 files changed, 1 insertions(+), 1 deletions(-) + +diff --git a/test/TEST-20-NFS/test.sh b/test/TEST-20-NFS/test.sh +index fcd424f..a6bde0e 100755 +--- a/test/TEST-20-NFS/test.sh ++++ b/test/TEST-20-NFS/test.sh +@@ -12,7 +12,7 @@ run_server() { + # Start server first + echo "NFS TEST SETUP: Starting DHCP/NFS server" + +- fsck $TESTDIR/server.ext3 || return 1 ++ fsck -a $TESTDIR/server.ext3 || return 1 + $testdir/run-qemu \ + -hda $TESTDIR/server.ext3 -m 256M -nographic \ + -net nic,macaddr=52:54:00:12:34:56,model=e1000 \ diff --git a/0037-95iscsi-iscsiroot.sh-fix-for-empty-root.patch b/0037-95iscsi-iscsiroot.sh-fix-for-empty-root.patch new file mode 100644 index 0000000..4a7b94a --- /dev/null +++ b/0037-95iscsi-iscsiroot.sh-fix-for-empty-root.patch @@ -0,0 +1,50 @@ +From f8208d682fad279bebb2019c5df57f8d42b133c6 Mon Sep 17 00:00:00 2001 +From: Harald Hoyer +Date: Thu, 8 Mar 2012 12:26:00 +0100 +Subject: [PATCH] 95iscsi/iscsiroot.sh: fix for empty $root + +--- + modules.d/95iscsi/iscsiroot.sh | 15 ++++++--------- + 1 files changed, 6 insertions(+), 9 deletions(-) + +diff --git a/modules.d/95iscsi/iscsiroot.sh b/modules.d/95iscsi/iscsiroot.sh +index 1bd6dd3..7fa2715 100755 +--- a/modules.d/95iscsi/iscsiroot.sh ++++ b/modules.d/95iscsi/iscsiroot.sh +@@ -40,7 +40,7 @@ modprobe crc32c 2>/dev/null + [ -e /sys/module/bnx2i ] && iscsiuio + + if getargbool 0 rd.iscsi.firmware -y iscsi_firmware ; then +- if [ -n "${root%%block:*}" ]; then ++ if [ -z "$root" -o -n "${root%%block:*}" ]; then + # if root is not specified try to mount the whole iSCSI LUN + printf 'ENV{DEVTYPE}!="partition", SYMLINK=="disk/by-path/*-iscsi-*-*", SYMLINK+="root"\n' >> /etc/udev/rules.d/99-iscsi-root.rules + udevadm control --reload +@@ -167,9 +167,12 @@ handle_netroot() + + # FIXME $iscsi_protocol?? + +- if [ -n "${root%%block:*}" ]; then +- # if root is not specified try to mount the whole iSCSI LUN ++ if [ -z "$root" -o -n "${root%%block:*}" ]; then ++ # if root is not specified try to mount the whole iSCSI LUN + printf 'SYMLINK=="disk/by-path/*-iscsi-*-%s", SYMLINK+="root"\n' $iscsi_lun >> /etc/udev/rules.d/99-iscsi-root.rules ++ ++ # install mount script ++ echo "iscsi_lun=$iscsi_lun . /bin/mount-lun.sh " > $hookdir/mount/01-$$-iscsi.sh + fi + + # inject new exit_if_exists +@@ -185,12 +188,6 @@ handle_netroot() + ${iscsi_password+-w $iscsi_password} \ + ${iscsi_in_username+-U $iscsi_in_username} \ + ${iscsi_in_password+-W $iscsi_in_password} || : +- +-# install mount script +- if [ -n "${root%%block:*}" ]; then +- # if root is not specified try to mount the whole iSCSI LUN +- echo "iscsi_lun=$iscsi_lun . /bin/mount-lun.sh " > $hookdir/mount/01-$$-iscsi.sh +- fi + } + + # loop over all netroot parameter diff --git a/0038-dracut.spec-add-98pollcdrom.patch b/0038-dracut.spec-add-98pollcdrom.patch new file mode 100644 index 0000000..6b9e5aa --- /dev/null +++ b/0038-dracut.spec-add-98pollcdrom.patch @@ -0,0 +1,21 @@ +From d33d60774f38f43053c2cd1811b78c4f1af0fdc9 Mon Sep 17 00:00:00 2001 +From: Harald Hoyer +Date: Thu, 8 Mar 2012 13:40:21 +0100 +Subject: [PATCH] dracut.spec: add 98pollcdrom + +--- + dracut.spec | 1 + + 1 files changed, 1 insertions(+), 0 deletions(-) + +diff --git a/dracut.spec b/dracut.spec +index 91b3451..0275af3 100644 +--- a/dracut.spec ++++ b/dracut.spec +@@ -272,6 +272,7 @@ rm -rf $RPM_BUILD_ROOT + %{dracutlibdir}/modules.d/97masterkey + %{dracutlibdir}/modules.d/98ecryptfs + %{dracutlibdir}/modules.d/98integrity ++%{dracutlibdir}/modules.d/98pollcdrom + %{dracutlibdir}/modules.d/98selinux + %{dracutlibdir}/modules.d/98syslog + %{dracutlibdir}/modules.d/98usrmount diff --git a/dracut.spec b/dracut.spec index 5d2d072..f7f3dba 100644 --- a/dracut.spec +++ b/dracut.spec @@ -10,7 +10,7 @@ Name: dracut Version: 017 -Release: 22.git20120302%{?dist} +Release: 39.git20120308%{?dist} Summary: Initramfs generator using udev %if 0%{?fedora} || 0%{?rhel} @@ -45,6 +45,23 @@ Patch18: 0018-dracut-functions.sh-install_kmod_with_fw-delay-.kern.patch Patch19: 0019-Fix-correct-nfs-path.patch Patch20: 0020-move-emergency_shell-to-dracut-lib.sh.patch Patch21: 0021-url-lib-make-nfs-support-optional.patch +Patch22: 0022-40network-kill-dhclient.sh-kill-dhclient-silently.patch +Patch23: 0023-write-ifcfg.sh-cleanups.patch +Patch24: 0024-write-ifcfg.sh-add-UUID-.-and-save-the-lease-files-w.patch +Patch25: 0025-fix-apply-live-updates-failing-because-of-lib-symlin.patch +Patch26: 0026-40network-net-genrules.sh-move-ifup-in-the-initqueue.patch +Patch27: 0027-dracut-functions.sh-check-for-.kernelmodseen-dir-bef.patch +Patch28: 0028-ifup.sh-check-for-m-to-set-manualup.patch +Patch29: 0029-get-rid-of-tmp-root.info.patch +Patch30: 0030-TEST-20-NFS-use-ext3-on-server-and-fsck-after-kill.patch +Patch31: 0031-add-initqueue-to-hookdirs-and-create-them-in-dracut-.patch +Patch32: 0032-98pollcdrom-factored-out-the-ugly-cdrom-polling-in-t.patch +Patch33: 0033-move-wait_for_loginit-to-dracut-lib.sh.patch +Patch34: 0034-network-refactor-stuff-from-netroot-parse-ip-opts-to.patch +Patch35: 0035-add-initqueue-env-and-online-hook.patch +Patch36: 0036-TEST-20-NFS-test.sh-fsck-with-a.patch +Patch37: 0037-95iscsi-iscsiroot.sh-fix-for-empty-root.patch +Patch38: 0038-dracut.spec-add-98pollcdrom.patch BuildArch: noarch @@ -294,6 +311,7 @@ rm -rf $RPM_BUILD_ROOT %{dracutlibdir}/modules.d/97masterkey %{dracutlibdir}/modules.d/98ecryptfs %{dracutlibdir}/modules.d/98integrity +%{dracutlibdir}/modules.d/98pollcdrom %{dracutlibdir}/modules.d/98selinux %{dracutlibdir}/modules.d/98syslog %{dracutlibdir}/modules.d/98usrmount @@ -348,6 +366,12 @@ rm -rf $RPM_BUILD_ROOT %dir /var/lib/dracut/overlay %changelog +* Thu Mar 08 2012 Harald Hoyer 017-39.git20120308 +- kill dhclient silently +- cleanup and fix network config writeout to /run/initramfs/state +Resolves: rhbz#799989 +- various cleanups + * Fri Mar 02 2012 Harald Hoyer 017-22.git20120302 - nfs path fixes for live image over nfs root=live:nfs://10.10.10.10:/srv/all/install.img ip=dhcp rd.neednet