[dracut] dracut-027-17.git20130409

Harald Hoyer harald at fedoraproject.org
Tue Apr 9 12:40:06 UTC 2013


commit ab11ed5290214e793ef6e6251f8d9c30ded85f33
Author: Harald Hoyer <harald at redhat.com>
Date:   Tue Apr 9 14:39:24 2013 +0200

    dracut-027-17.git20130409
    
    - only include needed /etc/crypttab entries
    Resolves:rhbz#919752
    - add support for bridge over team and vlan
    - support multiple bonding interfaces
    - add "action_on_fail=" kernel command line parameter
    - add support for bridge over a vlan tagged interface

 ...setup.sh-combine-egreps-for-etc-passwd-an.patch |   29 +++
 0011-dracut-functions.sh-make-use-of-findmnt.patch |  209 ++++++++++++++++++
 ...e-setup.sh-filter-etc-crypttab-in-host-on.patch |   38 ++++
 ...-support-for-bridge-over-team-and-vlan-ta.patch |   54 +++++
 ...twork-support-multiple-bonding-interfaces.patch |  145 +++++++++++++
 0015-Wait-for-logical-interface-to-be-up.patch     |   57 +++++
 0016-Let-user-specify-the-action-after-fail.patch  |  222 ++++++++++++++++++++
 ...-support-for-bridge-over-a-vlan-tagged-in.patch |   85 ++++++++
 dracut.spec                                        |   18 ++-
 9 files changed, 856 insertions(+), 1 deletions(-)
---
diff --git a/0010-nfs-module-setup.sh-combine-egreps-for-etc-passwd-an.patch b/0010-nfs-module-setup.sh-combine-egreps-for-etc-passwd-an.patch
new file mode 100644
index 0000000..4395394
--- /dev/null
+++ b/0010-nfs-module-setup.sh-combine-egreps-for-etc-passwd-an.patch
@@ -0,0 +1,29 @@
+From 41bfa5dad1d0a1ccdef70bd74068e5d4d67d5e27 Mon Sep 17 00:00:00 2001
+From: Harald Hoyer <harald at redhat.com>
+Date: Fri, 5 Apr 2013 16:34:36 +0200
+Subject: [PATCH] nfs/module-setup.sh: combine egreps for /etc/passwd and
+ /etc/group
+
+---
+ modules.d/95nfs/module-setup.sh | 8 ++------
+ 1 file changed, 2 insertions(+), 6 deletions(-)
+
+diff --git a/modules.d/95nfs/module-setup.sh b/modules.d/95nfs/module-setup.sh
+index 7c3a64d..6d4d412 100755
+--- a/modules.d/95nfs/module-setup.sh
++++ b/modules.d/95nfs/module-setup.sh
+@@ -62,12 +62,8 @@ install() {
+ 
+     # Rather than copy the passwd file in, just set a user for rpcbind
+     # We'll save the state and restart the daemon from the root anyway
+-    egrep '^nfsnobody:' /etc/passwd >> "$initdir/etc/passwd"
+-    egrep '^rpc:' /etc/passwd >> "$initdir/etc/passwd"
+-    egrep '^rpcuser:' /etc/passwd >> "$initdir/etc/passwd"
+-    #type -P nologin >/dev/null && dracut_install nologin
+-    egrep '^nobody:' /etc/group >> "$initdir/etc/group"
+-    egrep '^rpc:' /etc/group >> "$initdir/etc/group"
++    egrep '^nfsnobody:|^rpc:|^rpcuser:' /etc/passwd >> "$initdir/etc/passwd"
++    egrep '^nogroup:|^rpc:|^nobody:' /etc/group >> "$initdir/etc/group"
+ 
+     # rpc user needs to be able to write to this directory to save the warmstart
+     # file
diff --git a/0011-dracut-functions.sh-make-use-of-findmnt.patch b/0011-dracut-functions.sh-make-use-of-findmnt.patch
new file mode 100644
index 0000000..7a1d930
--- /dev/null
+++ b/0011-dracut-functions.sh-make-use-of-findmnt.patch
@@ -0,0 +1,209 @@
+From 9d36d4fb1d0774d9ef0597abb79390e88771bf1e Mon Sep 17 00:00:00 2001
+From: Harald Hoyer <harald at redhat.com>
+Date: Tue, 9 Apr 2013 10:47:39 +0200
+Subject: [PATCH] dracut-functions.sh: make use of findmnt
+
+---
+ dracut-functions.sh | 163 +++++++++++++++++++++-------------------------------
+ 1 file changed, 64 insertions(+), 99 deletions(-)
+
+diff --git a/dracut-functions.sh b/dracut-functions.sh
+index eba7412..96d3c6e 100755
+--- a/dracut-functions.sh
++++ b/dracut-functions.sh
+@@ -319,131 +319,96 @@ get_maj_min() {
+ # $ find_block_device /usr
+ # 8:4
+ find_block_device() {
+-    local _x _mpt _majmin _dev _fs _maj _min _find_mpt
++    local _majmin _dev _majmin _find_mpt
+     _find_mpt="$1"
+     if [[ $use_fstab != yes ]]; then
+-        while read _x; do
+-            set -- $_x
+-            _majmin="$3"
+-            _mpt="$5"
+-            [[ $8 = "-" ]] && shift
+-            _fs="$8"
+-            _dev="$9"
+-            [[ $_mpt = $_find_mpt ]] || continue
+-            [[ $_fs = nfs ]] && { echo $_dev; return 0;}
+-            [[ $_fs = nfs3 ]] && { echo $_dev; return 0;}
+-            [[ $_fs = nfs4 ]] && { echo $_dev; return 0;}
+-            [[ $_fs = btrfs ]] && {
+-                get_maj_min $_dev
+-                return 0;
+-            }
+-            if [[ ${_majmin#0:} = $_majmin ]]; then
+-                echo $_majmin
+-                return 0 # we have a winner!
++        [[ -d $_find_mpt/. ]]
++        while read _majmin _dev; do
++            if [[ -b $_dev ]]; then
++                if ! [[ $_majmin ]] || [[ $_majmin == 0:* ]]; then
++                    read _majmin < <(get_maj_min $_dev)
++                fi
++                if [[ $_majmin ]]; then
++                    echo $_majmin
++                else
++                    echo $_dev
++                fi
++                return 0
++            fi
++            if [[ $_dev = *:* ]]; then
++                echo $_dev
++                return 0
+             fi
+-        done < /proc/self/mountinfo
++        done < <(findmnt -e -v -n -o 'MAJ:MIN,SOURCE' "$_find_mpt")
+     fi
+     # fall back to /etc/fstab
+-    while read _dev _mpt _fs _x; do
+-        [ "${_dev%%#*}" != "$_dev" ] && continue
+-
+-        if [[ $_mpt = $_find_mpt ]]; then
+-            [[ $_fs = nfs ]] && { echo $_dev; return 0;}
+-            [[ $_fs = nfs3 ]] && { echo $_dev; return 0;}
+-            [[ $_fs = nfs4 ]] && { echo $_dev; return 0;}
+-            [[ $_dev != ${_dev#UUID=} ]] && _dev=/dev/disk/by-uuid/${_dev#UUID=}
+-            [[ $_dev != ${_dev#LABEL=} ]] && _dev=/dev/disk/by-label/${_dev#LABEL=}
+-            [[ -b $_dev ]] || return 1 # oops, not a block device.
+-            get_maj_min "$_dev" && return 0
++
++    while read _majmin _dev; do
++        if ! [[ $_dev ]]; then
++            _dev="$_majmin"
++            unset _majmin
++        fi
++        if [[ -b $_dev ]]; then
++            [[ $_majmin ]] || read _majmin < <(get_maj_min $_dev)
++            if [[ $_majmin ]]; then
++                echo $_majmin
++            else
++                echo $_dev
++            fi
++            return 0
++        fi
++        if [[ $_dev = *:* ]]; then
++            echo $_dev
++            return 0
+         fi
+-    done < /etc/fstab
++    done < <(findmnt -e --fstab -v -n -o 'MAJ:MIN,SOURCE' "$_find_mpt")
+ 
+     return 1
+ }
+ 
+-# find_dev_fstype <device>
+-# Echo the filesystem type for a given device.
++# find_mp_fstype <mountpoint>
++# Echo the filesystem type for a given mountpoint.
+ # /proc/self/mountinfo is taken as the primary source of information
+ # and /etc/fstab is used as a fallback.
+ # No newline is appended!
+ # Example:
+-# $ find_dev_fstype /dev/sda2;echo
++# $ find_mp_fstype /;echo
+ # ext4
+-find_dev_fstype() {
+-    local _x _mpt _majmin _dev _fs _maj _min _find_dev
+-    _find_dev="$1"
+-    strstr "$_find_dev" "/dev" || _find_dev="/dev/block/$_find_dev"
+-    while read _x; do
+-        set -- $_x
+-        _majmin="$3"
+-        _mpt="$5"
+-        [[ $8 = "-" ]] && shift
+-        _fs="$8"
+-        _dev="$9"
+-        strstr "$_dev" "/dev" || continue
+-        [[ $_dev -ef $_find_dev ]] || continue
+-        [[ $_fs = "autofs" ]] && continue
+-        echo -n $_fs;
+-        return 0;
+-    done < /proc/self/mountinfo
++find_mp_fstype() {
++    local _fs
+ 
+-    # fall back to /etc/fstab
+-    while read _dev _mpt _fs _x; do
+-        [ "${_dev%%#*}" != "$_dev" ] && continue
+-        case "$_dev" in
+-            LABEL=*)
+-                _dev="$(echo $_dev | sed 's,/,\\x2f,g')"
+-                _dev="/dev/disk/by-label/${_dev#LABEL=}"
+-                ;;
+-            UUID=*)
+-                _dev="/dev/disk/by-uuid/${_dev#UUID=}"
+-                ;;
+-            PARTUUID=*)
+-                _dev="/dev/disk/by-partuuid/${_dev#PARTUUID=}"
+-                ;;
+-        esac
++    if [[ $use_fstab != yes ]]; then
++        while read _fs; do
++            [[ $_fs ]] || continue
++            [[ $_fs = "autofs" ]] && continue
++            echo -n $_fs
++            return 0
++        done < <(findmnt -e -v -n -o 'FSTYPE' "$1")
++    fi
+ 
+-        [[ $_dev -ef $_find_dev ]] || continue
+-        echo -n $_fs;
+-        return 0;
+-    done < /etc/fstab
++    while read _fs; do
++        [[ $_fs ]] || continue
++        [[ $_fs = "autofs" ]] && continue
++        echo -n $_fs
++        return 0
++    done < <(findmnt --fstab -e -v -n -o 'FSTYPE' "$1")
+ 
+     return 1
+ }
+ 
+-# find_mp_fstype <mountpoint>
+-# Echo the filesystem type for a given mountpoint.
++# find_dev_fstype <device>
++# Echo the filesystem type for a given device.
+ # /proc/self/mountinfo is taken as the primary source of information
+ # and /etc/fstab is used as a fallback.
+ # No newline is appended!
+ # Example:
+-# $ find_mp_fstype /;echo
++# $ find_dev_fstype /dev/sda2;echo
+ # ext4
+-find_mp_fstype() {
+-    local _x _mpt _majmin _dev _fs _maj _min _find_mpt
+-    _find_mpt="$1"
+-    while read _x; do
+-        set -- $_x
+-        _majmin="$3"
+-        _mpt="$5"
+-        [[ $8 = "-" ]] && shift
+-        _fs="$8"
+-        _dev="$9"
+-        [[ $_mpt = $_find_mpt ]] || continue
+-        [[ $_fs = "autofs" ]] && continue
+-        echo -n $_fs;
+-        return 0;
+-    done < /proc/self/mountinfo
+-
+-    # fall back to /etc/fstab
+-    while read _dev _mpt _fs _x; do
+-        [ "${_dev%%#*}" != "$_dev" ] && continue
+-        [[ $_mpt = $_find_mpt ]] || continue
+-        echo -n $_fs;
+-        return 0;
+-    done < /etc/fstab
+-
+-    return 1
++find_dev_fstype() {
++    local _x _mpt _majmin _dev _fs _maj _min _find_dev
++    _find_dev="$1"
++    [[ "$_find_dev" = /dev* ]] || _find_dev="/dev/block/$_find_dev"
++    find_mp_fstype "$_find_dev"
+ }
+ 
+ # finds the major:minor of the block device backing the root filesystem.
diff --git a/0012-crypt-module-setup.sh-filter-etc-crypttab-in-host-on.patch b/0012-crypt-module-setup.sh-filter-etc-crypttab-in-host-on.patch
new file mode 100644
index 0000000..698a708
--- /dev/null
+++ b/0012-crypt-module-setup.sh-filter-etc-crypttab-in-host-on.patch
@@ -0,0 +1,38 @@
+From 96efbc51acd7f65f0f254b17d87da7d0465032c1 Mon Sep 17 00:00:00 2001
+From: Harald Hoyer <harald at redhat.com>
+Date: Tue, 9 Apr 2013 10:48:26 +0200
+Subject: [PATCH] crypt/module-setup.sh: filter /etc/crypttab in host-only mode
+
+only take those /etc/crypttab entries, which we need to boot the system
+---
+ modules.d/90crypt/module-setup.sh | 17 ++++++++++++++++-
+ 1 file changed, 16 insertions(+), 1 deletion(-)
+
+diff --git a/modules.d/90crypt/module-setup.sh b/modules.d/90crypt/module-setup.sh
+index b76f6ae..3c9a1f1 100755
+--- a/modules.d/90crypt/module-setup.sh
++++ b/modules.d/90crypt/module-setup.sh
+@@ -56,7 +56,22 @@ install() {
+     if ! dracut_module_included "systemd"; then
+         inst_hook cleanup 30 "$moddir/crypt-cleanup.sh"
+     fi
+-    [[ $hostonly ]]  && inst_simple /etc/crypttab
++
++    if [[ $hostonly ]]; then
++        # filter /etc/crypttab for the devices we need
++        while read _mapper _dev _rest; do
++            [[ $_mapper = \#* ]] && continue
++            [[ $_dev ]] || continue
++            for _hdev in "${!host_fs_types[@]}"; do
++                [[ ${host_fs_types[$_hdev]} == "crypto_LUKS" ]] || continue
++                if [[ $_hdev -ef $_dev ]] || [[ /dev/block/$_hdev -ef $_dev ]]; then
++                    echo "$_mapper $_dev $_rest"
++                    break
++                fi
++            done
++        done < /etc/crypttab > $initdir/etc/crypttab
++    fi
++
+     inst_simple "$moddir/crypt-lib.sh" "/lib/dracut-crypt-lib.sh"
+ 
+     dracut_install -o \
diff --git a/0013-ifup.sh-Add-support-for-bridge-over-team-and-vlan-ta.patch b/0013-ifup.sh-Add-support-for-bridge-over-team-and-vlan-ta.patch
new file mode 100644
index 0000000..eaee22e
--- /dev/null
+++ b/0013-ifup.sh-Add-support-for-bridge-over-team-and-vlan-ta.patch
@@ -0,0 +1,54 @@
+From a55f910cf6f13e1a6d9d5be769297ee3ecc64bb9 Mon Sep 17 00:00:00 2001
+From: WANG Chao <chaowang at redhat.com>
+Date: Mon, 1 Apr 2013 20:34:40 +0800
+Subject: [PATCH] ifup.sh: Add support for bridge over team and vlan tagged
+ team
+
+Team is the same network stack as bonding. Therefore give ifup the ability to
+handle bridge over team and vlan tagged team as bonding too.
+
+Signed-off-by: WANG Chao <chaowang at redhat.com>
+---
+ modules.d/40network/ifup.sh | 8 ++++++++
+ 1 file changed, 8 insertions(+)
+
+diff --git a/modules.d/40network/ifup.sh b/modules.d/40network/ifup.sh
+index 582278f..815ab64 100755
+--- a/modules.d/40network/ifup.sh
++++ b/modules.d/40network/ifup.sh
+@@ -46,6 +46,8 @@ if [ -e /tmp/bridge.info ]; then
+         if [ "$netif" = "$ethname" ]; then
+             if [ "$netif" = "$bondname" ] && [ -n "$DO_BOND_SETUP" ] ; then
+                 : # We need to really setup bond (recursive call)
++            elif [ "$netif" = "$teammaster" ] && [ -n "$DO_TEAM_SETUP" ] ; then
++                : # We need to really setup team (recursive call)
+             else
+                 netif="$bridgename"
+                 use_bridge='true'
+@@ -59,6 +61,8 @@ if [ -e /tmp/vlan.info ]; then
+     if [ "$netif" = "$phydevice" ]; then
+         if [ "$netif" = "$bondname" ] && [ -n "$DO_BOND_SETUP" ] ; then
+             : # We need to really setup bond (recursive call)
++        elif [ "$netif" = "$teammaster" ] && [ -n "$DO_TEAM_SETUP" ] ; then
++            : # We need to really setup team (recursive call)
+         else
+             netif="$vlanname"
+             use_vlan='true'
+@@ -212,6 +216,8 @@ if [ -e /tmp/bridge.info ]; then
+         for ethname in $ethnames ; do
+             if [ "$ethname" = "$bondname" ] ; then
+                 DO_BOND_SETUP=yes ifup $bondname -m
++            elif [ "$ethname" = "$teammaster" ] ; then
++                DO_TEAM_SETUP=yes ifup $teammaster -m
+             else
+                 linkup $ethname
+             fi
+@@ -235,6 +241,8 @@ if [ "$netif" = "$vlanname" ] && [ ! -e /tmp/net.$vlanname.up ]; then
+     modprobe 8021q
+     if [ "$phydevice" = "$bondname" ] ; then
+         DO_BOND_SETUP=yes ifup $phydevice -m
++    elif [ "$phydevice" = "$teammaster" ] ; then
++        DO_TEAM_SETUP=yes ifup $phydevice -m
+     else
+         linkup "$phydevice"
+     fi
diff --git a/0014-network-support-multiple-bonding-interfaces.patch b/0014-network-support-multiple-bonding-interfaces.patch
new file mode 100644
index 0000000..ff58293
--- /dev/null
+++ b/0014-network-support-multiple-bonding-interfaces.patch
@@ -0,0 +1,145 @@
+From d136ca4eeb3d7be2beef210dcf51a18210900844 Mon Sep 17 00:00:00 2001
+From: Harald Hoyer <harald at redhat.com>
+Date: Mon, 8 Apr 2013 17:47:49 +0800
+Subject: [PATCH] network: support multiple bonding interfaces
+
+Currently dracut only support 1 bond, namyly bond0 by default. However multiple
+bonds configuration may be needed. For example in kdump, in 1st kernel, more
+than one bonds may be configured, and bondX other than bond0 is used as output
+interface to remote host which will store dump core. This patch can solve this
+problem, to write real bond information to initramfs, 2nd kdump kernel will
+use it to create the relevant bondX interface.
+
+Tested-by: Baoquan He <bhe at redhat.com>
+Signed-off-by: Baoquan He <bhe at redhat.com>
+---
+ modules.d/40network/ifup.sh         | 15 ++++++++++-----
+ modules.d/40network/net-genrules.sh |  9 ++++++---
+ modules.d/40network/parse-bond.sh   |  6 +++---
+ modules.d/40network/parse-bridge.sh |  6 ------
+ modules.d/45ifcfg/write-ifcfg.sh    |  9 +++++----
+ 5 files changed, 24 insertions(+), 21 deletions(-)
+
+diff --git a/modules.d/40network/ifup.sh b/modules.d/40network/ifup.sh
+index 815ab64..593f387 100755
+--- a/modules.d/40network/ifup.sh
++++ b/modules.d/40network/ifup.sh
+@@ -21,14 +21,18 @@ use_bridge='false'
+ use_vlan='false'
+ 
+ # enslave this interface to bond?
+-if [ -e /tmp/bond.info ]; then
+-    . /tmp/bond.info
++for i in /tmp/bond.*.info; do
++    [ -e "$i" ] || continue
++    unset bondslaves
++    unset bondname
++    . "$i"
+     for slave in $bondslaves ; do
+         if [ "$netif" = "$slave" ] ; then
+             netif=$bondname
++            break 2
+         fi
+     done
+-fi
++done
+ 
+ if [ -e /tmp/team.info ]; then
+     . /tmp/team.info
+@@ -138,11 +142,12 @@ if [ "$netif" = "lo" ] ; then
+ fi
+ 
+ # start bond if needed
+-if [ -e /tmp/bond.info ]; then
+-    . /tmp/bond.info
++if [ -e /tmp/bond.${netif}.info ]; then
++    . /tmp/bond.${netif}.info
+ 
+     if [ "$netif" = "$bondname" ] && [ ! -e /tmp/net.$bondname.up ] ; then # We are master bond device
+         modprobe bonding
++        echo "+$netif" >  /sys/class/net/bonding_masters
+         ip link set $netif down
+ 
+         # Stolen from ifup-eth
+diff --git a/modules.d/40network/net-genrules.sh b/modules.d/40network/net-genrules.sh
+index f4652b9..05fa5f3 100755
+--- a/modules.d/40network/net-genrules.sh
++++ b/modules.d/40network/net-genrules.sh
+@@ -28,11 +28,14 @@ fi
+     fi
+ 
+     # bond: attempt only the defined interface (override bridge defines)
+-    if [ -e /tmp/bond.info ]; then
+-        . /tmp/bond.info
++    for i in /tmp/bond.*.info; do
++        [ -e "$i" ] || continue
++        unset bondslaves
++        unset bondname
++        . "$i"
+         # It is enough to fire up only one
+         IFACES="$IFACES ${bondslaves%% *}"
+-    fi
++    done
+ 
+     if [ -e /tmp/team.info ]; then
+         . /tmp/team.info
+diff --git a/modules.d/40network/parse-bond.sh b/modules.d/40network/parse-bond.sh
+index 983eb3a..25c51b8 100755
+--- a/modules.d/40network/parse-bond.sh
++++ b/modules.d/40network/parse-bond.sh
+@@ -54,8 +54,8 @@ if getarg bond >/dev/null; then
+     fi
+     # Make it suitable for initscripts export
+     bondoptions=$(str_replace "$bondoptions" ";" ",")
+-    echo "bondname=$bondname" > /tmp/bond.info
+-    echo "bondslaves=\"$bondslaves\"" >> /tmp/bond.info
+-    echo "bondoptions=\"$bondoptions\"" >> /tmp/bond.info
++    echo "bondname=$bondname" > /tmp/bond.${bondname}.info
++    echo "bondslaves=\"$bondslaves\"" >> /tmp/bond.${bondname}.info
++    echo "bondoptions=\"$bondoptions\"" >> /tmp/bond.${bondname}.info
+     return
+ fi
+diff --git a/modules.d/40network/parse-bridge.sh b/modules.d/40network/parse-bridge.sh
+index 1f027bb..8c305c0 100755
+--- a/modules.d/40network/parse-bridge.sh
++++ b/modules.d/40network/parse-bridge.sh
+@@ -37,12 +37,6 @@ parsebridge() {
+ unset bridgename ethnames
+ 
+ iface=eth0
+-if [ -e /tmp/bond.info ]; then
+-    . /tmp/bond.info
+-    if [ -n "$bondname" ] ; then
+-        iface=$bondname
+-    fi
+-fi
+ 
+ # Parse bridge for bridgename and ethnames
+ if bridge="$(getarg bridge)"; then
+diff --git a/modules.d/45ifcfg/write-ifcfg.sh b/modules.d/45ifcfg/write-ifcfg.sh
+index f7a476c..16da5e4 100755
+--- a/modules.d/45ifcfg/write-ifcfg.sh
++++ b/modules.d/45ifcfg/write-ifcfg.sh
+@@ -9,10 +9,6 @@ udevadm settle --timeout=30
+ 
+ read IFACES < /tmp/net.ifaces
+ 
+-if [ -e /tmp/bond.info ]; then
+-    . /tmp/bond.info
+-fi
+-
+ if [ -e /tmp/bridge.info ]; then
+     . /tmp/bridge.info
+ fi
+@@ -89,6 +85,11 @@ for netif in $IFACES ; do
+     # bridge?
+     unset bridge
+     unset bond
++    unset bondslaves
++    unset bondname
++    unset bondoptions
++    [ -e /tmp/bond.${netif}.info ] && . /tmp/bond.${netif}.info
++
+     uuid=$(cat /proc/sys/kernel/random/uuid)
+     if [ "$netif" = "$bridgename" ]; then
+         bridge=yes
diff --git a/0015-Wait-for-logical-interface-to-be-up.patch b/0015-Wait-for-logical-interface-to-be-up.patch
new file mode 100644
index 0000000..e90e32f
--- /dev/null
+++ b/0015-Wait-for-logical-interface-to-be-up.patch
@@ -0,0 +1,57 @@
+From 0290e98271af41423e16801b959779c945ee4d59 Mon Sep 17 00:00:00 2001
+From: Baoquan He <bhe at redhat.com>
+Date: Mon, 8 Apr 2013 17:47:50 +0800
+Subject: [PATCH] Wait for logical interface to be up
+
+If bootdev is logical interface like bond, bridge or vlan, we need
+wait them up.
+
+Signed-off-by: Baoquan He <bhe at redhat.com>
+---
+ modules.d/40network/net-genrules.sh | 9 +++++++++
+ 1 file changed, 9 insertions(+)
+
+diff --git a/modules.d/40network/net-genrules.sh b/modules.d/40network/net-genrules.sh
+index 05fa5f3..8bf6a89 100755
+--- a/modules.d/40network/net-genrules.sh
++++ b/modules.d/40network/net-genrules.sh
+@@ -25,6 +25,7 @@ fi
+     if [ -e /tmp/bridge.info ]; then
+         . /tmp/bridge.info
+         IFACES="$IFACES ${ethnames%% *}"
++        MASTER_IFACES="$MASTER_IFACES $bridgename"
+     fi
+ 
+     # bond: attempt only the defined interface (override bridge defines)
+@@ -35,16 +36,19 @@ fi
+         . "$i"
+         # It is enough to fire up only one
+         IFACES="$IFACES ${bondslaves%% *}"
++        MASTER_IFACES="$MASTER_IFACES ${bondname}"
+     done
+ 
+     if [ -e /tmp/team.info ]; then
+         . /tmp/team.info
+         IFACES="$IFACES ${teamslaves}"
++        MASTER_IFACES="$MASTER_IFACES ${teammaster}"
+     fi
+ 
+     if [ -e /tmp/vlan.info ]; then
+         . /tmp/vlan.info
+         IFACES="$IFACES $phydevice"
++        MASTER_IFACES="$MASTER_IFACES ${vlanname}"
+     fi
+ 
+     if [ -z "$IFACES" ]; then
+@@ -74,6 +78,11 @@ fi
+             fi
+         done
+ 
++        for iface in $MASTER_IFACES; do
++            if [ "$bootdev" = "$iface" ]; then
++                echo "[ -f /tmp/setup_net_${iface}.ok ]" >$hookdir/initqueue/finished/wait-$iface.sh
++            fi
++        done
+     # Default: We don't know the interface to use, handle all
+     # Fixme: waiting for the interface as well.
+     else
diff --git a/0016-Let-user-specify-the-action-after-fail.patch b/0016-Let-user-specify-the-action-after-fail.patch
new file mode 100644
index 0000000..0d367b6
--- /dev/null
+++ b/0016-Let-user-specify-the-action-after-fail.patch
@@ -0,0 +1,222 @@
+From 9d787df19674937e8c07bd295b5d282a63829209 Mon Sep 17 00:00:00 2001
+From: Baoquan He <bhe at redhat.com>
+Date: Fri, 29 Mar 2013 18:36:16 +0800
+Subject: [PATCH] Let user specify the action after fail
+
+Currently the default action is emergency_shell when failure happened
+during system boot. In kdump, this default may not be expected. E.g,
+if dump target is not rootfs, it does not matter if mount root failed.
+Adding an action which allow dracut always go ahead though failure
+happens is needed by kdump.
+
+So here add a function action_on_fail() and cmdline parameter
+action_on_fail=<shell | continue>. Use action_to_fail() to replace
+emergency_shell which was called after failure. By $(getarg action_on_fail=),
+decide to drop into shell, or to leave away the failure and go ahead.
+
+v3->v4:
+add handling of selinux policy loaded failure, and change code format to
+be consitent
+
+Signed-off-by: Baoquan He <bhe at redhat.com>
+
+[Edited by harald at redhat.com]
+---
+ dracut.cmdline.7.asc                      |  4 ++++
+ modules.d/95rootfs-block/mount-root.sh    |  2 +-
+ modules.d/98selinux/selinux-loadpolicy.sh |  6 ++----
+ modules.d/98systemd/dracut-initqueue.sh   |  2 +-
+ modules.d/98systemd/dracut-mount.sh       |  2 +-
+ modules.d/98usrmount/mount-usr.sh         |  4 ++--
+ modules.d/99base/dracut-lib.sh            | 22 ++++++++++++++++++++++
+ modules.d/99base/init.sh                  | 12 ++++++------
+ 8 files changed, 39 insertions(+), 15 deletions(-)
+
+diff --git a/dracut.cmdline.7.asc b/dracut.cmdline.7.asc
+index f1457d5..4626279 100644
+--- a/dracut.cmdline.7.asc
++++ b/dracut.cmdline.7.asc
+@@ -121,6 +121,10 @@ Misc
+    specify the controlling terminal for the console.
+    This is useful, if you have multiple "console=" arguments.
+ 
++**action_on_fail=**_{shell|continue}_::
++   Specify the action after failure. By default it's emergency_shell.
++   'continue' means: ignore the current failure and go ahead.
++
+ [[dracutkerneldebug]]
+ Debug
+ ~~~~~
+diff --git a/modules.d/95rootfs-block/mount-root.sh b/modules.d/95rootfs-block/mount-root.sh
+index c7626c3..6ed35c1 100755
+--- a/modules.d/95rootfs-block/mount-root.sh
++++ b/modules.d/95rootfs-block/mount-root.sh
+@@ -68,7 +68,7 @@ mount_root() {
+                 warn "*** Warning -- the system did not shut down cleanly. "
+                 warn "*** Dropping you to a shell; the system will continue"
+                 warn "*** when you leave the shell."
+-                emergency_shell
++                action_on_fail
+             fi
+             fsckoptions="$AUTOFSCK_OPT $fsckoptions"
+         fi
+diff --git a/modules.d/98selinux/selinux-loadpolicy.sh b/modules.d/98selinux/selinux-loadpolicy.sh
+index d6e24d6..7526265 100755
+--- a/modules.d/98selinux/selinux-loadpolicy.sh
++++ b/modules.d/98selinux/selinux-loadpolicy.sh
+@@ -52,16 +52,14 @@ rd_load_policy()
+         if [ $ret -eq 3 -o $permissive -eq 0 ]; then
+             warn "Machine in enforcing mode."
+             warn "Not continuing"
+-            emergency_shell -n selinux
+-            exit 1
++            action_on_fail -n selinux || exit 1
+         fi
+         return 0
+     elif [ $permissive -eq 0 -a "$SELINUX" != "disabled" ]; then
+         warn "Machine in enforcing mode and cannot execute load_policy."
+         warn "To disable selinux, add selinux=0 to the kernel command line."
+         warn "Not continuing"
+-        emergency_shell -n selinux
+-        exit 1
++        action_on_fail -n selinux || exit 1
+     fi
+ }
+ 
+diff --git a/modules.d/98systemd/dracut-initqueue.sh b/modules.d/98systemd/dracut-initqueue.sh
+index c6fab30..2c71bf4 100755
+--- a/modules.d/98systemd/dracut-initqueue.sh
++++ b/modules.d/98systemd/dracut-initqueue.sh
+@@ -62,7 +62,7 @@ while :; do
+     fi
+ 
+     main_loop=$(($main_loop+1))
+-    [ $main_loop -gt $RDRETRY ] && emergency_shell "Could not boot."
++    [ $main_loop -gt $RDRETRY ] && action_on_fail "Could not boot." && break
+ done
+ 
+ unset job
+diff --git a/modules.d/98systemd/dracut-mount.sh b/modules.d/98systemd/dracut-mount.sh
+index 5f3d9f0..ae01512 100755
+--- a/modules.d/98systemd/dracut-mount.sh
++++ b/modules.d/98systemd/dracut-mount.sh
+@@ -31,7 +31,7 @@ while :; do
+     done
+ 
+     i=$(($i+1))
+-    [ $i -gt 20 ] && emergency_shell "Can't mount root filesystem"
++    [ $i -gt 20 ] && action_on_fail "Can't mount root filesystem" && break
+ done
+ 
+ export -p > /dracut-state.sh
+diff --git a/modules.d/98usrmount/mount-usr.sh b/modules.d/98usrmount/mount-usr.sh
+index 5aaefbc..a4a66ae 100755
+--- a/modules.d/98usrmount/mount-usr.sh
++++ b/modules.d/98usrmount/mount-usr.sh
+@@ -42,7 +42,7 @@ fsck_usr()
+             warn "*** Warning -- the system did not shut down cleanly. "
+             warn "*** Dropping you to a shell; the system will continue"
+             warn "*** when you leave the shell."
+-            emergency_shell
++            action_on_fail
+         fi
+         _fsckoptions="$AUTOFSCK_OPT $_fsckoptions"
+     fi
+@@ -105,7 +105,7 @@ mount_usr()
+             warn "Mounting /usr to $NEWROOT/usr failed"
+             warn "*** Dropping you to a shell; the system will continue"
+             warn "*** when you leave the shell."
+-            emergency_shell
++            action_on_fail
+         fi
+     fi
+ }
+diff --git a/modules.d/99base/dracut-lib.sh b/modules.d/99base/dracut-lib.sh
+index f2b16d3..1defb6f 100755
+--- a/modules.d/99base/dracut-lib.sh
++++ b/modules.d/99base/dracut-lib.sh
+@@ -994,6 +994,28 @@ emergency_shell()
+     [ -e /run/initramfs/.die ] && exit 1
+ }
+ 
++action_on_fail()
++{
++    local _action=$(getarg action_on_fail=)
++    case "$_action" in
++        continue)
++            [ "$1" = "-n" ] && shift 2
++            [ "$1" = "--shutdown" ] && shift 2
++            warn "$*"
++            warn "Not dropping to emergency shell, because 'action_on_fail=continue' was set on the kernel command line."
++            return 0
++            ;;
++        shell)
++            emergency_shell $@
++            return 1
++            ;;
++        *)
++            emergency_shell $@
++            return 1
++            ;;
++    esac
++}
++
+ # Retain the values of these variables but ensure that they are unexported
+ # This is a POSIX-compliant equivalent of bash's "export -n"
+ export_n()
+diff --git a/modules.d/99base/init.sh b/modules.d/99base/init.sh
+index 410201a..880a2c0 100755
+--- a/modules.d/99base/init.sh
++++ b/modules.d/99base/init.sh
+@@ -79,7 +79,7 @@ if ! ismounted /run; then
+     rm -fr /newrun
+ fi
+ 
+-trap "emergency_shell Signal caught!" 0
++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
+@@ -199,7 +199,7 @@ while :; do
+ 
+     main_loop=$(($main_loop+1))
+     [ $main_loop -gt $RDRETRY ] \
+-        && { flock -s 9 ; emergency_shell "Could not boot."; } 9>/.console_lock
++        && { flock -s 9 ; action_on_fail "Could not boot." && break; } 9>/.console_lock
+ done
+ unset job
+ unset queuetriggered
+@@ -234,7 +234,7 @@ while :; do
+ 
+     i=$(($i+1))
+     [ $i -gt 20 ] \
+-        && { flock -s 9 ; emergency_shell "Can't mount root filesystem"; } 9>/.console_lock
++        && { flock -s 9 ; action_on_fail "Can't mount root filesystem" && break; } 9>/.console_lock
+ done
+ 
+ {
+@@ -268,7 +268,7 @@ done
+ [ "$INIT" ] || {
+     echo "Cannot find init!"
+     echo "Please check to make sure you passed a valid root filesystem!"
+-    emergency_shell
++    action_on_fail
+ }
+ 
+ if [ $UDEVVERSION -lt 168 ]; then
+@@ -370,13 +370,13 @@ if [ -f /etc/capsdrop ]; then
+ 	warn "Command:"
+ 	warn capsh --drop=$CAPS_INIT_DROP -- -c exec switch_root "$NEWROOT" "$INIT" $initargs
+ 	warn "failed."
+-	emergency_shell
++	action_on_fail
+     }
+ else
+     unset RD_DEBUG
+     exec $SWITCH_ROOT "$NEWROOT" "$INIT" $initargs || {
+ 	warn "Something went very badly wrong in the initramfs.  Please "
+ 	warn "file a bug against dracut."
+-	emergency_shell
++	action_on_fail
+     }
+ fi
diff --git a/0017-ifup.sh-Add-support-for-bridge-over-a-vlan-tagged-in.patch b/0017-ifup.sh-Add-support-for-bridge-over-a-vlan-tagged-in.patch
new file mode 100644
index 0000000..37df88b
--- /dev/null
+++ b/0017-ifup.sh-Add-support-for-bridge-over-a-vlan-tagged-in.patch
@@ -0,0 +1,85 @@
+From 0c5ccb35c7db77caf6317e1946387504b44132e5 Mon Sep 17 00:00:00 2001
+From: WANG Chao <chaowang at redhat.com>
+Date: Tue, 9 Apr 2013 18:56:40 +0800
+Subject: [PATCH] ifup.sh: Add support for bridge over a vlan tagged interface
+
+This patch add support for bridge a vlan tagged interface, like
+br0 -> bond0.7 -> bond0 -> eth0
+
+Signed-off-by: WANG Chao <chaowang at redhat.com>
+---
+ modules.d/40network/ifup.sh | 33 +++++++++++++++++++--------------
+ 1 file changed, 19 insertions(+), 14 deletions(-)
+
+diff --git a/modules.d/40network/ifup.sh b/modules.d/40network/ifup.sh
+index 593f387..526251f 100755
+--- a/modules.d/40network/ifup.sh
++++ b/modules.d/40network/ifup.sh
+@@ -43,6 +43,20 @@ if [ -e /tmp/team.info ]; then
+     done
+ fi
+ 
++if [ -e /tmp/vlan.info ]; then
++    . /tmp/vlan.info
++    if [ "$netif" = "$phydevice" ]; then
++        if [ "$netif" = "$bondname" ] && [ -n "$DO_BOND_SETUP" ] ; then
++            : # We need to really setup bond (recursive call)
++        elif [ "$netif" = "$teammaster" ] && [ -n "$DO_TEAM_SETUP" ] ; then
++            : # We need to really setup team (recursive call)
++        else
++            netif="$vlanname"
++            use_vlan='true'
++        fi
++    fi
++fi
++
+ # bridge this interface?
+ if [ -e /tmp/bridge.info ]; then
+     . /tmp/bridge.info
+@@ -52,6 +66,8 @@ if [ -e /tmp/bridge.info ]; then
+                 : # We need to really setup bond (recursive call)
+             elif [ "$netif" = "$teammaster" ] && [ -n "$DO_TEAM_SETUP" ] ; then
+                 : # We need to really setup team (recursive call)
++            elif [ "$netif" = "$vlanname" ] && [ -n "$DO_VLAN_SETUP" ]; then
++                : # We need to really setup vlan (recursive call)
+             else
+                 netif="$bridgename"
+                 use_bridge='true'
+@@ -60,20 +76,6 @@ if [ -e /tmp/bridge.info ]; then
+     done
+ fi
+ 
+-if [ -e /tmp/vlan.info ]; then
+-    . /tmp/vlan.info
+-    if [ "$netif" = "$phydevice" ]; then
+-        if [ "$netif" = "$bondname" ] && [ -n "$DO_BOND_SETUP" ] ; then
+-            : # We need to really setup bond (recursive call)
+-        elif [ "$netif" = "$teammaster" ] && [ -n "$DO_TEAM_SETUP" ] ; then
+-            : # We need to really setup team (recursive call)
+-        else
+-            netif="$vlanname"
+-            use_vlan='true'
+-        fi
+-    fi
+-fi
+-
+ # disable manual ifup while netroot is set for simplifying our logic
+ # in netroot case we prefer netroot to bringup $netif automaticlly
+ [ -n "$2" -a "$2" = "-m" ] && [ -z "$netroot" ] && manualup="$2"
+@@ -223,6 +225,8 @@ if [ -e /tmp/bridge.info ]; then
+                 DO_BOND_SETUP=yes ifup $bondname -m
+             elif [ "$ethname" = "$teammaster" ] ; then
+                 DO_TEAM_SETUP=yes ifup $teammaster -m
++            elif [ "$ethname" = "$vlanname" ]; then
++                DO_VLAN_SETUP=yes ifup $vlanname -m
+             else
+                 linkup $ethname
+             fi
+@@ -252,6 +256,7 @@ if [ "$netif" = "$vlanname" ] && [ ! -e /tmp/net.$vlanname.up ]; then
+         linkup "$phydevice"
+     fi
+     ip link add dev "$vlanname" link "$phydevice" type vlan id "$(get_vid $vlanname)"
++    ip link set "$vlanname" up
+ fi
+ 
+ # setup nameserver
diff --git a/dracut.spec b/dracut.spec
index 4db4dac..9ea57c6 100644
--- a/dracut.spec
+++ b/dracut.spec
@@ -10,7 +10,7 @@
 
 Name: dracut
 Version: 027
-Release: 10.git20130405%{?dist}
+Release: 18.git20130409%{?dist}
 
 Summary: Initramfs generator using udev
 %if 0%{?fedora} || 0%{?rhel}
@@ -38,6 +38,14 @@ Patch6: 0006-Add-missing-options-to-manpage-and-help-output.patch
 Patch7: 0007-TEST-50-MULTINIC-fixup-test-suite.patch
 Patch8: 0008-TESTSUITE-s-i6300esbwdt-i6300esb-ib700wdt-g.patch
 Patch9: 0009-TEST-99-RPM-ignore-rescue-images.patch
+Patch10: 0010-nfs-module-setup.sh-combine-egreps-for-etc-passwd-an.patch
+Patch11: 0011-dracut-functions.sh-make-use-of-findmnt.patch
+Patch12: 0012-crypt-module-setup.sh-filter-etc-crypttab-in-host-on.patch
+Patch13: 0013-ifup.sh-Add-support-for-bridge-over-team-and-vlan-ta.patch
+Patch14: 0014-network-support-multiple-bonding-interfaces.patch
+Patch15: 0015-Wait-for-logical-interface-to-be-up.patch
+Patch16: 0016-Let-user-specify-the-action-after-fail.patch
+Patch17: 0017-ifup.sh-Add-support-for-bridge-over-a-vlan-tagged-in.patch
 
 
 BuildRequires: dash bash git
@@ -447,6 +455,14 @@ rm -rf $RPM_BUILD_ROOT
 %{dracutlibdir}/dracut.conf.d/02-norescue.conf
 
 %changelog
+* Tue Apr 09 2013 Harald Hoyer <harald at redhat.com> 027-17.git20130409
+- only include needed /etc/crypttab entries
+Resolves:rhbz#919752
+- add support for bridge over team and vlan
+- support multiple bonding interfaces
+- add "action_on_fail=" kernel command line parameter
+- add support for bridge over a vlan tagged interface
+
 * Fri Apr 05 2013 Harald Hoyer <harald at redhat.com> 027-10.git20130405
 - fix crypto password timeout on the dracut side
 


More information about the scm-commits mailing list