dracut-038-14.git20140724

- fixed lvm modules issues
Resolves: rhbz#1118890
 fixed vlan issues
- fixed prelink for FIPS
- new rd.route parameter
- more ARM modules
This commit is contained in:
Harald Hoyer 2014-07-24 14:41:34 +02:00
parent cf2cbc9bbd
commit e09d6b8a2a
14 changed files with 744 additions and 1 deletions

View File

@ -0,0 +1,23 @@
From 8ca5e8c319c3e44bbd06d8c0da429d2df221707b Mon Sep 17 00:00:00 2001
From: Alexander Tsoy <alexander@tsoy.me>
Date: Mon, 31 Mar 2014 17:56:13 +0400
Subject: [PATCH] modsign: do not hardcode path to keyctl
https://bugs.gentoo.org/show_bug.cgi?id=506094
---
modules.d/03modsign/module-setup.sh | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/modules.d/03modsign/module-setup.sh b/modules.d/03modsign/module-setup.sh
index 09285d3..cc0e241 100755
--- a/modules.d/03modsign/module-setup.sh
+++ b/modules.d/03modsign/module-setup.sh
@@ -29,7 +29,7 @@ depends() {
# called by dracut
install() {
inst_dir /lib/modules/keys
- inst_binary /usr/bin/keyctl
+ inst_binary keyctl
inst_hook pre-trigger 01 "$moddir/load-modsign-keys.sh"

View File

@ -0,0 +1,39 @@
From fecc1d69e5a12c305d93e7dca64bd690a1fe8ff5 Mon Sep 17 00:00:00 2001
From: Harald Hoyer <harald@redhat.com>
Date: Thu, 3 Jul 2014 15:04:17 +0200
Subject: [PATCH] lvm:module-setup.sh: check for existance of
69-dm-lvm-metad.rules
fixup for 12819a579900b9691e2bfaf14e76fbb025851530
---
modules.d/90lvm/module-setup.sh | 17 ++++++++++-------
1 file changed, 10 insertions(+), 7 deletions(-)
diff --git a/modules.d/90lvm/module-setup.sh b/modules.d/90lvm/module-setup.sh
index 00d4e5a..2f2b64c 100755
--- a/modules.d/90lvm/module-setup.sh
+++ b/modules.d/90lvm/module-setup.sh
@@ -80,13 +80,16 @@ install() {
inst_rules 11-dm-lvm.rules 69-dm-lvm-metad.rules
# Do not run lvmetad update via pvscan in udev rule - lvmetad is not running yet in dracut!
- if [[ -f ${initdir}/lib/udev/rules.d/69-dm-lvm-metad.rules ]] && \
- grep -q SYSTEMD_WANTS ${initdir}/lib/udev/rules.d/69-dm-lvm-metad.rules; then
- sed -i -e 's/^ENV{SYSTEMD_ALIAS}=.*/# No LVM pvscan in dracut - lvmetad is not running yet/' ${initdir}/lib/udev/rules.d/69-dm-lvm-metad.rules
- sed -i -e 's/^ENV{ID_MODEL}=.*//' ${initdir}/lib/udev/rules.d/69-dm-lvm-metad.rules
- sed -i -e 's/^ENV{SYSTEMD_WANTS}=.*//' ${initdir}/lib/udev/rules.d/69-dm-lvm-metad.rules
- else
- sed -i -e 's/.*lvm pvscan.*/# No LVM pvscan for in dracut - lvmetad is not running yet/' ${initdir}/lib/udev/rules.d/69-dm-lvm-metad.rules
+ if [[ -f ${initdir}/lib/udev/rules.d/69-dm-lvm-metad.rules ]]; then
+ if grep -q SYSTEMD_WANTS ${initdir}/lib/udev/rules.d/69-dm-lvm-metad.rules; then
+ sed -i -e 's/^ENV{SYSTEMD_ALIAS}=.*/# No LVM pvscan in dracut - lvmetad is not running yet/' \
+ ${initdir}/lib/udev/rules.d/69-dm-lvm-metad.rules
+ sed -i -e 's/^ENV{ID_MODEL}=.*//' ${initdir}/lib/udev/rules.d/69-dm-lvm-metad.rules
+ sed -i -e 's/^ENV{SYSTEMD_WANTS}=.*//' ${initdir}/lib/udev/rules.d/69-dm-lvm-metad.rules
+ else
+ sed -i -e 's/.*lvm pvscan.*/# No LVM pvscan for in dracut - lvmetad is not running yet/' \
+ ${initdir}/lib/udev/rules.d/69-dm-lvm-metad.rules
+ fi
fi
# Gentoo ebuild for LVM2 prior to 2.02.63-r1 doesn't install above rules

View File

@ -0,0 +1,47 @@
From 6cd7001b35c66a12787bc0943b9a7e83a3d443c0 Mon Sep 17 00:00:00 2001
From: Harald Hoyer <harald@redhat.com>
Date: Tue, 8 Jul 2014 11:50:04 +0200
Subject: [PATCH] dracut.sh: always copy prelink files in FIPS mode
regardless of the the prelink={yes|no} switch
---
dracut.sh | 26 ++++++++++++--------------
1 file changed, 12 insertions(+), 14 deletions(-)
diff --git a/dracut.sh b/dracut.sh
index c6da411..22273a5 100755
--- a/dracut.sh
+++ b/dracut.sh
@@ -1400,20 +1400,18 @@ if [[ $kernel_only != yes ]]; then
fi
fi
-if [[ $do_prelink == yes ]]; then
- PRELINK_BIN="$(command -v prelink)"
- if [[ $UID = 0 ]] && [[ $PRELINK_BIN ]]; then
- if [[ $DRACUT_FIPS_MODE ]]; then
- dinfo "*** Installing prelink files ***"
- inst_multiple -o prelink /etc/prelink.conf /etc/prelink.conf.d/*.conf /etc/prelink.cache
- else
- dinfo "*** Pre-linking files ***"
- inst_multiple -o prelink /etc/prelink.conf /etc/prelink.conf.d/*.conf
- chroot "$initdir" "$PRELINK_BIN" -a
- rm -f -- "$initdir/$PRELINK_BIN"
- rm -fr -- "$initdir"/etc/prelink.*
- dinfo "*** Pre-linking files done ***"
- fi
+PRELINK_BIN="$(command -v prelink)"
+if [[ $UID = 0 ]] && [[ $PRELINK_BIN ]]; then
+ if [[ $DRACUT_FIPS_MODE ]]; then
+ dinfo "*** Installing prelink files ***"
+ inst_multiple -o prelink /etc/prelink.conf /etc/prelink.conf.d/*.conf /etc/prelink.cache
+ elif [[ $do_prelink == yes ]]; then
+ dinfo "*** Pre-linking files ***"
+ inst_multiple -o prelink /etc/prelink.conf /etc/prelink.conf.d/*.conf
+ chroot "$initdir" "$PRELINK_BIN" -a
+ rm -f -- "$initdir/$PRELINK_BIN"
+ rm -fr -- "$initdir"/etc/prelink.*
+ dinfo "*** Pre-linking files done ***"
fi
fi

View File

@ -0,0 +1,35 @@
From 4adeefc4abb8fb1d83e483d12da6b337c486fded Mon Sep 17 00:00:00 2001
From: Harald Hoyer <harald@redhat.com>
Date: Tue, 8 Jul 2014 11:50:51 +0200
Subject: [PATCH] plymouth: also find the pkglibdir on debian
---
modules.d/50plymouth/module-setup.sh | 12 +++++++++---
1 file changed, 9 insertions(+), 3 deletions(-)
diff --git a/modules.d/50plymouth/module-setup.sh b/modules.d/50plymouth/module-setup.sh
index b818324..33fab11 100755
--- a/modules.d/50plymouth/module-setup.sh
+++ b/modules.d/50plymouth/module-setup.sh
@@ -15,12 +15,18 @@ depends() {
# called by dracut
install() {
- if grep -q nash /usr/libexec/plymouth/plymouth-populate-initrd \
- || [ ! -x /usr/libexec/plymouth/plymouth-populate-initrd ]; then
+ PKGLIBDIR="/usr/lib/plymouth"
+ if type -P dpkg-architecture &>/dev/null; then
+ PKGLIBDIR="/usr/lib/$(dpkg-architecture -qDEB_HOST_MULTIARCH)/plymouth"
+ fi
+ [ -x /usr/libexec/plymouth/plymouth-populate-initrd ] && PKGLIBDIR="/usr/libexec/plymouth"
+
+ if grep -q nash ${PKGLIBDIR}/plymouth-populate-initrd \
+ || [ ! -x ${PKGLIBDIR}/plymouth-populate-initrd ]; then
. "$moddir"/plymouth-populate-initrd.sh
else
PLYMOUTH_POPULATE_SOURCE_FUNCTIONS="$dracutfunctions" \
- /usr/libexec/plymouth/plymouth-populate-initrd -t "$initdir"
+ ${PKGLIBDIR}/plymouth-populate-initrd -t "$initdir"
fi
inst_hook emergency 50 "$moddir"/plymouth-emergency.sh

View File

@ -0,0 +1,29 @@
From 5ea0be0a8c83969fd0041b3e647f82fcfb365e44 Mon Sep 17 00:00:00 2001
From: Harald Hoyer <harald@redhat.com>
Date: Tue, 8 Jul 2014 12:54:21 +0200
Subject: [PATCH] dracut-functions.sh: speed up ldconfig_paths()
---
dracut-functions.sh | 7 +++----
1 file changed, 3 insertions(+), 4 deletions(-)
diff --git a/dracut-functions.sh b/dracut-functions.sh
index d30e835..9f481b2 100755
--- a/dracut-functions.sh
+++ b/dracut-functions.sh
@@ -109,12 +109,11 @@ ldconfig_paths()
local a i
declare -A a
for i in $(
- ldconfig -pN 2>/dev/null | while read a b c d; do
- [[ "$c" != "=>" ]] && continue
- printf "%s\n" ${d%/*};
+ ldconfig -pN 2>/dev/null | grep -F '=>' | grep -E -v '/(lib|lib64|usr/lib|usr/lib64)/[^/]*$' | while read a b c d; do
+ d=${d%/*}
+ printf "%s\n" "$d";
done
); do
- [[ "$i" = "/lib" || "$i" = "/usr/lib" || "$i" = "/lib64" || "$i" = "/usr/lib64" ]] && continue
a["$i"]=1;
done;
printf "%s\n" ${!a[@]}

View File

@ -0,0 +1,41 @@
From f4eb0d98048d51a0782d4a7137f699de174a65e4 Mon Sep 17 00:00:00 2001
From: "Praveen_Paladugu@Dell.com" <Praveen_Paladugu@Dell.com>
Date: Tue, 10 Jun 2014 10:35:16 -0500
Subject: [PATCH] Installing an OS with VLAN enabled to an ISCSI LUN (from
ibft)
When installing OS to a VLAN enabled iscsi LUN (extracted from iBFT), "/tmp/net.{xyz}.has_ibft_config" is not being set properly.
Then anaconda installer requires 'BOOTPROTO="ibft"' populated in ifcfg of the vlan interface (ex: ibft0.20), for it to properly populate the kernel parameters post installation. The setting 'BOOTPROTO="ibft"' is populated by write-ifcfg.sh script only if the corresponding interface has a file /tmp/net.{xyz}.has_inft_config
To get around this issue, in ibft_to_cmdline() function in net-lib.sh file, I made the following changes to populate the has_ibft_config file for the vlan interface(ex: ibft0.20):
---
modules.d/40network/net-lib.sh | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/modules.d/40network/net-lib.sh b/modules.d/40network/net-lib.sh
index a82f1a8..f8e1179 100755
--- a/modules.d/40network/net-lib.sh
+++ b/modules.d/40network/net-lib.sh
@@ -233,15 +233,20 @@ ibft_to_cmdline() {
case "$vlan" in
[0-9]*)
echo "vlan=$dev.$vlan:$dev"
+ echo $mac > /tmp/net.${dev}.${vlan}.has_ibft_config
;;
*)
echo "vlan=$vlan:$dev"
+ echo $mac > /tmp/net.${vlan}.has_ibft_config
;;
esac
+ else
+ echo $mac > /tmp/net.${dev}.has_ibft_config
fi
+ else
+ echo $mac > /tmp/net.${dev}.has_ibft_config
fi
- echo $mac > /tmp/net.${dev}.has_ibft_config
done
) >> /etc/cmdline.d/40-ibft.conf
}

View File

@ -0,0 +1,93 @@
From 4ef45f13f4d11c86c4c8c3fd8d8a6be2c5b4deef Mon Sep 17 00:00:00 2001
From: Harald Hoyer <harald@redhat.com>
Date: Mon, 21 Jul 2014 16:58:15 +0200
Subject: [PATCH] dracut-functions.sh: fix inst*() functions for "-H" handling
because some inst*() functions check the existance of the source files
and do not know about the "-H" option, some failed to install the
hostonly files.
---
dracut-functions.sh | 46 ++++++++++++++++++++++++++++++++--------------
1 file changed, 32 insertions(+), 14 deletions(-)
diff --git a/dracut-functions.sh b/dracut-functions.sh
index 9f481b2..6cdfea0 100755
--- a/dracut-functions.sh
+++ b/dracut-functions.sh
@@ -760,33 +760,46 @@ inst_dir() {
}
inst() {
+ local _hostonly_install
+ if [[ "$1" == "-H" ]]; then
+ _hostonly_install="-H"
+ shift
+ fi
[[ -e ${initdir}/"${2:-$1}" ]] && return 0 # already there
- #dinfo "$DRACUT_INSTALL -l $@"
- $DRACUT_INSTALL ${initdir:+-D "$initdir"} ${DRACUT_RESOLVE_DEPS:+-l} ${DRACUT_FIPS_MODE:+-f} "$@"
- (($? != 0)) && derror $DRACUT_INSTALL ${initdir:+-D "$initdir"} ${DRACUT_RESOLVE_DEPS:+-l} ${DRACUT_FIPS_MODE:+-f} "$@" || :
+ $DRACUT_INSTALL ${initdir:+-D "$initdir"} ${DRACUT_RESOLVE_DEPS:+-l} ${DRACUT_FIPS_MODE:+-f} ${_hostonly_install:+-H} "$@"
+ (($? != 0)) && derror $DRACUT_INSTALL ${initdir:+-D "$initdir"} ${DRACUT_RESOLVE_DEPS:+-l} ${DRACUT_FIPS_MODE:+-f} ${_hostonly_install:+-H} "$@" || :
}
inst_simple() {
+ local _hostonly_install
+ if [[ "$1" == "-H" ]]; then
+ _hostonly_install="-H"
+ shift
+ fi
[[ -e ${initdir}/"${2:-$1}" ]] && return 0 # already there
[[ -e $1 ]] || return 1 # no source
- $DRACUT_INSTALL ${initdir:+-D "$initdir"} "$@"
- (($? != 0)) && derror $DRACUT_INSTALL ${initdir:+-D "$initdir"} "$@" || :
+ $DRACUT_INSTALL ${initdir:+-D "$initdir"} ${_hostonly_install:+-H} "$@"
+ (($? != 0)) && derror $DRACUT_INSTALL ${initdir:+-D "$initdir"} ${_hostonly_install:+-H} "$@" || :
}
inst_symlink() {
+ local _hostonly_install
+ if [[ "$1" == "-H" ]]; then
+ _hostonly_install="-H"
+ shift
+ fi
[[ -e ${initdir}/"${2:-$1}" ]] && return 0 # already there
[[ -L $1 ]] || return 1
- $DRACUT_INSTALL ${initdir:+-D "$initdir"} ${DRACUT_RESOLVE_DEPS:+-l} ${DRACUT_FIPS_MODE:+-f} "$@"
- (($? != 0)) && derror $DRACUT_INSTALL ${initdir:+-D "$initdir"} ${DRACUT_RESOLVE_DEPS:+-l} ${DRACUT_FIPS_MODE:+-f} "$@" || :
+ $DRACUT_INSTALL ${initdir:+-D "$initdir"} ${DRACUT_RESOLVE_DEPS:+-l} ${DRACUT_FIPS_MODE:+-f} ${_hostonly_install:+-H} "$@"
+ (($? != 0)) && derror $DRACUT_INSTALL ${initdir:+-D "$initdir"} ${DRACUT_RESOLVE_DEPS:+-l} ${DRACUT_FIPS_MODE:+-f} ${_hostonly_install:+-H} "$@" || :
}
inst_multiple() {
- local ret
- #dinfo "initdir=$initdir $DRACUT_INSTALL -l $@"
+ local _ret
$DRACUT_INSTALL ${initdir:+-D "$initdir"} -a ${DRACUT_RESOLVE_DEPS:+-l} ${DRACUT_FIPS_MODE:+-f} "$@"
- ret=$?
- (($ret != 0)) && derror $DRACUT_INSTALL ${initdir:+-D "$initdir"} -a ${DRACUT_RESOLVE_DEPS:+-l} ${DRACUT_FIPS_MODE:+-f} "$@" || :
- return $ret
+ _ret=$?
+ (($_ret != 0)) && derror $DRACUT_INSTALL ${initdir:+-D "$initdir"} -a ${DRACUT_RESOLVE_DEPS:+-l} ${DRACUT_FIPS_MODE:+-f} ${_hostonly_install:+-H} "$@" || :
+ return $_ret
}
dracut_install() {
@@ -794,10 +807,15 @@ dracut_install() {
}
inst_library() {
+ local _hostonly_install
+ if [[ "$1" == "-H" ]]; then
+ _hostonly_install="-H"
+ shift
+ fi
[[ -e ${initdir}/"${2:-$1}" ]] && return 0 # already there
[[ -e $1 ]] || return 1 # no source
- $DRACUT_INSTALL ${initdir:+-D "$initdir"} ${DRACUT_RESOLVE_DEPS:+-l} ${DRACUT_FIPS_MODE:+-f} "$@"
- (($? != 0)) && derror $DRACUT_INSTALL ${initdir:+-D "$initdir"} ${DRACUT_RESOLVE_DEPS:+-l} ${DRACUT_FIPS_MODE:+-f} "$@" || :
+ $DRACUT_INSTALL ${initdir:+-D "$initdir"} ${DRACUT_RESOLVE_DEPS:+-l} ${DRACUT_FIPS_MODE:+-f} ${_hostonly_install:+-H} "$@"
+ (($? != 0)) && derror $DRACUT_INSTALL ${initdir:+-D "$initdir"} ${DRACUT_RESOLVE_DEPS:+-l} ${DRACUT_FIPS_MODE:+-f} ${_hostonly_install:+-H} "$@" || :
}
inst_binary() {

View File

@ -0,0 +1,27 @@
From 611c895772c73ebb5f769942bca5d5991adc169e Mon Sep 17 00:00:00 2001
From: Peter Robinson <pbrobinson@gmail.com>
Date: Sun, 20 Jul 2014 22:20:04 +0100
Subject: [PATCH] ARM: update modules for ARM host only options
---
modules.d/90kernel-modules/module-setup.sh | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/modules.d/90kernel-modules/module-setup.sh b/modules.d/90kernel-modules/module-setup.sh
index cc79b88..1ce133f 100755
--- a/modules.d/90kernel-modules/module-setup.sh
+++ b/modules.d/90kernel-modules/module-setup.sh
@@ -51,9 +51,10 @@ installkernel() {
if [[ "$(uname -p)" == arm* ]]; then
# arm specific modules
- hostonly='' instmods omapdrm panel-tfp410
- instmods i2c-tegra gpio-regulator as3722-regulator \
- phy-tegra-usb ehci-tegra sdhci-tegra
+ hostonly='' instmods \
+ connector-hdmi connector-dvi encoder-tfp410 \
+ encoder-tpd12s015 i2c-tegra gpio-regulator \
+ as3722-regulator orion-ehci ehci-tegra
fi
# install virtual machine support

View File

@ -0,0 +1,40 @@
From ad8638e04e4ac3641afee0e273c91aa3fb6d4278 Mon Sep 17 00:00:00 2001
From: Harald Hoyer <harald@redhat.com>
Date: Tue, 22 Jul 2014 11:51:08 +0200
Subject: [PATCH] base/dracut-lib:pidof() turn off debugging
---
modules.d/99base/dracut-lib.sh | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/modules.d/99base/dracut-lib.sh b/modules.d/99base/dracut-lib.sh
index a77b843..abcebf5 100755
--- a/modules.d/99base/dracut-lib.sh
+++ b/modules.d/99base/dracut-lib.sh
@@ -991,13 +991,17 @@ wait_for_loginit()
# pidof version for root
if ! command -v pidof >/dev/null 2>/dev/null; then
pidof() {
+ debug_off
local _cmd
local _exe
local _rl
local _ret=1
local i
_cmd="$1"
- [ -z "$_cmd" ] && return 1
+ if [ -z "$_cmd" ]; then
+ debug_on
+ return 1
+ fi
_exe=$(type -P "$1")
for i in /proc/*/exe; do
[ -e "$i" ] || continue
@@ -1011,6 +1015,7 @@ if ! command -v pidof >/dev/null 2>/dev/null; then
echo ${i##/proc/}
_ret=0
done
+ debug_on
return $_ret
}
fi

View File

@ -0,0 +1,125 @@
From 7b46244bb94e3dfd635a8d222044ae7fc920240d Mon Sep 17 00:00:00 2001
From: Harald Hoyer <harald@redhat.com>
Date: Tue, 22 Jul 2014 11:03:56 +0200
Subject: [PATCH] network: add rd.route parameter
---
dracut.cmdline.7.asc | 15 +++++++++++++-
modules.d/40network/net-lib.sh | 42 ++++++++++++++++++++++++++++++++++++++++
modules.d/45ifcfg/write-ifcfg.sh | 3 +++
3 files changed, 59 insertions(+), 1 deletion(-)
diff --git a/dracut.cmdline.7.asc b/dracut.cmdline.7.asc
index fef13b3..f66bace 100644
--- a/dracut.cmdline.7.asc
+++ b/dracut.cmdline.7.asc
@@ -493,6 +493,19 @@ WARNING: Do **not** use the default kernel naming scheme for the interface name,
as it can conflict with the kernel names. So, don't use "eth[0-9]+" for the
interface name. Better name it "bootnet" or "bluesocket".
+**rd.route=**__<net>__/__<netmask>__:__<gateway>__[:__<interface>__]::
+ Add a static route with route options, which are separated by a colon.
+ IPv6 addresses have to be put in brackets.
++
+[listing]
+.Example
+--
+ rd.route=192.168.200.0/24:192.168.100.222:ens10
+ rd.route=192.168.200.0/24:192.168.100.222
+ rd.route=192.168.200.0/24::ens10
+ rd.route=[2001:DB8:3::/8]:[2001:DB8:2::1]:ens10
+--
+
**bootdev=**__<interface>__::
specify network interface to use routing and netroot information from.
Required if multiple ip= lines are used.
@@ -540,7 +553,7 @@ NFS
~~~
**root=**\[_<server-ip>_:]__<root-dir>__[:__<nfs-options>__]::
mount nfs share from <server-ip>:/<root-dir>, if no server-ip is given, use
- dhcp next_server. if server-ip is an IPv6 address it has to be put in
+ dhcp next_server. If server-ip is an IPv6 address it has to be put in
brackets, e.g. [2001:DB8::1]. NFS options can be appended with the prefix
":" or "," and are seperated by ",".
diff --git a/modules.d/40network/net-lib.sh b/modules.d/40network/net-lib.sh
index f8e1179..c118c53 100755
--- a/modules.d/40network/net-lib.sh
+++ b/modules.d/40network/net-lib.sh
@@ -89,6 +89,7 @@ ifdown() {
setup_net() {
local netif="$1" f="" gw_ip="" netroot_ip="" iface="" IFACES=""
+ local _p
[ -e /tmp/net.$netif.did-setup ] && return
[ -e /sys/class/net/$netif/address ] && \
[ -e /tmp/net.$(cat /sys/class/net/$netif/address).did-setup ] && return
@@ -103,6 +104,20 @@ setup_net() {
[ -e /tmp/net.$netif.resolv.conf ] && \
cp -f /tmp/net.$netif.resolv.conf /etc/resolv.conf
+ # add static route
+ for _p in $(getargs rd.route); do
+ route_to_var "$_p" || continue
+ [ -n "$route_dev" ] && [ "$route_dev" != "$netif"] && continue
+ ip route add "$route_mask" ${route_gw:+via "$route_gw"} ${route_dev:+dev "$route_dev"}
+ if strstr ":" "$route_mask"; then
+ printf -- "%s\n" "$route_mask ${route_gw:+via $route_gw} ${route_dev:+dev $route_dev}" \
+ > /tmp/net.route6."$netif"
+ else
+ printf -- "%s\n" "$route_mask ${route_gw:+via $route_gw} ${route_dev:+dev $route_dev}" \
+ > /tmp/net.route."$netif"
+ fi
+ done
+
# 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
@@ -400,6 +415,33 @@ ip_to_var() {
fi
}
+route_to_var() {
+ local v=${1}:
+ local i
+ set --
+ while [ -n "$v" ]; do
+ if [ "${v#\[*:*:*\]:}" != "$v" ]; then
+ # handle IPv6 address
+ i="${v%%\]:*}"
+ i="${i##\[}"
+ set -- "$@" "$i"
+ v=${v#\[$i\]:}
+ else
+ set -- "$@" "${v%%:*}"
+ v=${v#*:}
+ fi
+ done
+
+ unset route_mask route_gw route_dev
+ case $# in
+ 2) [ -n "$1" ] && route_mask="$1"; [ -n "$2" ] && route_gw="$2"
+ return 0;;
+ 3) [ -n "$1" ] && route_mask="$1"; [ -n "$2" ] && route_gw="$2"; [ -n "$3" ] && route_dev="$3"
+ return 0;;
+ *) return 1;;
+ esac
+}
+
parse_ifname_opts() {
local IFS=:
set $1
diff --git a/modules.d/45ifcfg/write-ifcfg.sh b/modules.d/45ifcfg/write-ifcfg.sh
index 803ae8e..7e301de 100755
--- a/modules.d/45ifcfg/write-ifcfg.sh
+++ b/modules.d/45ifcfg/write-ifcfg.sh
@@ -268,6 +268,9 @@ for netup in /tmp/net.*.did-setup ; do
echo "DNS${i}=\"${ns}\"" >> /tmp/ifcfg/ifcfg-$netif
i=$((i+1))
done
+
+ [ -f /tmp/net.route6."$netif" ] && cp /tmp/net.route6."$netif" /tmp/ifcfg/route6-"$netif"
+ [ -f /tmp/net.route."$netif" ] && cp /tmp/net.route."$netif" /tmp/ifcfg/route-"$netif"
done
# Pass network opts

View File

@ -0,0 +1,129 @@
From 54b68829b60bc3f4c28cfca1ab0336584fe1e74c Mon Sep 17 00:00:00 2001
From: Harald Hoyer <harald@redhat.com>
Date: Tue, 22 Jul 2014 14:09:06 +0200
Subject: [PATCH] add "--install-optional" and install_optional_items
---
dracut-bash-completion.sh | 4 ++--
dracut.8.asc | 3 +++
dracut.conf.5.asc | 4 ++++
dracut.conf.d/fedora.conf.example | 2 +-
dracut.sh | 13 +++++++++++++
5 files changed, 23 insertions(+), 3 deletions(-)
diff --git a/dracut-bash-completion.sh b/dracut-bash-completion.sh
index 9f359c6..feced60 100644
--- a/dracut-bash-completion.sh
+++ b/dracut-bash-completion.sh
@@ -40,7 +40,7 @@ _dracut() {
--omit-drivers --modules --omit --drivers --filesystems --install
--fwdir --libdirs --fscks --add-fstab --mount --device --nofscks
--kmoddir --conf --confdir --tmpdir --stdlog --compress --prefix
- --kernel-cmdline --sshkey --persistent-policy'
+ --kernel-cmdline --sshkey --persistent-policy --install-optional'
)
if __contains_word "$prev" ${OPTS[ARG]}; then
@@ -49,7 +49,7 @@ _dracut() {
comps=$(compgen -d -- "$cur")
compopt -o filenames
;;
- -c|--conf|--sshkey|--add-fstab|--add-device|-I|--install)
+ -c|--conf|--sshkey|--add-fstab|--add-device|-I|--install|--install-optional)
comps=$(compgen -f -- "$cur")
compopt -o filenames
;;
diff --git a/dracut.8.asc b/dracut.8.asc
index 14ce26b..51a4e9f 100644
--- a/dracut.8.asc
+++ b/dracut.8.asc
@@ -349,6 +349,9 @@ example:
----
===============================
+**--install-optional** _<file list>_::
+ install the space separated list of files into the initramfs, if they exist.
+
**--gzip**::
Compress the generated initramfs using gzip. This will be done by default,
unless another compression option or --no-compress is passed. Equivalent to
diff --git a/dracut.conf.5.asc b/dracut.conf.5.asc
index be62da9..0b6be6a 100644
--- a/dracut.conf.5.asc
+++ b/dracut.conf.5.asc
@@ -66,6 +66,10 @@ Configuration files must have the extension .conf; other extensions are ignored.
*install_items+=*" __<file>__[ __<file>__ ...] "::
Specify additional files to include in the initramfs, separated by spaces.
+*install_optional_items+=*" __<file>__[ __<file>__ ...] "::
+ Specify additional files to include in the initramfs, separated by spaces,
+ if they exist.
+
*do_strip=*"__{yes|no}__"::
Strip binaries in the initramfs (default=yes)
diff --git a/dracut.conf.d/fedora.conf.example b/dracut.conf.d/fedora.conf.example
index 495e8fb..c06202b 100644
--- a/dracut.conf.d/fedora.conf.example
+++ b/dracut.conf.d/fedora.conf.example
@@ -6,7 +6,7 @@ i18n_default_font="latarcyrheb-sun16"
i18n_install_all="yes"
stdloglvl=3
sysloglvl=5
-install_items+=" vi /etc/virc ps grep cat rm "
+install_optional_items+=" vi /etc/virc ps grep cat rm "
prefix="/"
systemdutildir=/usr/lib/systemd
systemdsystemunitdir=/usr/lib/systemd/system
diff --git a/dracut.sh b/dracut.sh
index 22273a5..3e1bf44 100755
--- a/dracut.sh
+++ b/dracut.sh
@@ -158,6 +158,8 @@ Creates initial ramdisk images for preloading modules
in the final initramfs.
-I, --install [LIST] Install the space separated list of files into the
initramfs.
+ --install-optional [LIST] Install the space separated list of files into the
+ initramfs, if they exist.
--gzip Compress the generated initramfs using gzip.
This will be done by default, unless another
compression option or --no-compress is passed.
@@ -305,6 +307,7 @@ rearrange_params()
--long drivers: \
--long filesystems: \
--long install: \
+ --long install-optional: \
--long fwdir: \
--long libdirs: \
--long fscks: \
@@ -469,6 +472,9 @@ while :; do
-d|--drivers) push drivers_l "$2"; PARMS_TO_STORE+=" '$2'"; shift;;
--filesystems) push filesystems_l "$2"; PARMS_TO_STORE+=" '$2'"; shift;;
-I|--install) push install_items_l "$2"; PARMS_TO_STORE+=" '$2'"; shift;;
+ --install-optional)
+ push install_optional_items_l \
+ "$2"; PARMS_TO_STORE+=" '$2'"; shift;;
--fwdir) push fw_dir_l "$2"; PARMS_TO_STORE+=" '$2'"; shift;;
--libdirs) push libdirs_l "$2"; PARMS_TO_STORE+=" '$2'"; shift;;
--fscks) push fscks_l "$2"; PARMS_TO_STORE+=" '$2'"; shift;;
@@ -716,6 +722,12 @@ if (( ${#install_items_l[@]} )); then
done
fi
+if (( ${#install_optional_items_l[@]} )); then
+ while pop install_optional_items_l val; do
+ install_optional_items+=" $val "
+ done
+fi
+
# these options override the stuff in the config file
if (( ${#dracutmodules_l[@]} )); then
dracutmodules=''
@@ -1317,6 +1329,7 @@ fi
if [[ $kernel_only != yes ]]; then
(( ${#install_items[@]} > 0 )) && inst_multiple ${install_items[@]}
+ (( ${#install_optional_items[@]} > 0 )) && inst_multiple -o ${install_optional_items[@]}
[[ $kernel_cmdline ]] && printf "%s\n" "$kernel_cmdline" >> "${initdir}/etc/cmdline.d/01-default.conf"

View File

@ -0,0 +1,31 @@
From ece72160cedbe47b973a7925d5e2f5adc409a849 Mon Sep 17 00:00:00 2001
From: Harald Hoyer <harald@redhat.com>
Date: Tue, 22 Jul 2014 14:22:21 +0200
Subject: [PATCH] test/TEST-30-ISCSI: add rd.shell to client root
---
test/TEST-30-ISCSI/client-init.sh | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/test/TEST-30-ISCSI/client-init.sh b/test/TEST-30-ISCSI/client-init.sh
index e78db27..b3e2ee1 100755
--- a/test/TEST-30-ISCSI/client-init.sh
+++ b/test/TEST-30-ISCSI/client-init.sh
@@ -1,6 +1,8 @@
#!/bin/sh
export PATH=/sbin:/bin:/usr/sbin:/usr/bin
exec >/dev/console 2>&1
+strstr() { [ "${1##*"$2"*}" != "$1" ]; }
+CMDLINE=$(while read line; do echo $line;done < /proc/cmdline)
export TERM=linux
export PS1='initramfs-test:\w\$ '
stty sane
@@ -11,4 +13,8 @@ while read dev fs fstype opts rest; do
break
done < /proc/mounts
#sh -i
+if strstr "$CMDLINE" "rd.shell"; then
+ strstr "$(setsid --help)" "control" && CTTY="-c"
+ setsid $CTTY sh -i
+fi
poweroff -f

View File

@ -0,0 +1,62 @@
From eab9b75c8a9b106d2f35faae0af51ab1c66e8da1 Mon Sep 17 00:00:00 2001
From: Harald Hoyer <harald@redhat.com>
Date: Tue, 22 Jul 2014 14:43:33 +0200
Subject: [PATCH] dracut.sh: add DRACUT_PATH
DRACUT_PATH can now be used to specify the PATH used by dracut
to search for binaries instead of the default
/usr/sbin:/sbin:/usr/bin:/bin
This should be set in the distribution config file
/usr/lib/dracut/dracut.conf.d/01-dist.conf
---
dracut.sh | 25 ++++++++++++++-----------
1 file changed, 14 insertions(+), 11 deletions(-)
diff --git a/dracut.sh b/dracut.sh
index 3e1bf44..1844336 100755
--- a/dracut.sh
+++ b/dracut.sh
@@ -626,21 +626,10 @@ if ! [[ $outfile ]]; then
fi
fi
-for i in /usr/sbin /sbin /usr/bin /bin; do
- rl=$i
- if [ -L "$i" ]; then
- rl=$(readlink -f $i)
- fi
- if [[ "$NPATH" != *:$rl* ]] ; then
- NPATH+=":$rl"
- fi
-done
-export PATH="${NPATH#:}"
unset LC_MESSAGES
unset LC_CTYPE
export LC_ALL=C
export LANG=C
-unset NPATH
unset LD_LIBRARY_PATH
unset LD_PRELOAD
unset GREP_OPTIONS
@@ -685,6 +674,20 @@ for f in $(dropindirs_sort ".conf" "$confdir" "$dracutbasedir/dracut.conf.d"); d
[[ -e $f ]] && . "$f"
done
+DRACUT_PATH=${DRACUT_PATH:-/usr/sbin /sbin /usr/bin /bin}
+
+for i in $DRACUT_PATH; do
+ rl=$i
+ if [ -L "$i" ]; then
+ rl=$(readlink -f $i)
+ fi
+ if [[ "$NPATH" != *:$rl* ]] ; then
+ NPATH+=":$rl"
+ fi
+done
+export PATH="${NPATH#:}"
+unset NPATH
+
# these optins add to the stuff in the config file
if (( ${#add_dracutmodules_l[@]} )); then
while pop add_dracutmodules_l val; do

View File

@ -11,7 +11,7 @@
Name: dracut Name: dracut
Version: 038 Version: 038
Release: 2%{?dist} Release: 14.git20140724%{?dist}
Summary: Initramfs generator using udev Summary: Initramfs generator using udev
%if 0%{?fedora} || 0%{?rhel} %if 0%{?fedora} || 0%{?rhel}
@ -32,6 +32,20 @@ URL: https://dracut.wiki.kernel.org/
Source0: http://www.kernel.org/pub/linux/utils/boot/dracut/dracut-%{version}.tar.xz Source0: http://www.kernel.org/pub/linux/utils/boot/dracut/dracut-%{version}.tar.xz
Source1: https://www.gnu.org/licenses/lgpl-2.1.txt Source1: https://www.gnu.org/licenses/lgpl-2.1.txt
Patch1: 0001-modsign-do-not-hardcode-path-to-keyctl.patch
Patch2: 0002-lvm-module-setup.sh-check-for-existance-of-69-dm-lvm.patch
Patch3: 0003-dracut.sh-always-copy-prelink-files-in-FIPS-mode.patch
Patch4: 0004-plymouth-also-find-the-pkglibdir-on-debian.patch
Patch5: 0005-dracut-functions.sh-speed-up-ldconfig_paths.patch
Patch6: 0006-Installing-an-OS-with-VLAN-enabled-to-an-ISCSI-LUN-f.patch
Patch7: 0007-dracut-functions.sh-fix-inst-functions-for-H-handlin.patch
Patch8: 0008-ARM-update-modules-for-ARM-host-only-options.patch
Patch9: 0009-base-dracut-lib-pidof-turn-off-debugging.patch
Patch10: 0010-network-add-rd.route-parameter.patch
Patch11: 0011-add-install-optional-and-install_optional_items.patch
Patch12: 0012-test-TEST-30-ISCSI-add-rd.shell-to-client-root.patch
Patch13: 0013-dracut.sh-add-DRACUT_PATH.patch
BuildRequires: bash git BuildRequires: bash git
%if 0%{?fedora} || 0%{?rhel} %if 0%{?fedora} || 0%{?rhel}
@ -476,6 +490,14 @@ rm -rf -- $RPM_BUILD_ROOT
%endif %endif
%changelog %changelog
* Thu Jul 24 2014 Harald Hoyer <harald@redhat.com> 038-14.git20140724
- fixed lvm modules issues
Resolves: rhbz#1118890
- fixed vlan issues
- fixed prelink for FIPS
- new rd.route parameter
- more ARM modules
* Fri Jul 11 2014 Tom Callaway <spot@fedoraproject.org> - 038-2 * Fri Jul 11 2014 Tom Callaway <spot@fedoraproject.org> - 038-2
- fix license handling - fix license handling