dracut-018-12.git20120416

- new upstream version, which fixes various anaconda loader issues
This commit is contained in:
Harald Hoyer 2012-04-16 15:55:53 +02:00
parent 1a09cd0408
commit ab65ae207e
12 changed files with 916 additions and 1 deletions

View File

@ -0,0 +1,25 @@
From d8f0e320c267af0ce373066f524eab618ce931af Mon Sep 17 00:00:00 2001
From: Will Woods <wwoods@redhat.com>
Date: Thu, 5 Apr 2012 13:01:35 -0400
Subject: [PATCH] dracut-lib: add str_ends, to go along with str_starts
---
modules.d/99base/dracut-lib.sh | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/modules.d/99base/dracut-lib.sh b/modules.d/99base/dracut-lib.sh
index cb2e4dc..1ecd286 100755
--- a/modules.d/99base/dracut-lib.sh
+++ b/modules.d/99base/dracut-lib.sh
@@ -12,6 +12,11 @@ str_starts() {
[ "${1#$2*}" != "$1" ]
}
+# returns OK if $1 contains $2 at the end
+str_ends() {
+ [ "${1%*$2}" != "$1" ]
+}
+
# replaces all occurrences of 'search' in 'str' with 'replacement'
#
# str_replace str search replacement

View File

@ -0,0 +1,55 @@
From 1e4a880125ed2d8991d10e8f8a41b37bad898c28 Mon Sep 17 00:00:00 2001
From: Will Woods <wwoods@redhat.com>
Date: Thu, 5 Apr 2012 13:01:36 -0400
Subject: [PATCH] run setup_net at start of initqueue/online hook
This makes sure the network is active and ready to use during the
initqueue/online hook.
It also makes it so you can run setup_net repeatedly without causing
error messages.
---
modules.d/40network/net-genrules.sh | 3 +++
modules.d/40network/net-lib.sh | 3 +++
2 files changed, 6 insertions(+)
diff --git a/modules.d/40network/net-genrules.sh b/modules.d/40network/net-genrules.sh
index 84fd3ac..b3d5584 100755
--- a/modules.d/40network/net-genrules.sh
+++ b/modules.d/40network/net-genrules.sh
@@ -53,5 +53,8 @@ fix_bootif() {
# Run the "online" hook
printf 'SUBSYSTEM=="net", ACTION=="online", RUN+="/sbin/initqueue --onetime --env netif=$env{INTERFACE} source_hook initqueue/online"\n'
+ # And make sure we run setup_net at the start of the hook
+ echo '. /lib/net-lib.sh; setup_net $netif' > \
+ $hookdir/initqueue/online/05-setup_net.sh
} > /etc/udev/rules.d/60-net.rules
diff --git a/modules.d/40network/net-lib.sh b/modules.d/40network/net-lib.sh
index 467c79f..a7abe81 100644
--- a/modules.d/40network/net-lib.sh
+++ b/modules.d/40network/net-lib.sh
@@ -59,12 +59,14 @@ ifdown() {
ip link set $netif down
ip addr flush dev $netif
echo "#empty" > /etc/resolv.conf
+ rm -f /tmp/net.$netif.did-setup
# 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.$netif.did-setup ] && return
[ -e "/tmp/net.ifaces" ] && read IFACES < /tmp/net.ifaces
[ -z "$IFACES" ] && IFACES="$netif"
for iface in $IFACES ; do
@@ -100,6 +102,7 @@ setup_net() {
if [ -n "$dest" ] && ! arping -q -f -w 60 -I $netif $dest ; then
info "Resolving $dest via ARP on $netif failed"
fi
+ > /tmp/net.$netif.did-setup
}
set_ifname() {

View File

@ -0,0 +1,65 @@
From e173f0b384f699c2519db879f3f562b1f6676d8d Mon Sep 17 00:00:00 2001
From: Will Woods <wwoods@redhat.com>
Date: Thu, 5 Apr 2012 13:01:37 -0400
Subject: [PATCH] network: add save_netinfo, fix problems with nfs->NM
takeover
For NetworkManager to properly take over a NFS-root system, we need to
have the interface name(s) in /tmp/net.ifaces and save the dhclient
lease. This lets the ifcfg module do its magic.
save_netinfo should properly write out /tmp/net.ifaces when needed, and
copies the dhclient files into place.
---
modules.d/40network/net-lib.sh | 16 ++++++++++++++++
modules.d/40network/netroot.sh | 10 ++--------
2 files changed, 18 insertions(+), 8 deletions(-)
diff --git a/modules.d/40network/net-lib.sh b/modules.d/40network/net-lib.sh
index a7abe81..c0f73da 100644
--- a/modules.d/40network/net-lib.sh
+++ b/modules.d/40network/net-lib.sh
@@ -105,6 +105,22 @@ setup_net() {
> /tmp/net.$netif.did-setup
}
+save_netinfo() {
+ local netif="$1" IFACES="" f="" i=""
+ [ -e /tmp/net.ifaces ] && read IFACES < /tmp/net.ifaces
+ # Add $netif to the front of IFACES (if it's not there already).
+ set -- "$netif"
+ for i in $IFACES; do [ "$i" != "$netif" ] && set -- "$@" "$i"; done
+ IFACES="$*"
+ for i in $IFACES; do
+ for f in /tmp/dhclient.$i.*; do
+ [ -f $f ] && cp -f $f /tmp/net.${f#/tmp/dhclient.}
+ done
+ done
+ echo $IFACES > /tmp/.net.ifaces.new
+ mv /tmp/.net.ifaces.new /tmp/net.ifaces
+}
+
set_ifname() {
local name="$1" mac="$2" num=0 n=""
# if it's already set, return the existing name
diff --git a/modules.d/40network/netroot.sh b/modules.d/40network/netroot.sh
index ac1c215..1bb62bb 100755
--- a/modules.d/40network/netroot.sh
+++ b/modules.d/40network/netroot.sh
@@ -84,14 +84,8 @@ source_hook netroot
# Run the handler; don't store the root, it may change from device to device
# XXX other variables to export?
if $handler $netif $netroot $NEWROOT; then
- # Network rootfs mount successful
- for iface in $IFACES ; do
- [ -f /tmp/dhclient.$iface.lease ] && cp /tmp/dhclient.$iface.lease /tmp/net.$iface.lease
- [ -f /tmp/dhclient.$iface.dhcpopts ] && cp /tmp/dhclient.$iface.dhcpopts /tmp/net.$iface.dhcpopts
- done
-
- # Save used netif for later use
- [ ! -f /tmp/net.ifaces ] && echo $netif > /tmp/net.ifaces
+ # Network rootfs mount successful - save interface info for ifcfg etc.
+ save_netinfo $netif
else
warn "Mounting root via '$netif' failed"
# If we're trying with multiple interfaces, put that one down.

View File

@ -0,0 +1,35 @@
From f7cadaa843498c4b986f8a030fab39002ad108b6 Mon Sep 17 00:00:00 2001
From: Will Woods <wwoods@redhat.com>
Date: Thu, 5 Apr 2012 13:01:38 -0400
Subject: [PATCH] Make splitsep work as documented with less vars than fields
According to its comment in dracut-lib.sh:
splitsep ":" "one:all:the:rest" one two
should set two="all:the:rest". But there's no check to see if the
current field is the last field, so it just gets "all".
---
modules.d/99base/dracut-lib.sh | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/modules.d/99base/dracut-lib.sh b/modules.d/99base/dracut-lib.sh
index 1ecd286..e10a34d 100755
--- a/modules.d/99base/dracut-lib.sh
+++ b/modules.d/99base/dracut-lib.sh
@@ -224,13 +224,14 @@ splitsep() {
local sep="$1"; local str="$2"; shift 2
local tmp
- while [ -n "$str" -a -n "$*" ]; do
+ while [ -n "$str" -a "$#" -gt 1 ]; do
tmp="${str%%$sep*}"
eval "$1=${tmp}"
str="${str#$tmp}"
str="${str#$sep}"
shift
done
+ [ -n "$str" -a -n "$1" ] && eval "$1=$str"
return 0
}

View File

@ -0,0 +1,109 @@
From bd3bf2ce41379459e79b9f48027d457caecce30a Mon Sep 17 00:00:00 2001
From: Will Woods <wwoods@redhat.com>
Date: Thu, 5 Apr 2012 13:01:39 -0400
Subject: [PATCH] shutdown: use emergency_shell from dracut-lib
---
modules.d/99base/dracut-lib.sh | 10 ++++----
modules.d/99shutdown/shutdown.sh | 47 +++-----------------------------------
2 files changed, 9 insertions(+), 48 deletions(-)
diff --git a/modules.d/99base/dracut-lib.sh b/modules.d/99base/dracut-lib.sh
index e10a34d..a29d586 100755
--- a/modules.d/99base/dracut-lib.sh
+++ b/modules.d/99base/dracut-lib.sh
@@ -767,15 +767,17 @@ emergency_shell()
{
local _ctty
set +e
+ local _rdshell_name="dracut" action="Boot" hook="emergency"
if [ "$1" = "-n" ]; then
_rdshell_name=$2
shift 2
- else
- _rdshell_name=dracut
+ elif [ "$1" = "--shutdown" ]; then
+ _rdshell_name=$2; action="Shutdown"; hook="shutdown-emergency"
+ shift 2
fi
echo ; echo
warn $@
- source_hook emergency
+ source_hook "$hook"
echo
wait_for_loginit
[ -e /run/initramfs/.die ] && exit 1
@@ -798,7 +800,7 @@ emergency_shell()
strstr "$(setsid --help 2>/dev/null)" "ctty" && CTTY="-c"
setsid $CTTY /bin/sh -i -l 0<$_ctty 1>$_ctty 2>&1
else
- warn "Boot has failed. To debug this issue add \"rdshell\" to the kernel command line."
+ warn "$action has failed. To debug this issue add \"rd.shell\" to the kernel command line."
# cause a kernel panic
exit 1
fi
diff --git a/modules.d/99shutdown/shutdown.sh b/modules.d/99shutdown/shutdown.sh
index 8817a4c..45345a4 100755
--- a/modules.d/99shutdown/shutdown.sh
+++ b/modules.d/99shutdown/shutdown.sh
@@ -12,49 +12,8 @@
export TERM=linux
PATH=/usr/sbin:/usr/bin:/sbin:/bin
-emergency_shell()
-{
- local _ctty
- set +e
- if [ "$1" = "-n" ]; then
- _rdshell_name=$2
- shift 2
- else
- _rdshell_name=dracut
- fi
- echo ; echo
- warn $@
- source_hook shutdown-emergency
- echo
- if getargbool 1 rd.shell -y rdshell || getarg rd.break rdbreak; then
- echo "Dropping to debug shell."
- echo
- export PS1="$_rdshell_name:\${PWD}# "
- [ -e /.profile ] || >/.profile
-
- _ctty="$(getarg rd.ctty=)" && _ctty="/dev/${_ctty##*/}"
- if [ -z "$_ctty" ]; then
- _ctty=console
- while [ -f /sys/class/tty/$_ctty/active ]; do
- _ctty=$(cat /sys/class/tty/$_ctty/active)
- _ctty=${_ctty##* } # last one in the list
- done
- _ctty=/dev/$_ctty
- fi
- [ -c "$_ctty" ] || _ctty=/dev/tty1
- strstr "$(setsid --help)" "control" && CTTY="-c"
- setsid $CTTY /bin/sh -i -l 0<$_ctty 1>$_ctty 2>&1
- else
- exec /lib/systemd/systemd-shutdown "$@"
- warn "Shutdown has failed. To debug this issue add \"rdshell\" to the kernel command line."
- # cause a kernel panic
- exit 1
- fi
-}
-
-trap "emergency_shell Signal caught!" 0
-
-getarg 'rd.break=pre-shutdown' && emergency_shell -n cmdline "Break before pre-shutdown"
+trap "emergency_shell --shutdown shutdown Signal caught!" 0
+getarg 'rd.break=pre-shutdown' && emergency_shell --shutdown pre-shutdown "Break before pre-shutdown"
umount_a() {
local _did_umount="n"
@@ -97,7 +56,7 @@ while _check_shutdown; do
done
_check_shutdown final
-getarg 'rd.break=shutdown' && emergency_shell -n cmdline "Break before shutdown"
+getarg 'rd.break=shutdown' && emergency_shell --shutdown shutdown "Break before shutdown"
[ "$1" = "reboot" ] && reboot -f -d -n --no-wall
[ "$1" = "poweroff" ] && poweroff -f -d -n --no-wall
[ "$1" = "halt" ] && halt -f -d -n --no-wall

View File

@ -0,0 +1,52 @@
From 6625b74e90a0b6918c90c408215e76719e459883 Mon Sep 17 00:00:00 2001
From: Daniel Drake <dsd@laptop.org>
Date: Wed, 11 Apr 2012 23:00:43 +0100
Subject: [PATCH] rootfs-block: avoid remount when options don't change
Mounting, unmounting and then mounting a disk partition takes some
time.
On embedded systems such as OLPC XO where we disable fsck and fstab
reading, the root options are not going to change throughout the
mount_root() function, so remounting is time consuming and without
change.
Detect and optimize for this case so that the filesystem is only
mounted once.
---
modules.d/95rootfs-block/mount-root.sh | 12 ++++++++----
1 file changed, 8 insertions(+), 4 deletions(-)
diff --git a/modules.d/95rootfs-block/mount-root.sh b/modules.d/95rootfs-block/mount-root.sh
index 2c89431..aef99ae 100755
--- a/modules.d/95rootfs-block/mount-root.sh
+++ b/modules.d/95rootfs-block/mount-root.sh
@@ -98,20 +98,24 @@ mount_root() {
# them; rflags is guaranteed to not be empty
rflags="${rootopts:+"${rootopts},"}${rflags}"
- umount "$NEWROOT"
-
# backslashes are treated as escape character in fstab
# esc_root=$(echo ${root#block:} | sed 's,\\,\\\\,g')
# printf '%s %s %s %s 1 1 \n' "$esc_root" "$NEWROOT" "$rootfs" "$rflags" >/etc/fstab
+ ran_fsck=0
if [ -z "$fastboot" -a "$READONLY" != "yes" ] && ! strstr "${rflags},${rootopts}" _netdev; then
+ umount "$NEWROOT"
fsck_single "${root#block:}" "$rootfs" "$fsckoptions"
_ret=$?
[ $_ret -ne 255 ] && echo $_ret >/run/initramfs/root-fsck
+ ran_fsck=1
fi
- info "Remounting ${root#block:} with -o ${rflags}"
- mount -t "$rootfs" -o "$rflags" "${root#block:}" "$NEWROOT" 2>&1 | vinfo
+ if [ -n "$rootopts" -o "$ran_fsck" = "1" ]; then
+ info "Remounting ${root#block:} with -o ${rflags}"
+ umount "$NEWROOT" &>/dev/null
+ mount -t "$rootfs" -o "$rflags" "${root#block:}" "$NEWROOT" 2>&1 | vinfo
+ fi
[ -f "$NEWROOT"/forcefsck ] && rm -f "$NEWROOT"/forcefsck 2>/dev/null
[ -f "$NEWROOT"/.autofsck ] && rm -f "$NEWROOT"/.autofsck 2>/dev/null

View File

@ -0,0 +1,279 @@
From c9143a63fef0d6f2dfd7cc37b09fc68d744d900f Mon Sep 17 00:00:00 2001
From: Jon Ander Hernandez <jonan.h@gmail.com>
Date: Tue, 10 Apr 2012 15:14:38 +0200
Subject: [PATCH] Debian multiarch support
Another solution could be searching in directories found at
/etc/ld.so.conf.d/*.conf or adding a new parameter. Here is a patch
which adds a new --libdirs parameter, and also a new inst_libdir_file
function which will try to expand metacharacters on each lib
directory:
inst_libdir_file "libdevmapper-event-lvm*.so"
---
dracut-functions.sh | 28 ++++++++++++++++++++++++++++
dracut.sh | 12 ++++++++++--
modules.d/01fips/module-setup.sh | 11 +++++------
modules.d/40network/module-setup.sh | 9 ++-------
modules.d/80cms/module-setup.sh | 4 +---
modules.d/90dm/module-setup.sh | 4 +---
modules.d/90dmraid/module-setup.sh | 4 +---
modules.d/90lvm/module-setup.sh | 4 +---
modules.d/90multipath/module-setup.sh | 6 ++++--
modules.d/95nfs/module-setup.sh | 6 +-----
modules.d/95udev-rules/module-setup.sh | 4 +---
modules.d/98syslog/module-setup.sh | 8 +++-----
12 files changed, 58 insertions(+), 42 deletions(-)
diff --git a/dracut-functions.sh b/dracut-functions.sh
index 910f2d8..f5611dc 100755
--- a/dracut-functions.sh
+++ b/dracut-functions.sh
@@ -677,6 +677,34 @@ dracut_install() {
done
}
+
+# inst_libdir_file [-n <pattern>] <file> [<file>...]
+# Install a <file> located on a lib directory to the initramfs image
+# -n <pattern> install non-matching files
+inst_libdir_file() {
+ if [[ "$1" == "-n" ]]; then
+ local _pattern=$1
+ shift 2
+ for _dir in $libdirs; do
+ for _i in "$@"; do
+ for _f in "$_dir"/$_i; do
+ [[ "$_i" =~ $_pattern ]] || continue
+ [[ -e "$_i" ]] && dracut_install "$_i"
+ done
+ done
+ done
+ else
+ for _dir in $libdirs; do
+ for _i in "$@"; do
+ for _f in "$_dir"/$_i; do
+ [[ -e "$_f" ]] && dracut_install "$_f"
+ done
+ done
+ done
+ fi
+}
+
+
# install function decompressing the target and handling symlinks
# $@ = list of compressed (gz or bz2) files or symlinks pointing to such files
#
diff --git a/dracut.sh b/dracut.sh
index 0418c78..7f61143 100755
--- a/dracut.sh
+++ b/dracut.sh
@@ -221,6 +221,7 @@ while (($# > 0)); do
--filesystems) push_arg filesystems_l "$@" || shift;;
-I|--install) push_arg install_items_l "$@" || shift;;
--fwdir) push_arg fw_dir_l "$@" || shift;;
+ --libdirs) push_arg libdirs_l "$@" || shift;;
--fscks) push_arg fscks_l "$@" || shift;;
--add-fstab) push_arg add_fstab_l "$@" || shift;;
--mount) push_arg fstab_lines "$@" || shift;;
@@ -400,6 +401,13 @@ if (( ${#fw_dir_l[@]} )); then
done
fi
+if (( ${#libdirs_l[@]} )); then
+ libdirs=''
+ while pop libdirs_l val; do
+ libdirs+="$val "
+ done
+fi
+
[[ $stdloglvl_l ]] && stdloglvl=$stdloglvl_l
[[ ! $stdloglvl ]] && stdloglvl=4
stdloglvl=$((stdloglvl + verbosity_mod_l))
@@ -505,14 +513,14 @@ ddebug "Executing $0 $dracut_args"
# Detect lib paths
[[ $libdir ]] || for libdir in /lib64 /lib; do
- [[ -d $libdir ]] && break
+ [[ -d $libdir ]] && libdirs+=" $libdir" && break
done || {
dfatal 'No lib directory?!!!'
exit 1
}
[[ $usrlibdir ]] || for usrlibdir in /usr/lib64 /usr/lib; do
- [[ -d $usrlibdir ]] && break
+ [[ -d $usrlibdir ]] && libdirs+=" $usrlibdir" && break
done || dwarn 'No usr/lib directory!'
# This is kinda legacy -- eventually it should go away.
diff --git a/modules.d/01fips/module-setup.sh b/modules.d/01fips/module-setup.sh
index a490827..6bfe31e 100755
--- a/modules.d/01fips/module-setup.sh
+++ b/modules.d/01fips/module-setup.sh
@@ -34,12 +34,11 @@ install() {
dracut_install sha512hmac rmmod insmod mount uname umount
- for _dir in "$usrlibdir" "$libdir"; do
- [[ -e $_dir/libsoftokn3.so ]] && \
- dracut_install $_dir/libsoftokn3.so $_dir/libsoftokn3.chk \
- $_dir/libfreebl3.so $_dir/libfreebl3.chk && \
- break
- done
+ inst_libdir_file libsoftokn3.so
+ inst_libdir_file libsoftokn3.so
+ inst_libdir_file libsoftokn3.chk
+ inst_libdir_file libfreebl3.so
+ inst_libdir_file libfreebl3.chk
dracut_install $usrlibdir/hmaccalc/sha512hmac.hmac
if command -v prelink >/dev/null; then
diff --git a/modules.d/40network/module-setup.sh b/modules.d/40network/module-setup.sh
index c91f164..97fc5cb 100755
--- a/modules.d/40network/module-setup.sh
+++ b/modules.d/40network/module-setup.sh
@@ -89,12 +89,7 @@ install() {
_arch=$(uname -m)
- for _dir in "$usrlibdir/tls/$_arch" "$usrlibdir/tls" "$usrlibdir/$_arch" \
- "$usrlibdir" "$libdir"; do
- for _i in "$_dir"/libnss_dns.so.* "$_dir"/libnss_mdns4_minimal.so.*; do
- [ -e "$_i" ] && dracut_install "$_i"
- done
- done
-
+ inst_libdir_file {"tls/$_arch/",tls/,"$_arch/",}"libnss_dns.so.*"
+ inst_libdir_file {"tls/$_arch/",tls/,"$_arch/",}"libnss_mdns4_minimal.so.*"
}
diff --git a/modules.d/80cms/module-setup.sh b/modules.d/80cms/module-setup.sh
index 5cb5413..5cce1b4 100755
--- a/modules.d/80cms/module-setup.sh
+++ b/modules.d/80cms/module-setup.sh
@@ -31,9 +31,7 @@ install() {
[[ -f $file ]] && inst $file
done
- for file in {"$usrlibdir","$libdir"}/gconv/*; do
- [[ -f $file ]] && inst $file
- done
+ inst_libdir_file "gconv/*"
#inst /usr/lib/locale/locale-archive
dracut_install cmsfs-fuse fusermount ulockmgr_server bash tr insmod rmmod cat
diff --git a/modules.d/90dm/module-setup.sh b/modules.d/90dm/module-setup.sh
index a55d591..bac854a 100755
--- a/modules.d/90dm/module-setup.sh
+++ b/modules.d/90dm/module-setup.sh
@@ -22,9 +22,7 @@ install() {
type -P dmeventd >/dev/null && dracut_install dmeventd
- for _i in {"$libdir","$usrlibdir"}/libdevmapper-event.so*; do
- [ -e "$_i" ] && dracut_install "$_i"
- done
+ inst_libdir_file "libdevmapper-event.so*"
inst_rules 10-dm.rules 13-dm-disk.rules 95-dm-notify.rules
# Gentoo ebuild for LVM2 prior to 2.02.63-r1 doesn't install above rules
diff --git a/modules.d/90dmraid/module-setup.sh b/modules.d/90dmraid/module-setup.sh
index 786cf25..0a8ed7f 100755
--- a/modules.d/90dmraid/module-setup.sh
+++ b/modules.d/90dmraid/module-setup.sh
@@ -62,9 +62,7 @@ install() {
inst_rules 64-md-raid.rules
fi
- for _i in {"$libdir","$usrlibdir"}/libdmraid-events*.so*; do
- [ -e "$_i" ] && dracut_install "$_i"
- done
+ inst_libdir_file "libdmraid-events*.so*"
inst_rules "$moddir/61-dmraid-imsm.rules"
#inst "$moddir/dmraid-cleanup.sh" /sbin/dmraid-cleanup
diff --git a/modules.d/90lvm/module-setup.sh b/modules.d/90lvm/module-setup.sh
index cf46372..15c824d 100755
--- a/modules.d/90lvm/module-setup.sh
+++ b/modules.d/90lvm/module-setup.sh
@@ -60,8 +60,6 @@ install() {
inst "$moddir/lvm_scan.sh" /sbin/lvm_scan
inst_hook cmdline 30 "$moddir/parse-lvm.sh"
- for _i in {"$libdir","$usrlibdir"}/libdevmapper-event-lvm*.so; do
- [ -e "$_i" ] && dracut_install "$_i"
- done
+ inst_libdir_file "libdevmapper-event-lvm*.so"
}
diff --git a/modules.d/90multipath/module-setup.sh b/modules.d/90multipath/module-setup.sh
index b78c005..8a193c4 100755
--- a/modules.d/90multipath/module-setup.sh
+++ b/modules.d/90multipath/module-setup.sh
@@ -62,11 +62,13 @@ install() {
/sbin/xdrgetprio \
/etc/xdrdevices.conf \
/etc/multipath.conf \
- /etc/multipath/* \
- "$libdir"/libmultipath* "$libdir"/multipath/*; do
+ /etc/multipath/*; do
[ -e "$_f" ] && inst "$_f"
done
+ inst_libdir_file "libmultipath*"
+ inst_libdir_file "multipath/*"
+
inst_hook pre-trigger 02 "$moddir/multipathd.sh"
inst_hook pre-pivot 02 "$moddir/multipathd-stop.sh"
inst_rules 40-multipath.rules
diff --git a/modules.d/95nfs/module-setup.sh b/modules.d/95nfs/module-setup.sh
index 7853783..455f52f 100755
--- a/modules.d/95nfs/module-setup.sh
+++ b/modules.d/95nfs/module-setup.sh
@@ -54,11 +54,7 @@ install() {
_nsslibs=${_nsslibs#|}
_nsslibs=${_nsslibs%|}
- for _i in {/usr,}$libdir/libnss*.so; do
- [[ -e $_i ]] || continue
- [[ "$_i" =~ $_nsslibs ]] || continue
- dracut_install "$_i"
- done
+ inst_libdir_file -n "$_nsslibs" "libnss*.so"
inst_hook cmdline 90 "$moddir/parse-nfsroot.sh"
inst_hook pre-udev 99 "$moddir/nfs-start-rpc.sh"
diff --git a/modules.d/95udev-rules/module-setup.sh b/modules.d/95udev-rules/module-setup.sh
index 5f8bae8..1c71336 100755
--- a/modules.d/95udev-rules/module-setup.sh
+++ b/modules.d/95udev-rules/module-setup.sh
@@ -74,8 +74,6 @@ install() {
[ -f /etc/arch-release ] && \
inst "$moddir/load-modules.sh" /lib/udev/load-modules.sh
- for _i in {"$libdir","$usrlibdir"}/libnss_files*; do
- [ -e "$_i" ] && dracut_install "$_i"
- done
+ inst_libdir_file "libnss_files*"
}
diff --git a/modules.d/98syslog/module-setup.sh b/modules.d/98syslog/module-setup.sh
index 5579c5a..bd6e92c 100755
--- a/modules.d/98syslog/module-setup.sh
+++ b/modules.d/98syslog/module-setup.sh
@@ -16,11 +16,9 @@ install() {
local _installs
if type -P rsyslogd >/dev/null; then
_installs="rsyslogd"
- for _i in {"$libdir","$usrlibdir"}/rsyslog/lmnet.so \
- {"$libdir","$usrlibdir"}/rsyslog/imklog.so \
- {"$libdir","$usrlibdir"}/rsyslog/imuxsock.so ; do
- [ -e "$_i" ] && _installs="$_installs $_i"
- done
+ inst_libdir_file rsyslog/lmnet.so
+ inst_libdir_file rsyslog/imklog.so
+ inst_libdir_file rsyslog/imuxsock.so
elif type -P syslogd >/dev/null; then
_installs="syslogd"
elif type -P syslog-ng >/dev/null; then

View File

@ -0,0 +1,26 @@
From 0a35a80b934a0a5a34e3c23244aca0caa440e5d4 Mon Sep 17 00:00:00 2001
From: Harald Hoyer <harald@redhat.com>
Date: Mon, 16 Apr 2012 13:10:22 +0200
Subject: [PATCH] dracut.sh: log installed modules to
$initdir/lib/dracut/modules.txt
---
dracut.sh | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/dracut.sh b/dracut.sh
index 7f61143..1048e75 100755
--- a/dracut.sh
+++ b/dracut.sh
@@ -720,6 +720,11 @@ for moddir in "$dracutbasedir/modules.d"/[0-9][0-9]*; do
fi
done
unset moddir
+
+for i in $modules_loaded; do
+ echo "$i" >> $initdir/lib/dracut/modules.txt
+done
+
dinfo "*** Including modules done ***"
## final stuff that has to happen

View File

@ -0,0 +1,53 @@
From b8a81fb885c981d795a664ae8665e68d7359231a Mon Sep 17 00:00:00 2001
From: Peter Rajnoha <prajnoha@redhat.com>
Date: Tue, 10 Apr 2012 04:40:53 -0400
Subject: [PATCH] lvm: disable lvmetad
Currently dracut uses lvm.conf as found in the system and modifies only
global/locking_type setting. As there's a new feature introduced - the lvmetad
daemon, dracut should disable its use as well by setting "global/use_lvmetad=0"
(patch attached).
Otherwise, there's a warning message issued:
dracut: WARNING: Failed to connect to lvmetad: No such file or directory.
Falling back to internal scanning.
@@ -, +, @@
modules.d/90lvm/lvm_scan.sh | 2 ++
modules.d/90lvm/module-setup.sh | 1 +
2 files changed, 3 insertions(+), 0 deletions(-)
---
modules.d/90lvm/lvm_scan.sh | 2 ++
modules.d/90lvm/module-setup.sh | 1 +
2 files changed, 3 insertions(+)
diff --git a/modules.d/90lvm/lvm_scan.sh b/modules.d/90lvm/lvm_scan.sh
index 104565f..17c29bc 100755
--- a/modules.d/90lvm/lvm_scan.sh
+++ b/modules.d/90lvm/lvm_scan.sh
@@ -35,10 +35,12 @@ if [ ! -e /etc/lvm/lvm.conf ]; then
if [ -n $SNAPSHOT ]; then
echo 'global {';
echo ' locking_type = 1';
+ echo ' use_lvmetad = 0';
echo '}';
else
echo 'global {';
echo ' locking_type = 4';
+ echo ' use_lvmetad = 0';
echo '}';
fi
} > /etc/lvm/lvm.conf
diff --git a/modules.d/90lvm/module-setup.sh b/modules.d/90lvm/module-setup.sh
index 15c824d..2ce5c50 100755
--- a/modules.d/90lvm/module-setup.sh
+++ b/modules.d/90lvm/module-setup.sh
@@ -49,6 +49,7 @@ install() {
# FIXME: near-term hack to establish read-only locking;
# use command-line lvm.conf editor once it is available
sed -i -e 's/\(^[[:space:]]*\)locking_type[[:space:]]*=[[:space:]]*[[:digit:]]/\1locking_type = 4/' ${initdir}/etc/lvm/lvm.conf
+ sed -i -e 's/\(^[[:space:]]*\)use_lvmetad[[:space:]]*=[[:space:]]*[[:digit:]]/\1use_lvmetad = 0/' ${initdir}/etc/lvm/lvm.conf
fi
fi

View File

@ -0,0 +1,169 @@
From 4c32a717692fa5a74d10d9710dd5d358890f0d4e Mon Sep 17 00:00:00 2001
From: Lennert Buytenhek <buytenh@wantstofly.org>
Date: Sun, 15 Apr 2012 02:40:17 +0200
Subject: [PATCH] virtfs root filesystem support
Qemu/KVM provides virtfs, a paravirtualised filesystem that is
implemented by running the Plan 9 folder sharing protocol over
virtio.
Make booting with root=virtfs:foobar use the virtfs filesystem
with mount tag 'foobar' as root filesystem, to allow booting
virtual machines off virtfs.
Note that this only handles 9p over virtio (i.e. virtfs), and
doesn't attempt to handle mounting 9p filesystems over TCP/IP,
for example.
Signed-off-by: Lennert Buytenhek <buytenh@wantstofly.org>
---
dracut.spec | 1 +
modules.d/95virtfs/module-setup.sh | 27 +++++++++++++
modules.d/95virtfs/mount-virtfs.sh | 75 ++++++++++++++++++++++++++++++++++++
modules.d/95virtfs/parse-virtfs.sh | 9 +++++
4 files changed, 112 insertions(+)
create mode 100755 modules.d/95virtfs/module-setup.sh
create mode 100755 modules.d/95virtfs/mount-virtfs.sh
create mode 100755 modules.d/95virtfs/parse-virtfs.sh
diff --git a/dracut.spec b/dracut.spec
index 074cb10..9cd08b7 100644
--- a/dracut.spec
+++ b/dracut.spec
@@ -270,6 +270,7 @@ rm -rf $RPM_BUILD_ROOT
%{dracutlibdir}/modules.d/95zfcp
%{dracutlibdir}/modules.d/95terminfo
%{dracutlibdir}/modules.d/95udev-rules
+%{dracutlibdir}/modules.d/95virtfs
%{dracutlibdir}/modules.d/96securityfs
%{dracutlibdir}/modules.d/97biosdevname
%{dracutlibdir}/modules.d/97masterkey
diff --git a/modules.d/95virtfs/module-setup.sh b/modules.d/95virtfs/module-setup.sh
new file mode 100755
index 0000000..a6081c2
--- /dev/null
+++ b/modules.d/95virtfs/module-setup.sh
@@ -0,0 +1,27 @@
+#!/bin/bash
+# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
+# ex: ts=8 sw=4 sts=4 et filetype=sh
+
+check() {
+ [[ $hostonly ]] || [[ $mount_needs ]] && {
+ for fs in ${host_fs_types[@]}; do
+ strstr "$fs" "\|9p" && return 0
+ done
+ return 1
+ }
+
+ return 0
+}
+
+depends() {
+ return 0
+}
+
+installkernel() {
+ instmods 9p 9pnet_virtio
+}
+
+install() {
+ inst_hook cmdline 95 "$moddir/parse-virtfs.sh"
+ inst_hook mount 99 "$moddir/mount-virtfs.sh"
+}
diff --git a/modules.d/95virtfs/mount-virtfs.sh b/modules.d/95virtfs/mount-virtfs.sh
new file mode 100755
index 0000000..dfebf38
--- /dev/null
+++ b/modules.d/95virtfs/mount-virtfs.sh
@@ -0,0 +1,75 @@
+#!/bin/sh
+# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
+# ex: ts=8 sw=4 sts=4 et filetype=sh
+
+type getarg >/dev/null 2>&1 || . /lib/dracut-lib.sh
+
+filter_rootopts() {
+ rootopts=$1
+ # strip ro and rw options
+ local OLDIFS="$IFS"
+ IFS=,
+ set -- $rootopts
+ IFS="$OLDIFS"
+ local v
+ while [ $# -gt 0 ]; do
+ case $1 in
+ rw|ro);;
+ defaults);;
+ *)
+ v="$v,${1}";;
+ esac
+ shift
+ done
+ rootopts=${v#,}
+ echo $rootopts
+}
+
+mount_root() {
+ local _ret
+
+ rootfs="9p"
+ rflags="trans=virtio,version=9p2000.L"
+
+ modprobe 9pnet_virtio
+
+ mount -t ${rootfs} -o "$rflags",ro "${root#virtfs:}" "$NEWROOT"
+
+ rootopts=
+ if getargbool 1 rd.fstab -n rd_NO_FSTAB \
+ && ! getarg rootflags \
+ && [ -f "$NEWROOT/etc/fstab" ] \
+ && ! [ -L "$NEWROOT/etc/fstab" ]; then
+ # if $NEWROOT/etc/fstab contains special mount options for
+ # the root filesystem,
+ # remount it with the proper options
+ rootopts="defaults"
+ while read dev mp fs opts rest; do
+ # skip comments
+ [ "${dev%%#*}" != "$dev" ] && continue
+
+ if [ "$mp" = "/" ]; then
+ rootopts=$opts
+ break
+ fi
+ done < "$NEWROOT/etc/fstab"
+
+ rootopts=$(filter_rootopts $rootopts)
+ fi
+
+ # we want rootflags (rflags) to take precedence so prepend rootopts to
+ # them; rflags is guaranteed to not be empty
+ rflags="${rootopts:+"${rootopts},"}${rflags}"
+
+ umount "$NEWROOT"
+
+ info "Remounting ${root#virtfs:} with -o ${rflags}"
+ mount -t ${rootfs} -o "$rflags" "${root#virtfs:}" "$NEWROOT" 2>&1 | vinfo
+
+ [ -f "$NEWROOT"/forcefsck ] && rm -f "$NEWROOT"/forcefsck 2>/dev/null
+ [ -f "$NEWROOT"/.autofsck ] && rm -f "$NEWROOT"/.autofsck 2>/dev/null
+}
+
+if [ -n "$root" -a -z "${root%%virtfs:*}" ]; then
+ mount_root
+fi
diff --git a/modules.d/95virtfs/parse-virtfs.sh b/modules.d/95virtfs/parse-virtfs.sh
new file mode 100755
index 0000000..ce6de6d
--- /dev/null
+++ b/modules.d/95virtfs/parse-virtfs.sh
@@ -0,0 +1,9 @@
+#!/bin/sh
+# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
+# ex: ts=8 sw=4 sts=4 et filetype=sh
+
+if [ "${root%%:*}" = "virtfs" ] ; then
+ modprobe 9pnet_virtio
+
+ rootok=1
+fi

View File

@ -0,0 +1,32 @@
From 5d73033e540846a42e26449f72191c11989d4721 Mon Sep 17 00:00:00 2001
From: Harald Hoyer <harald@redhat.com>
Date: Mon, 16 Apr 2012 14:50:35 +0200
Subject: [PATCH] udev-rules: remove 01-ignore.rules
---
modules.d/95udev-rules/01-ignore.rules | 1 -
modules.d/95udev-rules/module-setup.sh | 3 ---
2 files changed, 4 deletions(-)
delete mode 100644 modules.d/95udev-rules/01-ignore.rules
diff --git a/modules.d/95udev-rules/01-ignore.rules b/modules.d/95udev-rules/01-ignore.rules
deleted file mode 100644
index b32f22e..0000000
--- a/modules.d/95udev-rules/01-ignore.rules
+++ /dev/null
@@ -1 +0,0 @@
-KERNEL=="ram[0-9]*", OPTIONS+="ignore_device", OPTIONS+="last_rule"
diff --git a/modules.d/95udev-rules/module-setup.sh b/modules.d/95udev-rules/module-setup.sh
index 1c71336..b17232f 100755
--- a/modules.d/95udev-rules/module-setup.sh
+++ b/modules.d/95udev-rules/module-setup.sh
@@ -20,9 +20,6 @@ install() {
#Some debian udev rules are named differently
inst_rules 50-udev.rules 95-late.rules
- # ignore some devices in the initrd
- inst_rules "$moddir/01-ignore.rules"
-
# for firmware loading
inst_rules 50-firmware.rules
dracut_install cat uname

View File

@ -10,7 +10,7 @@
Name: dracut
Version: 018
Release: 1%{?dist}
Release: 12.git20120416%{?dist}
Summary: Initramfs generator using udev
%if 0%{?fedora} || 0%{?rhel}
@ -24,6 +24,17 @@ URL: https://dracut.wiki.kernel.org/
# Source can be generated by
# http://git.kernel.org/?p=boot/dracut/dracut.git;a=snapshot;h=%{version};sf=tgz
Source0: http://www.kernel.org/pub/linux/utils/boot/dracut/dracut-%{version}.tar.bz2
Patch1: 0001-dracut-lib-add-str_ends-to-go-along-with-str_starts.patch
Patch2: 0002-run-setup_net-at-start-of-initqueue-online-hook.patch
Patch3: 0003-network-add-save_netinfo-fix-problems-with-nfs-NM-ta.patch
Patch4: 0004-Make-splitsep-work-as-documented-with-less-vars-than.patch
Patch5: 0005-shutdown-use-emergency_shell-from-dracut-lib.patch
Patch6: 0006-rootfs-block-avoid-remount-when-options-don-t-change.patch
Patch7: 0007-Debian-multiarch-support.patch
Patch8: 0008-dracut.sh-log-installed-modules-to-initdir-lib-dracu.patch
Patch9: 0009-lvm-disable-lvmetad.patch
Patch10: 0010-virtfs-root-filesystem-support.patch
Patch11: 0011-udev-rules-remove-01-ignore.rules.patch
BuildArch: noarch
@ -271,6 +282,7 @@ rm -rf $RPM_BUILD_ROOT
%{dracutlibdir}/modules.d/95zfcp
%{dracutlibdir}/modules.d/95terminfo
%{dracutlibdir}/modules.d/95udev-rules
%{dracutlibdir}/modules.d/95virtfs
%{dracutlibdir}/modules.d/96securityfs
%{dracutlibdir}/modules.d/97biosdevname
%{dracutlibdir}/modules.d/97masterkey
@ -329,6 +341,9 @@ rm -rf $RPM_BUILD_ROOT
%dir /var/lib/dracut/overlay
%changelog
* Mon Apr 16 2012 Harald Hoyer <harald@redhat.com> 018-12.git20120416
- new upstream version, which fixes various anaconda loader issues
* Thu Apr 05 2012 Harald Hoyer <harald@redhat.com> 018-1
- version 018