update to latest git

This commit is contained in:
Harald Hoyer 2011-10-19 15:30:00 +02:00
parent 992688db14
commit 55891eb212
83 changed files with 4658 additions and 18 deletions

View File

@ -0,0 +1,75 @@
From e7b8fe03e8b76ec4aa4797759cd849fcf792b33c Mon Sep 17 00:00:00 2001
From: Harald Hoyer <harald@redhat.com>
Date: Wed, 17 Aug 2011 10:08:23 +0200
Subject: [PATCH] profile.py: parse the output of "dracut --profile" for
profiling
---
profile.py | 58 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 58 insertions(+), 0 deletions(-)
create mode 100644 profile.py
diff --git a/profile.py b/profile.py
new file mode 100644
index 0000000..e1d0cab
--- /dev/null
+++ b/profile.py
@@ -0,0 +1,58 @@
+#
+# parse the output of "dracut --profile" and produce profiling information
+#
+# Copyright 2011 Harald Hoyer <harald@redhat.com>
+# Copyright 2011 Red Hat, Inc. All rights reserved.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+#
+
+import sys
+import operator
+import re
+loglines = sys.stdin
+
+logpats = r'[+]+[ \t]+([^ \t]+)[ \t]+([^ \t:]+):[ ]+.*'
+
+logpat = re.compile(logpats)
+
+groups = (logpat.match(line) for line in loglines)
+tuples = (g.groups() for g in groups if g)
+
+def gen_times(t):
+ oldx=None
+ for x in t:
+ fx=float(x[0])
+ if oldx:
+ #print fx - float(oldx[0]), x[0], x[1], oldx[0], oldx[1]
+ yield (fx - float(oldx[0]), oldx[1])
+
+ oldx = x
+
+colnames = ('time','line')
+
+log = (dict(zip(colnames,t)) for t in gen_times(tuples))
+
+if __name__ == '__main__':
+ e={}
+ for x in log:
+ if not x['line'] in e:
+ e[x['line']] = x['time']
+ else:
+ e[x['line']] += x['time']
+
+ sorted_x = sorted(e.iteritems(), key=operator.itemgetter(1), reverse=True)
+ for x in sorted_x:
+ print x[0], x[1]
+

View File

@ -0,0 +1,391 @@
From ea8e543bb86660dd6ccc3048ae9916358b58a6b3 Mon Sep 17 00:00:00 2001
From: Harald Hoyer <harald@redhat.com>
Date: Wed, 17 Aug 2011 13:42:16 +0200
Subject: [PATCH] add TEST-16-DMSQUASH
This is a test for Fedora LiveCDs created via livecd-tools
---
test/TEST-16-DMSQUASH/99-idesymlinks.rules | 8 +
test/TEST-16-DMSQUASH/Makefile | 10 ++
test/TEST-16-DMSQUASH/create.py | 186 ++++++++++++++++++++++++
test/TEST-16-DMSQUASH/cryptroot-ask | 6 +
test/TEST-16-DMSQUASH/hard-off.sh | 3 +
test/TEST-16-DMSQUASH/livecd-fedora-minimal.ks | 22 +++
test/TEST-16-DMSQUASH/test-init | 17 ++
test/TEST-16-DMSQUASH/test.sh | 66 +++++++++
8 files changed, 318 insertions(+), 0 deletions(-)
create mode 100644 test/TEST-16-DMSQUASH/99-idesymlinks.rules
create mode 100644 test/TEST-16-DMSQUASH/Makefile
create mode 100644 test/TEST-16-DMSQUASH/create.py
create mode 100755 test/TEST-16-DMSQUASH/cryptroot-ask
create mode 100755 test/TEST-16-DMSQUASH/hard-off.sh
create mode 100644 test/TEST-16-DMSQUASH/livecd-fedora-minimal.ks
create mode 100755 test/TEST-16-DMSQUASH/test-init
create mode 100755 test/TEST-16-DMSQUASH/test.sh
diff --git a/test/TEST-16-DMSQUASH/99-idesymlinks.rules b/test/TEST-16-DMSQUASH/99-idesymlinks.rules
new file mode 100644
index 0000000..d557790
--- /dev/null
+++ b/test/TEST-16-DMSQUASH/99-idesymlinks.rules
@@ -0,0 +1,8 @@
+ACTION=="add|change", SUBSYSTEM=="block", ENV{DEVTYPE}=="disk", KERNEL=="hda", SYMLINK+="sda"
+ACTION=="add|change", SUBSYSTEM=="block", ENV{DEVTYPE}=="partition", KERNEL=="hda*", SYMLINK+="sda$env{MINOR}"
+ACTION=="add|change", SUBSYSTEM=="block", ENV{DEVTYPE}=="disk", KERNEL=="hdb", SYMLINK+="sdb"
+ACTION=="add|change", SUBSYSTEM=="block", ENV{DEVTYPE}=="partition", KERNEL=="hdb*", SYMLINK+="sdb$env{MINOR}"
+ACTION=="add|change", SUBSYSTEM=="block", ENV{DEVTYPE}=="disk", KERNEL=="hdc", SYMLINK+="sdc"
+ACTION=="add|change", SUBSYSTEM=="block", ENV{DEVTYPE}=="partition", KERNEL=="hdc*", SYMLINK+="sdc$env{MINOR}"
+ACTION=="add|change", SUBSYSTEM=="block", ENV{DEVTYPE}=="disk", KERNEL=="hdd", SYMLINK+="sdd"
+ACTION=="add|change", SUBSYSTEM=="block", ENV{DEVTYPE}=="partition", KERNEL=="hdd*", SYMLINK+="sdd$env{MINOR}"
diff --git a/test/TEST-16-DMSQUASH/Makefile b/test/TEST-16-DMSQUASH/Makefile
new file mode 100644
index 0000000..bc0ddb6
--- /dev/null
+++ b/test/TEST-16-DMSQUASH/Makefile
@@ -0,0 +1,10 @@
+all:
+ @make -s --no-print-directory -C ../.. all
+ @basedir=../.. testdir=../ ./test.sh --all
+setup:
+ @make --no-print-directory -C ../.. all
+ @basedir=../.. testdir=../ ./test.sh --setup
+clean:
+ @basedir=../.. testdir=../ ./test.sh --clean
+run:
+ @basedir=../.. testdir=../ ./test.sh --run
diff --git a/test/TEST-16-DMSQUASH/create.py b/test/TEST-16-DMSQUASH/create.py
new file mode 100644
index 0000000..15d29ff
--- /dev/null
+++ b/test/TEST-16-DMSQUASH/create.py
@@ -0,0 +1,186 @@
+#!/usr/bin/python -tt
+#
+# livecd-creator : Creates Live CD based for Fedora.
+#
+# Copyright 2007, Red Hat Inc.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; version 2 of the License.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Library General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+import os
+import os.path
+import sys
+import time
+import optparse
+import logging
+import shutil
+from distutils.dir_util import copy_tree
+
+import imgcreate
+from imgcreate.fs import makedirs
+
+class myLiveImageCreator(imgcreate.x86LiveImageCreator):
+ def install(self, repo_urls = {}):
+ copy_tree("root-source", self._instroot)
+
+ def configure(self):
+ self._create_bootconfig()
+
+ def _get_kernel_versions(self):
+ ret = {}
+ version=os.uname()
+ version=version[2]
+ ret["kernel-" + version] = [version]
+ return ret
+
+ def __sanity_check(self):
+ pass
+
+class Usage(Exception):
+ def __init__(self, msg = None, no_error = False):
+ Exception.__init__(self, msg, no_error)
+
+def parse_options(args):
+ parser = optparse.OptionParser()
+
+ imgopt = optparse.OptionGroup(parser, "Image options",
+ "These options define the created image.")
+ imgopt.add_option("-c", "--config", type="string", dest="kscfg",
+ help="Path or url to kickstart config file")
+ imgopt.add_option("-b", "--base-on", type="string", dest="base_on",
+ help="Add packages to an existing live CD iso9660 image.")
+ imgopt.add_option("-f", "--fslabel", type="string", dest="fslabel",
+ help="File system label (default based on config name)")
+ # Provided for img-create compatibility
+ imgopt.add_option("-n", "--name", type="string", dest="fslabel",
+ help=optparse.SUPPRESS_HELP)
+ imgopt.add_option("", "--image-type", type="string", dest="image_type",
+ help=optparse.SUPPRESS_HELP)
+ imgopt.add_option("", "--compression-type", type="string", dest="compress_type",
+ help="Compression type recognized by mksquashfs "
+ "(default xz needs a 2.6.38+ kernel, gzip works "
+ "with all kernels, lzo needs a 2.6.36+ kernel, lzma "
+ "needs custom kernel.) Set to 'None' to force read "
+ "from base_on.",
+ default="xz")
+ imgopt.add_option("", "--releasever", type="string", dest="releasever",
+ default=None,
+ help="Value to substitute for $releasever in kickstart repo urls")
+ parser.add_option_group(imgopt)
+
+ # options related to the config of your system
+ sysopt = optparse.OptionGroup(parser, "System directory options",
+ "These options define directories used on your system for creating the live image")
+ sysopt.add_option("-t", "--tmpdir", type="string",
+ dest="tmpdir", default="/var/tmp",
+ help="Temporary directory to use (default: /var/tmp)")
+ sysopt.add_option("", "--cache", type="string",
+ dest="cachedir", default=None,
+ help="Cache directory to use (default: private cache")
+ parser.add_option_group(sysopt)
+
+ imgcreate.setup_logging(parser)
+
+ # debug options not recommended for "production" images
+ # Start a shell in the chroot for post-configuration.
+ parser.add_option("-l", "--shell", action="store_true", dest="give_shell",
+ help=optparse.SUPPRESS_HELP)
+ # Don't compress the image.
+ parser.add_option("-s", "--skip-compression", action="store_true", dest="skip_compression",
+ help=optparse.SUPPRESS_HELP)
+ parser.add_option("", "--skip-minimize", action="store_true", dest="skip_minimize",
+ help=optparse.SUPPRESS_HELP)
+
+ (options, args) = parser.parse_args()
+
+ # Pretend to be a image-creator if called with that name
+ options.image_type = 'livecd'
+ if options.image_type not in ('livecd', 'image'):
+ raise Usage("'%s' is a recognized image type" % options.image_type)
+
+ # image-create compatibility: Last argument is kickstart file
+ if len(args) == 1:
+ options.kscfg = args.pop()
+ if len(args):
+ raise Usage("Extra arguments given")
+
+ if options.base_on and not os.path.isfile(options.base_on):
+ raise Usage("Image file '%s' does not exist" %(options.base_on,))
+ if options.image_type == 'livecd':
+ if options.fslabel and len(options.fslabel) > imgcreate.FSLABEL_MAXLEN:
+ raise Usage("CD labels are limited to 32 characters")
+ if options.fslabel and options.fslabel.find(" ") != -1:
+ raise Usage("CD labels cannot contain spaces.")
+
+ return options
+
+def main():
+ try:
+ options = parse_options(sys.argv[1:])
+ except Usage, (msg, no_error):
+ if no_error:
+ out = sys.stdout
+ ret = 0
+ else:
+ out = sys.stderr
+ ret = 2
+ if msg:
+ print >> out, msg
+ return ret
+
+ if os.geteuid () != 0:
+ print >> sys.stderr, "You must run %s as root" % sys.argv[0]
+ return 1
+
+ if options.fslabel:
+ fslabel = options.fslabel
+ name = fslabel
+ else:
+ name = "livecd"
+
+ fslabel = "LiveCD"
+ logging.info("Using label '%s' and name '%s'" % (fslabel, name))
+
+ ks = imgcreate.read_kickstart(options.kscfg)
+
+ creator = myLiveImageCreator(ks, name,
+ fslabel=fslabel,
+ releasever=options.releasever,
+ tmpdir=os.path.abspath(options.tmpdir))
+
+ creator.compress_type = options.compress_type
+ creator.skip_compression = options.skip_compression
+ creator.skip_minimize = options.skip_minimize
+ if options.cachedir:
+ options.cachedir = os.path.abspath(options.cachedir)
+
+ try:
+ creator.mount(options.base_on, options.cachedir)
+ creator.install()
+ creator.configure()
+ if options.give_shell:
+ print "Launching shell. Exit to continue."
+ print "----------------------------------"
+ creator.launch_shell()
+ creator.unmount()
+ creator.package()
+ except imgcreate.CreatorError, e:
+ logging.error(u"Error creating Live CD : %s" % e)
+ return 1
+ finally:
+ creator.cleanup()
+
+ return 0
+
+if __name__ == "__main__":
+ sys.exit(main())
diff --git a/test/TEST-16-DMSQUASH/cryptroot-ask b/test/TEST-16-DMSQUASH/cryptroot-ask
new file mode 100755
index 0000000..db27c5b
--- /dev/null
+++ b/test/TEST-16-DMSQUASH/cryptroot-ask
@@ -0,0 +1,6 @@
+#!/bin/sh
+
+[ -b /dev/mapper/$2 ] && exit 0
+echo -n test >/keyfile
+/sbin/cryptsetup luksOpen $1 $2 </keyfile
+
diff --git a/test/TEST-16-DMSQUASH/hard-off.sh b/test/TEST-16-DMSQUASH/hard-off.sh
new file mode 100755
index 0000000..12c3d5a
--- /dev/null
+++ b/test/TEST-16-DMSQUASH/hard-off.sh
@@ -0,0 +1,3 @@
+#!/bin/sh
+getarg rd.shell || poweroff -f
+getarg failme && poweroff -f
diff --git a/test/TEST-16-DMSQUASH/livecd-fedora-minimal.ks b/test/TEST-16-DMSQUASH/livecd-fedora-minimal.ks
new file mode 100644
index 0000000..88637ae
--- /dev/null
+++ b/test/TEST-16-DMSQUASH/livecd-fedora-minimal.ks
@@ -0,0 +1,22 @@
+lang en_US.UTF-8
+keyboard us
+timezone US/Eastern
+auth --useshadow --enablemd5
+selinux --enforcing
+firewall --disabled
+part / --size 1024
+
+repo --name=fedora --mirrorlist=http://mirrors.fedoraproject.org/mirrorlist?repo=fedora-16&arch=$basearch
+
+%packages
+@core
+anaconda-runtime
+bash
+kernel
+passwd
+policycoreutils
+chkconfig
+authconfig
+rootfiles
+
+%end
diff --git a/test/TEST-16-DMSQUASH/test-init b/test/TEST-16-DMSQUASH/test-init
new file mode 100755
index 0000000..616bf68
--- /dev/null
+++ b/test/TEST-16-DMSQUASH/test-init
@@ -0,0 +1,17 @@
+#!/bin/sh
+export PATH=/sbin:/bin:/usr/sbin:/usr/bin
+strstr() { [ "${1#*$2*}" != "$1" ]; }
+CMDLINE=$(while read line; do echo $line;done < /proc/cmdline)
+plymouth --quit
+exec >/dev/console 2>&1
+echo "dracut-root-block-success" >/dev/sda
+export TERM=linux
+export PS1='initramfs-test:\w\$ '
+[ -f /etc/mtab ] || ln -sfn /proc/mounts /etc/mtab
+[ -f /etc/fstab ] || ln -sfn /proc/mounts /etc/fstab
+stty sane
+echo "made it to the rootfs!"
+strstr "$CMDLINE" "rd.shell" && sh -i
+echo "Powering down."
+mount -n -o remount,ro /
+poweroff -f
diff --git a/test/TEST-16-DMSQUASH/test.sh b/test/TEST-16-DMSQUASH/test.sh
new file mode 100755
index 0000000..5d8075c
--- /dev/null
+++ b/test/TEST-16-DMSQUASH/test.sh
@@ -0,0 +1,66 @@
+#!/bin/bash
+TEST_DESCRIPTION="root filesystem on a LiveCD dmsquash filesystem"
+
+KVERSION=${KVERSION-$(uname -r)}
+
+# Uncomment this to debug failures
+#DEBUGFAIL="rd.shell rd.break"
+
+test_run() {
+ $testdir/run-qemu -boot order=d -cdrom livecd.iso -hda root.img -m 256M -nographic \
+ -net none -kernel /boot/vmlinuz-$KVERSION \
+ -append "root=live:CDLABEL=LiveCD live rw quiet rd.retry=3 rd.info console=ttyS0,115200n81 selinux=0 rd.debug $DEBUGFAIL" \
+ -initrd initramfs.testing
+ grep -m 1 -q dracut-root-block-success root.img || return 1
+}
+
+test_setup() {
+ mkdir -p overlay
+ (
+ initdir=overlay
+ . $basedir/dracut-functions
+ dracut_install poweroff shutdown
+ inst_hook emergency 000 ./hard-off.sh
+ inst_simple ./99-idesymlinks.rules /etc/udev/rules.d/99-idesymlinks.rules
+ )
+
+ dd if=/dev/null of=root.img seek=100
+
+ sudo $basedir/dracut -l -i overlay / \
+ -a "debug" \
+ -d "piix ide-gd_mod ata_piix ext3 sd_mod" \
+ -f initramfs.testing $KVERSION || return 1
+
+ mkdir -p root-source
+ kernel=$KVERSION
+ # Create what will eventually be our root filesystem onto an overlay
+ (
+ initdir=root-source
+ . $basedir/dracut-functions
+ dracut_install sh df free ls shutdown poweroff stty cat ps ln ip route \
+ /lib/terminfo/l/linux mount dmesg ifconfig dhclient mkdir cp ping dhclient \
+ umount strace less
+ inst "$basedir/modules.d/40network/dhclient-script" "/sbin/dhclient-script"
+ inst "$basedir/modules.d/40network/ifup" "/sbin/ifup"
+ dracut_install grep syslinux isohybrid
+ for f in /usr/share/syslinux/*; do
+ inst_simple "$f"
+ done
+ inst ./test-init /sbin/init
+ inst ./initramfs.testing "/boot/initramfs-$KVERSION.img"
+ inst /boot/vmlinuz-$KVERSION
+ find_binary plymouth >/dev/null && dracut_install plymouth
+ (cd "$initdir"; mkdir -p dev sys proc etc var/run tmp )
+ cp -a /etc/ld.so.conf* $initdir/etc
+ sudo ldconfig -r "$initdir"
+ )
+ python create.py -d -c livecd-fedora-minimal.ks
+ exit 0
+}
+
+test_cleanup() {
+ rm -fr overlay root-source
+ rm -f root.img initramfs.makeroot initramfs.testing livecd.iso
+}
+
+. $testdir/test-functions

View File

@ -0,0 +1,22 @@
From d670e21998f8b13c6b266e29bcc80db55d19f8c8 Mon Sep 17 00:00:00 2001
From: Harald Hoyer <harald@redhat.com>
Date: Wed, 17 Aug 2011 17:40:59 +0200
Subject: [PATCH] dracut-functions: s/emergency-shutdown/shutdown-emergency/g
---
dracut-functions | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/dracut-functions b/dracut-functions
index 936d3c3..241d89a 100755
--- a/dracut-functions
+++ b/dracut-functions
@@ -518,7 +518,7 @@ inst() {
[[ $hookdirs ]] || {
hookdirs="cmdline pre-udev pre-trigger netroot initqueue pre-mount"
- hookdirs+=" pre-pivot mount emergency emergency-shutdown shutdown"
+ hookdirs+=" pre-pivot mount emergency shutdown-emergency shutdown"
export hookdirs
}

View File

@ -0,0 +1,23 @@
From d619fb5e1c07f15eb6b9156a389fad85e2924e57 Mon Sep 17 00:00:00 2001
From: Harald Hoyer <harald@redhat.com>
Date: Fri, 19 Aug 2011 08:08:18 +0200
Subject: [PATCH] dracut: unset LD_LIBRARY_PATH
LD_LIBRARY_PATH is not set in the initramfs, so it should not be set
while finding our libraries.
---
dracut | 1 +
1 files changed, 1 insertions(+), 0 deletions(-)
diff --git a/dracut b/dracut
index cf27b23..dfa71a1 100755
--- a/dracut
+++ b/dracut
@@ -265,6 +265,7 @@ fi
PATH=/sbin:/bin:/usr/sbin:/usr/bin
export PATH
+unset LD_LIBRARY_PATH
[[ $debug ]] && {
export PS4='${BASH_SOURCE}@${LINENO}(${FUNCNAME[0]}): ';

View File

@ -0,0 +1,25 @@
From bc313467bdb49605aaddfec67823cab72396c29b Mon Sep 17 00:00:00 2001
From: John Reiser <jreiser@bitwagon.com>
Date: Thu, 18 Aug 2011 20:55:35 -0700
Subject: [PATCH] build initramfs: prelink --undo /sbin/*
Fix a typo (omitting the 's' in "sbin") which caused
"prelink --undo" twice on /bin/*, and
"prelink --undo" omitted for /sbin/*.
---
dracut | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/dracut b/dracut
index dfa71a1..fd36805 100755
--- a/dracut
+++ b/dracut
@@ -643,7 +643,7 @@ type hardlink &>/dev/null && {
if strstr "$modules_loaded" " fips " && command -v prelink >/dev/null; then
for i in $initdir/bin/* \
- $initdir/bin/* \
+ $initdir/sbin/* \
$initdir/usr/bin/* \
$initdir/usr/sbin/*; do
[ -x $i ] && prelink -u $i &>/dev/null

View File

@ -0,0 +1,41 @@
From a76dc2780143a4b04eb33a6699ec2ca7a7898b65 Mon Sep 17 00:00:00 2001
From: Harald Hoyer <harald@redhat.com>
Date: Fri, 19 Aug 2011 10:24:49 +0200
Subject: [PATCH] dracut-functions: speed up inst_dir()
---
dracut-functions | 18 +++++++++---------
1 files changed, 9 insertions(+), 9 deletions(-)
diff --git a/dracut-functions b/dracut-functions
index 241d89a..d7f2e5f 100755
--- a/dracut-functions
+++ b/dracut-functions
@@ -274,18 +274,18 @@ inst_dir() {
local _oldifs="$IFS"
local _part
local _dir="$1"
- IFS="/"
- set -- $_dir
- IFS=$_oldifs
- _dir="$@"
+
+ # fast out
[[ -e ${initdir}$_dir ]] && return 0
- # iterate over parent directories
- for _part in $_dir; do
- [[ $_part ]] || continue
- _file="$_file/$_part"
- [[ -e ${initdir}$_file ]] && continue
+ _part=${_dir%/*}
+ while ! [[ -e "${initdir}${_part}" ]]; do
+ _dir="$_part $_dir"
+ _part=${_part%/*}
+ done
+ # iterate over parent directories
+ for _file in $_dir; do
if [[ -L $_file ]]; then
# create link as the original
local target=$(readlink -f "$_file")

View File

@ -0,0 +1,24 @@
From 581dd40e73fb93002202e15186a9e65e0b449eb2 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Amadeusz=20=C5=BBo=C5=82nowski?= <aidecoe@aidecoe.name>
Date: Thu, 18 Aug 2011 15:55:57 +0200
Subject: [PATCH] 90crypt: ask_for_password pings plymouthd
If plymouthd is not started, ask_for_password shouldn't try to prompt
for password with GUI and should use text prompt instead.
---
modules.d/90crypt/crypt-lib.sh | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/modules.d/90crypt/crypt-lib.sh b/modules.d/90crypt/crypt-lib.sh
index 2797a7a..69f14d0 100755
--- a/modules.d/90crypt/crypt-lib.sh
+++ b/modules.d/90crypt/crypt-lib.sh
@@ -47,7 +47,7 @@ ask_for_password() {
{ flock -s 9;
# Prompt for password with plymouth, if installed and running.
- if [ -x /bin/plymouth ]; then
+ if [ -x /bin/plymouth ] && /bin/plymouth --ping; then
/bin/plymouth ask-for-password \
--prompt "$ply_prompt" --number-of-tries=$ply_tries \
--command="$ply_cmd"

View File

@ -0,0 +1,24 @@
From 641d84a4ec742feb7f2851bdebe6f376e15a68b6 Mon Sep 17 00:00:00 2001
From: Leho Kraav <leho@kraav.com>
Date: Mon, 22 Aug 2011 11:54:47 +0300
Subject: [PATCH] 99base: whitespace fix
---
modules.d/99base/initqueue | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/modules.d/99base/initqueue b/modules.d/99base/initqueue
index 21b1c61..2c06a0b 100755
--- a/modules.d/99base/initqueue
+++ b/modules.d/99base/initqueue
@@ -19,8 +19,8 @@ while [ $# -gt 0 ]; do
qname="/settled";;
--finished)
qname="/finished";;
- --timeout)
- qname="/timeout";;
+ --timeout)
+ qname="/timeout";;
--unique)
unique="yes";;
--name)

View File

@ -0,0 +1,49 @@
From 3378a54f15016c86e4c8c2ecafcaa45f0119fc00 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Amadeusz=20=C5=BBo=C5=82nowski?= <aidecoe@aidecoe.name>
Date: Sun, 21 Aug 2011 12:47:13 +0200
Subject: [PATCH] dracut-functions: new function: inst_any [-d dest] f1 [f2
[f3 ...]]
---
dracut-functions | 28 ++++++++++++++++++++++++++++
1 files changed, 28 insertions(+), 0 deletions(-)
diff --git a/dracut-functions b/dracut-functions
index d7f2e5f..43a6843 100755
--- a/dracut-functions
+++ b/dracut-functions
@@ -537,6 +537,34 @@ inst_hook() {
inst_simple "$3" "/lib/dracut/hooks/${1}/${2}${3##*/}"
}
+# install any of listed files
+#
+# If first argument is '-d' and second some destination path, first accessible
+# source is installed into this path, otherwise it will installed in the same
+# path as source. If none of listed files was installed, function return 1.
+# On first successful installation it returns with 0 status.
+#
+# Example:
+#
+# inst_any -d /bin/foo /bin/bar /bin/baz
+#
+# Lets assume that /bin/baz exists, so it will be installed as /bin/foo in
+# initramfs.
+inst_any() {
+ local to f
+
+ [[ $1 = '-d' ]] && to="$2" && shift 2
+
+ for f in "$@"; do
+ if [[ -e $f ]]; then
+ [[ $to ]] && inst "$f" "$to" && return 0
+ inst "$f" && return 0
+ fi
+ done
+
+ return 1
+}
+
dracut_install() {
local _optional=no
if [[ $1 = '-o' ]]; then

View File

@ -0,0 +1,25 @@
From 07aeaae356cf001ebe527a5e106e04b5df6aca4c Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Amadeusz=20=C5=BBo=C5=82nowski?= <aidecoe@aidecoe.name>
Date: Sun, 21 Aug 2011 12:47:14 +0200
Subject: [PATCH] livenet: take into account other ca-bundle paths; use
inst_any for that
---
modules.d/90livenet/module-setup.sh | 4 +++-
1 files changed, 3 insertions(+), 1 deletions(-)
diff --git a/modules.d/90livenet/module-setup.sh b/modules.d/90livenet/module-setup.sh
index 3ae72de..b166859 100755
--- a/modules.d/90livenet/module-setup.sh
+++ b/modules.d/90livenet/module-setup.sh
@@ -15,7 +15,9 @@ depends() {
install() {
dracut_install wget
mkdir -m 0755 -p "$initdir/etc/ssl/certs"
- if ! inst_simple /etc/ssl/certs/ca-bundle.crt; then
+ if ! inst_any -t /etc/ssl/certs/ca-bundle.crt \
+ /etc/ssl/certs/ca-bundle.crt \
+ /etc/ssl/certs/ca-certificates.crt; then
dwarn "Couldn't find SSL CA cert bundle; HTTPS won't work."
fi

View File

@ -0,0 +1,95 @@
From c70f6415f8df27565540a1ec1b3a65c09ce3253b Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Przemys=C5=82aw=20Rudy?= <prudy1@o2.pl>
Date: Tue, 7 Jun 2011 20:22:51 +0200
Subject: [PATCH] luks key on ext dev - wait for luks
This asks for the luks passphrase if key is not found for defined time (if defined with rd.luks.tout cmd line):
modules.d/90crypt/cryptroot-ask.sh | 21 ++++++++++++++++++---
modules.d/90crypt/parse-crypt.sh | 5 +++--
2 files changed, 21 insertions(+), 5 deletions(-)
---
modules.d/90crypt/cryptroot-ask.sh | 21 ++++++++++++++++++---
modules.d/90crypt/parse-crypt.sh | 5 +++--
2 files changed, 21 insertions(+), 5 deletions(-)
diff --git a/modules.d/90crypt/cryptroot-ask.sh b/modules.d/90crypt/cryptroot-ask.sh
index f8e1bd8..9b8f8c2 100755
--- a/modules.d/90crypt/cryptroot-ask.sh
+++ b/modules.d/90crypt/cryptroot-ask.sh
@@ -22,6 +22,9 @@ NEWROOT=${NEWROOT:-"/sysroot"}
# default luksname - luks-UUID
luksname=$2
+# fallback to passphrase
+ask_passphrase=1
+
# if device name is /dev/dm-X, convert to /dev/mapper/name
if [ "${1##/dev/dm-}" != "$1" ]; then
device="/dev/mapper/$(dmsetup info -c --noheadings -o name "$1")"
@@ -63,12 +66,21 @@ fi
info "luksOpen $device $luksname"
-if [ -n "$(getarg rd.luks.key)" ]; then
+while [ -n "$(getarg rd.luks.key)" ]; do
if tmp=$(getkey /tmp/luks.keys $device); then
keydev="${tmp%%:*}"
keypath="${tmp#*:}"
else
- info "No key found for $device. Will try later."
+ if [ $# -eq 3 ]; then
+ if [ $3 -eq 0 ]; then
+ info "No key found for $device. Fallback to passphrase mode."
+ break
+ fi
+ info "No key found for $device. Will try $3 time(s) more later."
+ set -- "$1" "$2" "$(($3 - 1))"
+ else
+ info "No key found for $device. Will try later."
+ fi
initqueue --unique --onetime --settled \
--name cryptroot-ask-$luksname \
$(command -v cryptroot-ask) "$@"
@@ -80,7 +92,10 @@ if [ -n "$(getarg rd.luks.key)" ]; then
readkey "$keypath" "$keydev" "$device" \
| cryptsetup -d - luksOpen "$device" "$luksname"
unset keypath keydev
-else
+ ask_passphrase=0
+ break
+done
+if [ $ask_passphrase -ne 0 ]; then
luks_open="$(command -v cryptsetup) luksOpen"
ask_for_password --ply-tries 5 \
--ply-cmd "$luks_open -T1 $device $luksname" \
diff --git a/modules.d/90crypt/parse-crypt.sh b/modules.d/90crypt/parse-crypt.sh
index 7ec232a..c76fb23 100755
--- a/modules.d/90crypt/parse-crypt.sh
+++ b/modules.d/90crypt/parse-crypt.sh
@@ -11,6 +11,7 @@ else
} > /etc/udev/rules.d/70-luks.rules.new
LUKS=$(getargs rd.luks.uuid rd_LUKS_UUID)
+ tout=$(getarg rd.luks.tout)
if [ -n "$LUKS" ]; then
for luksid in $LUKS; do
@@ -20,7 +21,7 @@ else
printf -- 'ENV{ID_FS_UUID}=="*%s*", ' $luksid
printf -- 'RUN+="%s --unique --onetime ' $(command -v initqueue)
printf -- '--name cryptroot-ask-%%k %s ' $(command -v cryptroot-ask)
- printf -- '$env{DEVNAME} luks-$env{ID_FS_UUID}"\n'
+ printf -- '$env{DEVNAME} luks-$env{ID_FS_UUID} %s"\n' $tout
} >> /etc/udev/rules.d/70-luks.rules.new
printf -- '[ -e /dev/disk/by-uuid/*%s* ]\n' $luksid \
@@ -34,7 +35,7 @@ else
{
printf -- 'ENV{ID_FS_TYPE}=="crypto_LUKS", RUN+="%s ' $(command -v initqueue)
printf -- '--unique --onetime --name cryptroot-ask-%%k '
- printf -- '%s $env{DEVNAME} luks-$env{ID_FS_UUID}"\n' $(command -v cryptroot-ask)
+ printf -- '%s $env{DEVNAME} luks-$env{ID_FS_UUID} %s"\n' $(command -v cryptroot-ask) $tout
} >> /etc/udev/rules.d/70-luks.rules.new
fi

View File

@ -0,0 +1,23 @@
From 1f735f82cc55273d6d84ae129c482dc180c0e944 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Amadeusz=20=C5=BBo=C5=82nowski?= <aidecoe@aidecoe.name>
Date: Sun, 21 Aug 2011 10:26:40 +0200
Subject: [PATCH] crypt: changed cmdline arg name from rd.luks.tout to
rd.luks.key.tout
---
modules.d/90crypt/parse-crypt.sh | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/modules.d/90crypt/parse-crypt.sh b/modules.d/90crypt/parse-crypt.sh
index c76fb23..ff86700 100755
--- a/modules.d/90crypt/parse-crypt.sh
+++ b/modules.d/90crypt/parse-crypt.sh
@@ -11,7 +11,7 @@ else
} > /etc/udev/rules.d/70-luks.rules.new
LUKS=$(getargs rd.luks.uuid rd_LUKS_UUID)
- tout=$(getarg rd.luks.tout)
+ tout=$(getarg rd.luks.key.tout)
if [ -n "$LUKS" ]; then
for luksid in $LUKS; do

View File

@ -0,0 +1,39 @@
From 2e0c003435bbc0751cdf7466c0faebe7bfc7445b Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Przemys=C5=82aw=20Rudy?= <prudy1@o2.pl>
Date: Mon, 22 Aug 2011 11:27:00 +0200
Subject: [PATCH] luks key on ext dev - wait for luks
This really waits for the luks mapper device, so luksOpen can do it job
---
modules.d/90crypt/parse-crypt.sh | 18 ++++++++++++++++--
1 files changed, 16 insertions(+), 2 deletions(-)
diff --git a/modules.d/90crypt/parse-crypt.sh b/modules.d/90crypt/parse-crypt.sh
index ff86700..1e78aa9 100755
--- a/modules.d/90crypt/parse-crypt.sh
+++ b/modules.d/90crypt/parse-crypt.sh
@@ -24,8 +24,22 @@ else
printf -- '$env{DEVNAME} luks-$env{ID_FS_UUID} %s"\n' $tout
} >> /etc/udev/rules.d/70-luks.rules.new
- printf -- '[ -e /dev/disk/by-uuid/*%s* ]\n' $luksid \
- >> $hookdir/initqueue/finished/90-crypt.sh
+
+ [ -e $hookdir/initqueue/finished/90-crypt.sh ] || \
+ {
+ printf -- 'UUIDS=:\n'
+ printf -- 'for dm in /dev/dm-*; do\n'
+ printf -- '[ -e "$dm" ] || exit 1\n'
+ printf -- 'dmid=`/sbin/dmsetup info -c -o uuid --noheadings "$dm"`\n'
+ printf -- 'uuid=${dmid#CRYPT-LUKS*-}\n'
+ printf -- '[ "x$uuid" = "x$dmid" ] && continue\n'
+ printf -- 'UUIDS="${UUIDS}${uuid%%%%-*}:"\n'
+ printf -- 'done\n'
+ } > $hookdir/initqueue/finished/90-crypt.sh
+ uuid=$luksid
+ while [ "$uuid" != "${uuid#*-}" ]; do uuid=${uuid%%-*}${uuid#*-}; done
+ printf -- '[ "x${UUIDS#*:%s:}" != "x$UUIDS" ] || exit 1\n' $uuid >> $hookdir/initqueue/finished/90-crypt.sh
+
{
printf -- '[ -e /dev/disk/by-uuid/*%s* ] || ' $luksid
printf -- 'warn "crypto LUKS UUID "%s" not found"\n' $luksid

View File

@ -0,0 +1,22 @@
From 8cf621ffd98984f44e2861969d9ed58be7233d4e Mon Sep 17 00:00:00 2001
From: Harald Hoyer <harald@redhat.com>
Date: Tue, 23 Aug 2011 12:50:03 +0200
Subject: [PATCH] dracut-functions: fix inst_dir() for non-absolute dirs
---
dracut-functions | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/dracut-functions b/dracut-functions
index 43a6843..a3340e4 100755
--- a/dracut-functions
+++ b/dracut-functions
@@ -279,7 +279,7 @@ inst_dir() {
[[ -e ${initdir}$_dir ]] && return 0
_part=${_dir%/*}
- while ! [[ -e "${initdir}${_part}" ]]; do
+ while [[ "$_part" != "${_part%/*}" ]] && ! [[ -e "${initdir}${_part}" ]]; do
_dir="$_part $_dir"
_part=${_part%/*}
done

View File

@ -0,0 +1,26 @@
From 1073b9f93acb76993b4cc41b896325d1041841d1 Mon Sep 17 00:00:00 2001
From: Harald Hoyer <harald@redhat.com>
Date: Wed, 24 Aug 2011 16:35:33 +0200
Subject: [PATCH] 90mdraid/65-md-incremental-imsm.rules: incremental run to
settled
move incremental run to settled queue again
https://bugzilla.redhat.com/show_bug.cgi?id=732967
---
modules.d/90mdraid/65-md-incremental-imsm.rules | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/modules.d/90mdraid/65-md-incremental-imsm.rules b/modules.d/90mdraid/65-md-incremental-imsm.rules
index 4fc8428..7c1d503 100644
--- a/modules.d/90mdraid/65-md-incremental-imsm.rules
+++ b/modules.d/90mdraid/65-md-incremental-imsm.rules
@@ -29,7 +29,7 @@ LABEL="do_md_inc"
ENV{rd_MDADMCONF}!="?*", GOTO="md_auto_end"
RUN+="/sbin/initqueue --finished --unique --name md_finished /sbin/md_finished.sh"
-RUN+="/sbin/initqueue --timeout --onetime --unique /sbin/mdadm_auto"
+RUN+="/sbin/initqueue --settled --onetime --unique /sbin/mdadm_auto"
GOTO="md_inc_end"

View File

@ -0,0 +1,111 @@
From 82dfee9960e6285bd2811c406f4b9347dcf4e733 Mon Sep 17 00:00:00 2001
From: Harald Hoyer <harald@redhat.com>
Date: Mon, 29 Aug 2011 13:11:49 +0200
Subject: [PATCH] dracut.spec: fixed rhel/fedora version checks
---
dracut.spec | 22 +++++++++++-----------
1 files changed, 11 insertions(+), 11 deletions(-)
diff --git a/dracut.spec b/dracut.spec
index 4a71942..76f4fe1 100644
--- a/dracut.spec
+++ b/dracut.spec
@@ -11,7 +11,7 @@ Version: xxx
Release: xxx
Summary: Initramfs generator using udev
-%if 0%{?fedora}
+%if 0%{?fedora} || 0%{?rhel} > 6
Group: System Environment/Base
%endif
%if 0%{?suse_version}
@@ -25,14 +25,14 @@ Source0: http://www.kernel.org/pub/linux/utils/boot/dracut/dracut-%{version}.tar
BuildArch: noarch
BuildRequires: dash bash
-%if 0%{?fedora}
+%if 0%{?fedora} || 0%{?rhel} > 6
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
%endif
%if 0%{?suse_version}
BuildRoot: %{_tmppath}/%{name}-%{version}-build
%endif
-%if 0%{?fedora}
+%if 0%{?fedora} || 0%{?rhel} > 6
BuildRequires: docbook-style-xsl docbook-dtds libxslt
%endif
@@ -73,7 +73,7 @@ Requires: sed
Requires: tar
Requires: udev
-%if 0%{?fedora}
+%if 0%{?fedora} || 0%{?rhel} > 6
Requires: util-linux >= 2.16
Requires: initscripts >= 8.63-1
Requires: plymouth >= 0.8.0-0.2009.29.09.19.1
@@ -101,7 +101,7 @@ Requires: nbd
Requires: iproute
Requires: bridge-utils
-%if 0%{?fedora}
+%if 0%{?fedora} || 0%{?rhel} > 6
Requires: iscsi-initiator-utils
Requires: nfs-utils
Requires: dhclient
@@ -119,7 +119,7 @@ Provides: dracut-generic = %{version}-%{release}
This package requires everything which is needed to build a generic
all purpose initramfs with network support with dracut.
-%if 0%{?fedora}
+%if 0%{?fedora} || 0%{?rhel} > 6
%package fips
Summary: Dracut modules to build a dracut initramfs with an integrity check
Requires: %{name} = %{version}-%{release}
@@ -160,7 +160,7 @@ This package contains tools to assemble the local initrd and host configuration.
make
%install
-%if 0%{?fedora}
+%if 0%{?fedora} || 0%{?rhel} > 6
rm -rf $RPM_BUILD_ROOT
%endif
make install DESTDIR=$RPM_BUILD_ROOT sbindir=/sbin \
@@ -168,7 +168,7 @@ make install DESTDIR=$RPM_BUILD_ROOT sbindir=/sbin \
echo %{name}-%{version}-%{release} > $RPM_BUILD_ROOT/%{_datadir}/dracut/modules.d/10rpmversion/dracut-version
-%if 0%{?fedora} == 0
+%if 0%{?fedora} == 0 && 0%{?rhel} == 0
rm -fr $RPM_BUILD_ROOT/%{_datadir}/dracut/modules.d/01fips
%endif
@@ -181,7 +181,7 @@ mkdir -p $RPM_BUILD_ROOT%{_localstatedir}/log
touch $RPM_BUILD_ROOT%{_localstatedir}/log/dracut.log
mkdir -p $RPM_BUILD_ROOT%{_sharedstatedir}/initramfs
-%if 0%{?fedora}
+%if 0%{?fedora} || 0%{?rhel} > 6
install -m 0644 dracut.conf.d/fedora.conf.example $RPM_BUILD_ROOT/etc/dracut.conf.d/01-dist.conf
install -m 0644 dracut.conf.d/fips.conf.example $RPM_BUILD_ROOT/etc/dracut.conf.d/40-fips.conf
%endif
@@ -214,7 +214,7 @@ rm -rf $RPM_BUILD_ROOT
%{_datadir}/dracut/dracut-functions
%{_datadir}/dracut/dracut-logger
%config(noreplace) /etc/dracut.conf
-%if 0%{?fedora} || 0%{?suse_version}
+%if 0%{?fedora} || 0%{?suse_version} || 0%{?rhel} > 6
%config /etc/dracut.conf.d/01-dist.conf
%endif
%dir /etc/dracut.conf.d
@@ -271,7 +271,7 @@ rm -rf $RPM_BUILD_ROOT
%{_datadir}/dracut/modules.d/45ifcfg
%{_datadir}/dracut/modules.d/95znet
-%if 0%{?fedora}
+%if 0%{?fedora} || 0%{?rhel} > 6
%files fips
%defattr(-,root,root,0755)
%{_datadir}/dracut/modules.d/01fips

View File

@ -0,0 +1,46 @@
From a3381af1dedf5325197dba00fb24ca36376f4c23 Mon Sep 17 00:00:00 2001
From: Harald Hoyer <harald@redhat.com>
Date: Mon, 29 Aug 2011 18:30:26 +0200
Subject: [PATCH] 50plymouth: add plymouth.enable kernel command line option
---
dracut.kernel.7.xml | 8 +++++++-
modules.d/50plymouth/plymouth-pretrigger.sh | 2 +-
2 files changed, 8 insertions(+), 2 deletions(-)
diff --git a/dracut.kernel.7.xml b/dracut.kernel.7.xml
index 894b640..b6e59e6 100644
--- a/dracut.kernel.7.xml
+++ b/dracut.kernel.7.xml
@@ -696,11 +696,17 @@ rd.znet=ctc,0.0.0600,0.0.0601,0.0.0602,protocol=bar</programlisting></para>
<title>Plymouth Boot Splash</title>
<variablelist>
<varlistentry>
- <term><envar>rd.plymouth</envar>=0</term>
+ <term><envar>plymouth.enable</envar>=0</term>
<listitem>
<para>disable the plymouth bootsplash.</para>
</listitem>
</varlistentry>
+ <varlistentry>
+ <term><envar>rd.plymouth</envar>=0</term>
+ <listitem>
+ <para>disable the plymouth bootsplash only for the initramfs.</para>
+ </listitem>
+ </varlistentry>
</variablelist>
</refsect2>
<refsect2>
diff --git a/modules.d/50plymouth/plymouth-pretrigger.sh b/modules.d/50plymouth/plymouth-pretrigger.sh
index 25ed06f..534948e 100755
--- a/modules.d/50plymouth/plymouth-pretrigger.sh
+++ b/modules.d/50plymouth/plymouth-pretrigger.sh
@@ -2,7 +2,7 @@
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
# ex: ts=8 sw=4 sts=4 et filetype=sh
-if getargbool 1 rd.plymouth -n rd_NO_PLYMOUTH; then
+if getargbool 1 plymouth.enable && getargbool 1 rd.plymouth -n rd_NO_PLYMOUTH; then
[ -c /dev/null ] || mknod -m 0666 /dev/null c 1 3
# first trigger graphics subsystem
udevadm trigger --action=add --attr-match=class=0x030000 >/dev/null 2>&1

View File

@ -0,0 +1,63 @@
From ab55a117e20d0af861e78e1e0b492775f306280d Mon Sep 17 00:00:00 2001
From: Harald Hoyer <harald@redhat.com>
Date: Mon, 29 Aug 2011 19:12:12 +0200
Subject: [PATCH] 99base/init: only poll cdroms, if the kernel does support
autopolling
---
modules.d/99base/init | 34 +++++++++++++++-------------------
1 files changed, 15 insertions(+), 19 deletions(-)
diff --git a/modules.d/99base/init b/modules.d/99base/init
index 90128c7..0328903 100755
--- a/modules.d/99base/init
+++ b/modules.d/99base/init
@@ -205,7 +205,8 @@ getarg 'rd.break=pre-trigger' 'rdbreak=pre-trigger' && emergency_shell -n pre-tr
source_hook pre-trigger
# then the rest
-udevadm trigger --action=add $udevtriggeropts >/dev/null 2>&1
+udevadm trigger --type=subsystems --action=add >/dev/null 2>&1
+udevadm trigger --type=devices --action=add >/dev/null 2>&1
getarg 'rd.break=initqueue' 'rdbreak=initqueue' && emergency_shell -n initqueue "Break before initqueue"
@@ -246,25 +247,20 @@ while :; do
# no more udev jobs and queues empty.
sleep 0.5
- # dirty hack for some cdrom drives,
- # which report no medium for quiet
- # some time.
- for cdrom in /sys/block/sr*; do
- [ -e "$cdrom" ] || continue
- # skip, if cdrom medium was already found
- strstr "$(udevadm info --query=env --path=${cdrom##/sys})" \
- ID_CDROM_MEDIA && continue
-
- if [ -e "$cdrom"/events_poll_msecs -a ! -e "/tmp/.poll_${cdrom##*/}" ]; then
- msecs=$(while read a; do echo $a;done < "$cdrom"/events_poll_msecs)
- if [ "$msecs" = "-1" ]; then
- echo 250 > "$cdrom"/events_poll_msecs
- > "/tmp/.poll_${cdrom##*/}"
- fi
- else
+ if [ ! -e /sys/module/block/parameters/uevent ]; then
+ # if the kernel does not support autopolling
+ # then we have to do a
+ # dirty hack for some cdrom drives,
+ # which report no medium for quiet
+ # some time.
+ for cdrom in /sys/block/sr*; do
+ [ -e "$cdrom" ] || continue
+ # skip, if cdrom medium was already found
+ strstr "$(udevadm info --query=env --path=${cdrom##/sys})" \
+ ID_CDROM_MEDIA && continue
echo change > "$cdrom/uevent"
- fi
- done
+ done
+ fi
if [ $main_loop -gt $(($RDRETRY/2)) ]; then
for job in $hookdir/initqueue/timeout/*.sh; do

View File

@ -0,0 +1,43 @@
From f4ca564ba67d5821b756727689664604e76d1cdf Mon Sep 17 00:00:00 2001
From: John Reiser <jreiser@bitwagon.com>
Date: Mon, 29 Aug 2011 14:42:15 -0700
Subject: [PATCH] build initramfs: unclear _mpargs in instmods()
The local variable _mpargs in function instmods() in file dracut-functions
looks peculiar. The documentation is non-existent, but still ...
First, $_mpargs is not passed to modprobe via for_each_kmod_dep.
This is strange because my guess is that "_mpargs" means
"extra arguments for modprobe".
Second, the leading "--" will be lopped when a leading pathname
is stripped via
_mod=${_mod##*/}
It seems to me that a leading "--" should inhibit modification.
Here's the corresponding patch to current HEAD (from dracut-013.)
---
dracut-functions | 3 +--
1 files changed, 1 insertions(+), 2 deletions(-)
diff --git a/dracut-functions b/dracut-functions
index a3340e4..c28766e 100755
--- a/dracut-functions
+++ b/dracut-functions
@@ -919,7 +919,6 @@ instmods() {
fi
;;
--*)
- _mod=${_mod##*/}
_mpargs+=" $_mod";;
i2o_scsi) shift; continue;; # Do not load this diagnostic-only module
*) _mod=${_mod##*/}
@@ -942,7 +941,7 @@ instmods() {
# ok, load the module, all its dependencies, and any firmware
# it may require
for_each_kmod_dep install_kmod_with_fw $_mod \
- --set-version $kernel ${_moddirname}
+ --set-version $kernel ${_moddirname} $_mpargs
((_ret+=$?))
;;
esac

View File

@ -0,0 +1,25 @@
From 2c0b5281f558276a6bd31d7acd104196139dbc16 Mon Sep 17 00:00:00 2001
From: Harald Hoyer <harald@redhat.com>
Date: Tue, 30 Aug 2011 14:43:57 +0200
Subject: [PATCH] 90crypt/parse-crypt.sh: also accept the beginning of the
LUKS UUID
2e0c003435bbc0751cdf7466c0faebe7bfc7445b introduced a too strict test
for LUKS UUIDs
---
modules.d/90crypt/parse-crypt.sh | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/modules.d/90crypt/parse-crypt.sh b/modules.d/90crypt/parse-crypt.sh
index 1e78aa9..2ab3a9f 100755
--- a/modules.d/90crypt/parse-crypt.sh
+++ b/modules.d/90crypt/parse-crypt.sh
@@ -38,7 +38,7 @@ else
} > $hookdir/initqueue/finished/90-crypt.sh
uuid=$luksid
while [ "$uuid" != "${uuid#*-}" ]; do uuid=${uuid%%-*}${uuid#*-}; done
- printf -- '[ "x${UUIDS#*:%s:}" != "x$UUIDS" ] || exit 1\n' $uuid >> $hookdir/initqueue/finished/90-crypt.sh
+ printf -- '[ "x${UUIDS#*:%s*:}" != "x$UUIDS" ] || exit 1\n' $uuid >> $hookdir/initqueue/finished/90-crypt.sh
{
printf -- '[ -e /dev/disk/by-uuid/*%s* ] || ' $luksid

View File

@ -0,0 +1,32 @@
From ed42e64cfc2c3d36436ef0d0634332219dcce1a2 Mon Sep 17 00:00:00 2001
From: Harald Hoyer <harald@redhat.com>
Date: Tue, 30 Aug 2011 16:22:46 +0200
Subject: [PATCH] 99base/init: save and restore environment given from the
kernel
---
modules.d/99base/init | 4 ++++
1 files changed, 4 insertions(+), 0 deletions(-)
diff --git a/modules.d/99base/init b/modules.d/99base/init
index 0328903..21b9468 100755
--- a/modules.d/99base/init
+++ b/modules.d/99base/init
@@ -8,6 +8,8 @@
# Harald Hoyer <harald@redhat.com>
# Jeremy Katz <katzj@redhat.com>
+export -p > /tmp/export.orig
+
wait_for_loginit()
{
set +x
@@ -391,6 +393,8 @@ for i in $(export -p); do
unset "$i";;
esac
done
+. /tmp/export.orig
+rm -f /tmp/export.orig
initargs=""
read CLINE </proc/cmdline

View File

@ -0,0 +1,30 @@
From 1e2f60993fa3e4638ab03db1701e0b0d3f100ca0 Mon Sep 17 00:00:00 2001
From: Harald Hoyer <harald@redhat.com>
Date: Tue, 30 Aug 2011 16:23:17 +0200
Subject: [PATCH] 99base/init: move switch_root breakpoint to a later point in
the script
---
modules.d/99base/init | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/modules.d/99base/init b/modules.d/99base/init
index 21b9468..b666d3e 100755
--- a/modules.d/99base/init
+++ b/modules.d/99base/init
@@ -359,7 +359,6 @@ done
emergency_shell
}
-getarg rd.break rdbreak && emergency_shell -n switch_root "Break before switch_root"
if [ $UDEVVERSION -lt 168 ]; then
# stop udev queue before killing it
@@ -443,6 +442,7 @@ fi
wait_for_loginit
+getarg rd.break rdbreak && emergency_shell -n switch_root "Break before switch_root"
info "Switching root"
unset PS4

View File

@ -0,0 +1,32 @@
From 5f06f0c36701a3e3eb1c6e92ec173285dca3c922 Mon Sep 17 00:00:00 2001
From: Harald Hoyer <harald@redhat.com>
Date: Wed, 31 Aug 2011 15:22:09 +0200
Subject: [PATCH] dracut-functions: hmac checksum files can be symlinks, too
use inst() instead of inst_simple() to install the hmac files
---
dracut-functions | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/dracut-functions b/dracut-functions
index c28766e..3edd4c7 100755
--- a/dracut-functions
+++ b/dracut-functions
@@ -320,7 +320,7 @@ inst_simple() {
fi
# install checksum files also
if [[ -e "${_src%/*}/.${_src##*/}.hmac" ]]; then
- inst_simple "${_src%/*}/.${_src##*/}.hmac" "${target%/*}/.${target##*/}.hmac"
+ inst "${_src%/*}/.${_src##*/}.hmac" "${target%/*}/.${target##*/}.hmac"
fi
ddebug "Installing $_src"
cp -pfL "$_src" "${initdir}$target"
@@ -360,7 +360,7 @@ inst_library() {
if [[ -L $_src ]]; then
# install checksum files also
if [[ -e "${_src%/*}/.${_src##*/}.hmac" ]]; then
- inst_simple "${_src%/*}/.${_src##*/}.hmac" "${_dest%/*}/.${_dest##*/}.hmac"
+ inst "${_src%/*}/.${_src##*/}.hmac" "${_dest%/*}/.${_dest##*/}.hmac"
fi
_reallib=$(readlink -f "$_src")
inst_simple "$_reallib" "$_reallib"

View File

@ -0,0 +1,21 @@
From f063d0e89fdededa1cf0a0f5ab62e05dfb00b2a7 Mon Sep 17 00:00:00 2001
From: Harald Hoyer <harald@redhat.com>
Date: Wed, 31 Aug 2011 16:48:20 +0200
Subject: [PATCH] 95udev-rules: add input_id
---
modules.d/95udev-rules/module-setup.sh | 1 +
1 files changed, 1 insertions(+), 0 deletions(-)
diff --git a/modules.d/95udev-rules/module-setup.sh b/modules.d/95udev-rules/module-setup.sh
index 5bd5d59..876f7a3 100755
--- a/modules.d/95udev-rules/module-setup.sh
+++ b/modules.d/95udev-rules/module-setup.sh
@@ -49,6 +49,7 @@ install() {
fw_unit_symlinks.sh \
hid2hci \
path_id \
+ input_id \
scsi_id \
usb_id \
vol_id \

View File

@ -0,0 +1,50 @@
From 3f590c7840bb0897154f66a277be6bfaa63677bd Mon Sep 17 00:00:00 2001
From: John Reiser <jreiser@BitWagon.com>
Date: Fri, 26 Aug 2011 13:01:33 -0700
Subject: [PATCH] inst_simple, inst_dir: make fast case faster
This small stuff saves 1.7% per dropped statement during "dracut --profile".
Fixing the comment about /lib -> lib64 is REQUIRED!
---
dracut-functions | 16 +++++-----------
1 files changed, 5 insertions(+), 11 deletions(-)
diff --git a/dracut-functions b/dracut-functions
index 3edd4c7..f41fc7d 100755
--- a/dracut-functions
+++ b/dracut-functions
@@ -266,19 +266,13 @@ check_vol_slaves() {
}
# Install a directory, keeping symlinks as on the original system.
-# Example: if /lib64 points to /lib on the host, "inst_dir /lib/file"
+# Example: if /lib points to /lib64 on the host, "inst_dir /lib/file"
# will create ${initdir}/lib64, ${initdir}/lib64/file,
# and a symlink ${initdir}/lib -> lib64.
inst_dir() {
- local _file=""
- local _oldifs="$IFS"
- local _part
- local _dir="$1"
+ [[ -e ${initdir}"$1" ]] && return 0 # already there
- # fast out
- [[ -e ${initdir}$_dir ]] && return 0
-
- _part=${_dir%/*}
+ local _dir="$1" _part=${_dir%/*} _file
while [[ "$_part" != "${_part%/*}" ]] && ! [[ -e "${initdir}${_part}" ]]; do
_dir="$_part $_dir"
_part=${_part%/*}
@@ -310,9 +304,9 @@ inst_dir() {
# Location of the image dir is assumed to be $initdir
# We never overwrite the target if it exists.
inst_simple() {
- local _src target
[[ -f $1 ]] || return 1
- _src=$1 target="${2:-$1}"
+
+ local _src=$1 target="${2:-$1}"
if ! [[ -d ${initdir}$target ]]; then
[[ -e ${initdir}$target ]] && return 0
[[ -h ${initdir}$target ]] && return 0

View File

@ -0,0 +1,52 @@
From ceebd9ac769dcb869529d57fdb155cf7199251f8 Mon Sep 17 00:00:00 2001
From: John Reiser <jreiser@BitWagon.com>
Date: Sat, 27 Aug 2011 14:43:49 -0700
Subject: [PATCH] filter_kernel_modules is a specialized
filter_kernel_modules_by_path
---
dracut-functions | 31 +++----------------------------
1 files changed, 3 insertions(+), 28 deletions(-)
diff --git a/dracut-functions b/dracut-functions
index f41fc7d..a72aa53 100755
--- a/dracut-functions
+++ b/dracut-functions
@@ -863,34 +863,9 @@ filter_kernel_modules_by_path () (
done
)
-# filter kernel modules to install certain modules that meet specific
-# requirements.
-# $1 = function to call with module name to filter.
-# This function will be passed the full path to the module to test.
-# The behaviour of this function can vary depending on whether $hostonly is set.
-# If it is, we will only look at modules that are already in memory.
-# If it is not, we will look at all kernel modules
-# This function returns the full filenames of modules that match $1
-filter_kernel_modules () (
- local _modname _filtercmd
- if ! [[ $hostonly ]]; then
- _filtercmd='find "$srcmods/kernel/drivers" "$srcmods/extra"'
- _filtercmd+=' "$srcmods/weak-updates" -name "*.ko" -o -name "*.ko.gz"'
- _filtercmd+=' 2>/dev/null'
- else
- _filtercmd='cut -d " " -f 1 </proc/modules|xargs modinfo -F filename '
- _filtercmd+='-k $kernel 2>/dev/null'
- fi
- for _modname in $(eval $_filtercmd); do
- case $_modname in
- *.ko) "$1" "$_modname" && echo "$_modname";;
- *.ko.gz) gzip -dc "$_modname" > $initdir/$$.ko
- $1 $initdir/$$.ko && echo "$_modname"
- rm -f $initdir/$$.ko
- ;;
- esac
- done
-)
+filter_kernel_modules () {
+ filter_kernel_modules_by_path drivers "$1"
+}
# install kernel modules along with all their dependencies.
instmods() {

View File

@ -0,0 +1,30 @@
From e6024e0030bcf35b0f0c97cdc6f259711536459b Mon Sep 17 00:00:00 2001
From: John Reiser <jreiser@BitWagon.com>
Date: Sun, 28 Aug 2011 13:24:58 -0700
Subject: [PATCH] install_kmod_with_fw: make fast case faster
---
dracut-functions | 5 +++--
1 files changed, 3 insertions(+), 2 deletions(-)
diff --git a/dracut-functions b/dracut-functions
index a72aa53..4d3317c 100755
--- a/dracut-functions
+++ b/dracut-functions
@@ -782,13 +782,14 @@ check_module_dir() {
# Install a single kernel module along with any firmware it may require.
# $1 = full path to kernel module to install
install_kmod_with_fw() {
- local _modname=${1##*/} _fwdir _found _fw
- _modname=${_modname%.ko*}
# no need to go further if the module is already installed
[[ -e "${initdir}/lib/modules/$kernel/${1##*/lib/modules/$kernel/}" ]] \
&& return 0
inst_simple "$1" "/lib/modules/$kernel/${1##*/lib/modules/$kernel/}" \
|| return $?
+
+ local _modname=${1##*/} _fwdir _found _fw
+ _modname=${_modname%.ko*}
for _fw in $(modinfo -k $kernel -F firmware $1 2>/dev/null); do
_found=''
for _fwdir in $fw_dir; do

View File

@ -0,0 +1,239 @@
From 881eda695ed552474b9d1e5befe084d7bfab3d50 Mon Sep 17 00:00:00 2001
From: John Reiser <jreiser@BitWagon.com>
Date: Mon, 29 Aug 2011 13:40:21 -0700
Subject: [PATCH] instmods: get filenames from stdin if no args; use it
Use bash "[[ string =~ pattern ]]" instead of "egrep -q".
Replace control-dominated serial fondling
for var in $(proc1); do proc2 var; done
with data-dominated parallel pipeline
proc1 | while read var; do proc2 var; done
Together this is a large savings.
[harald@redhat.com: fixed network kernel module filter]
---
dracut-functions | 57 ++++++++++++++++++++--------
modules.d/40network/module-setup.sh | 19 +++++++--
modules.d/90kernel-modules/module-setup.sh | 11 +++++-
modules.d/90multipath/module-setup.sh | 15 +++++--
modules.d/95iscsi/module-setup.sh | 12 ++++-
5 files changed, 84 insertions(+), 30 deletions(-)
diff --git a/dracut-functions b/dracut-functions
index 4d3317c..556d309 100755
--- a/dracut-functions
+++ b/dracut-functions
@@ -863,49 +863,63 @@ filter_kernel_modules_by_path () (
esac
done
)
+find_kernel_modules_by_path () (
+ if ! [[ $hostonly ]]; then
+ find "$srcmods/kernel/$1" "$srcmods/extra" "$srcmods/weak-updates" \
+ -name "*.ko" -o -name "*.ko.gz" 2>/dev/null
+ else
+ cut -d " " -f 1 </proc/modules \
+ | xargs modinfo -F filename -k $kernel 2>/dev/null
+ fi
+)
filter_kernel_modules () {
filter_kernel_modules_by_path drivers "$1"
}
+find_kernel_modules () {
+ find_kernel_modules_by_path drivers
+}
+
# install kernel modules along with all their dependencies.
instmods() {
[[ $no_kernel = yes ]] && return
- local _mod _mpargs _moddirname
- local _ret=0
- while (($# > 0)); do
- _mod=${1%.ko*}
+
+ function inst1mod() {
+ local _mod="$1"
case $_mod in
=*)
# This introduces 2 incompatible meanings for =* arguments
# to instmods. We need to decide which one to keep.
if [[ $_mod = =ata && -f $srcmods/modules.block ]]; then
- instmods $_mpargs \
- $(egrep 'ata|ahci' "${srcmods}/modules.block")
+ ( echo -n "$_mpargs"; egrep 'ata|ahci' "${srcmods}/modules.block" ) \
+ | instmods
elif [ -f $srcmods/modules.${_mod#=} ]; then
- instmods $_mpargs $(cat ${srcmods}/modules.${_mod#=} )
+ ( echo -n "$_mpargs"; cat "${srcmods}/modules.${_mod#=}" ) \
+ | instmods
else
- instmods $_mpargs $(find "$srcmods" -path "*/${_mod#=}/*")
+ ( echo -n "$_mpargs"; find "$srcmods" -path "*/${_mod#=}/*" ) \
+ | instmods
fi
;;
- --*)
- _mpargs+=" $_mod";;
- i2o_scsi) shift; continue;; # Do not load this diagnostic-only module
+ --*) _mpargs+="${_mod##*/}"$'\n' ;; # one _mod per line; lops '--'
+ i2o_scsi) return ;; # Do not load this diagnostic-only module
*) _mod=${_mod##*/}
+
# if we are already installed, skip this module and go on
# to the next one.
- [[ -f $initdir/$1 ]] && { shift; continue; }
+ [[ -f $initdir/$1 ]] && return
+
# If we are building a host-specific initramfs and this
# module is not already loaded, move on to the next one.
[[ $hostonly ]] && ! grep -qe "\<${_mod//-/_}\>" /proc/modules \
- && ! echo $add_drivers | grep -qe "\<${_mod}\>" && {
- shift; continue
- }
+ && ! echo $add_drivers | grep -qe "\<${_mod}\>" \
+ && return
# We use '-d' option in modprobe only if modules prefix path
# differs from default '/'. This allows us to use Dracut with
# old version of modprobe which doesn't have '-d' option.
- _moddirname=${srcmods%%/lib/modules/*}
+ local _moddirname=${srcmods%%/lib/modules/*}
[[ -n ${_moddirname} ]] && _moddirname="-d ${_moddirname}/"
# ok, load the module, all its dependencies, and any firmware
@@ -915,6 +929,17 @@ instmods() {
((_ret+=$?))
;;
esac
+ }
+
+ local _mpargs _ret=0
+ if (($# == 0)); then # filenames from stdin
+ local _mod
+ while read _mod; do
+ inst1mod "${_mod%.ko*}"
+ done
+ fi
+ while (($# > 0)); do # filenames as args
+ inst1mod ${1%.ko*}
shift
done
return $_ret
diff --git a/modules.d/40network/module-setup.sh b/modules.d/40network/module-setup.sh
index 39366b6..cb81269 100755
--- a/modules.d/40network/module-setup.sh
+++ b/modules.d/40network/module-setup.sh
@@ -24,15 +24,24 @@ depends() {
installkernel() {
# Include wired net drivers, excluding wireless
- net_module_test() {
+ net_module_filter() {
local _net_drivers='eth_type_trans|register_virtio_device'
local _unwanted_drivers='/(wireless|isdn|uwb)/'
- egrep -q $_net_drivers "$1" && \
- egrep -qv 'iw_handler_get_spy' "$1" && \
- [[ ! $1 =~ $_unwanted_drivers ]]
+ local _fname
+ while read _fname; do
+ local _fcont
+ case "$_fname" in
+ *.ko) _fcont="$(< $_fname)" ;;
+ *.ko.gz) _fcont="$(gzip -dc $_fname)" ;;
+ esac
+ [[ $_fcont =~ $_net_drivers
+ && ! $_fcont =~ iw_handler_get_spy \
+ && ! $_fname =~ $_unwanted_drivers ]] \
+ && echo "$_fname"
+ done
}
- instmods $(filter_kernel_modules_by_path drivers/net net_module_test)
+ find_kernel_modules_by_path drivers/net | net_module_filter | instmods
instmods ecb arc4
# bridge modules
diff --git a/modules.d/90kernel-modules/module-setup.sh b/modules.d/90kernel-modules/module-setup.sh
index 245ec0b..9fc4248 100755
--- a/modules.d/90kernel-modules/module-setup.sh
+++ b/modules.d/90kernel-modules/module-setup.sh
@@ -9,6 +9,15 @@ installkernel() {
egrep -q "$blockfuncs" "$1"
}
+ block_module_filter() {
+ local _blockfuncs='ahci_init_controller|ata_scsi_ioctl|scsi_add_host|blk_init_queue|register_mtd_blktrans|scsi_esp_register|register_virtio_device'
+ local _f
+ while read _f; do case "$_f" in
+ *.ko) [[ $(< $_f) =~ $_blockfuncs ]] && echo "$_f" ;;
+ *.ko.gz) [[ $(gzip -dc <$_f) =~ $_blockfuncs ]] && echo "$_f" ;;
+ esac
+ done
+ }
hostonly='' instmods sr_mod sd_mod scsi_dh scsi_dh_rdac scsi_dh_emc
hostonly='' instmods pcmcia firewire-ohci
hostonly='' instmods usb_storage sdhci sdhci-pci
@@ -18,7 +27,7 @@ installkernel() {
# install unix socket support
hostonly='' instmods unix
instmods "=drivers/pcmcia" =ide "=drivers/usb/storage"
- instmods $(filter_kernel_modules block_module_test)
+ find_kernel_modules | block_module_filter | instmods
# if not on hostonly mode, install all known filesystems,
# if the required list is not set via the filesystems variable
if ! [[ $hostonly ]]; then
diff --git a/modules.d/90multipath/module-setup.sh b/modules.d/90multipath/module-setup.sh
index e9a47fc..f68b58d 100755
--- a/modules.d/90multipath/module-setup.sh
+++ b/modules.d/90multipath/module-setup.sh
@@ -33,13 +33,18 @@ depends() {
}
installkernel() {
- mp_mod_test() {
- local mpfuncs='scsi_register_device_handler|dm_dirty_log_type_register|dm_register_path_selector|dm_register_target'
- egrep -q "$mpfuncs" "$1"
+ mp_mod_filter() {
+ local _mpfuncs='scsi_register_device_handler|dm_dirty_log_type_register|dm_register_path_selector|dm_register_target'
+ local _f
+ while read _f; do case "$_f" in
+ *.ko) [[ $(< $_f) =~ $_mpfuncs ]] && echo "$_f" ;;
+ *.ko.gz) [[ $(gzip -dc <$_f) =~ $_mpfuncs ]] && echo "$_f" ;;
+ esac
+ done
}
- instmods $(filter_kernel_modules_by_path drivers/scsi mp_mod_test)
- instmods $(filter_kernel_modules_by_path drivers/md mp_mod_test)
+ ( find_kernel_modules_by_path drivers/scsi;
+ find_kernel_modules_by_path drivers/md ) | mp_mod_filter | instmods
}
install() {
diff --git a/modules.d/95iscsi/module-setup.sh b/modules.d/95iscsi/module-setup.sh
index 3db40ea..b7771ab 100755
--- a/modules.d/95iscsi/module-setup.sh
+++ b/modules.d/95iscsi/module-setup.sh
@@ -42,11 +42,17 @@ depends() {
installkernel() {
instmods iscsi_tcp iscsi_ibft crc32c
- iscsi_module_test() {
+ iscsi_module_filter() {
local _iscsifuncs='iscsi_register_transport'
- fgrep -q "$_iscsifuncs" "$1"
+ local _f
+ while read _f; do case "$_f" in
+ *.ko) [[ $(< $_f) =~ $_iscsifuncs ]] && echo "$_f" ;;
+ *.ko.gz) [[ $(gzip -dc <$_f) =~ $_iscsifuncs ]] && echo "$_f" ;;
+ esac
+ done
}
- instmods $(filter_kernel_modules_by_path drivers/scsi iscsi_module_test)
+ find_kernel_modules_by_path drivers/scsi \
+ | iscsi_module_filter | instmods
}
install() {

View File

@ -0,0 +1,38 @@
From 0024702fe7551e0de8180a5b514b31f57b4fc213 Mon Sep 17 00:00:00 2001
From: John Reiser <jreiser@BitWagon.com>
Date: Mon, 29 Aug 2011 14:46:25 -0700
Subject: [PATCH] instmods: sanity for _mpargs
---
dracut-functions | 11 +++++++----
1 files changed, 7 insertions(+), 4 deletions(-)
diff --git a/dracut-functions b/dracut-functions
index 556d309..6c16cae 100755
--- a/dracut-functions
+++ b/dracut-functions
@@ -892,17 +892,20 @@ instmods() {
# This introduces 2 incompatible meanings for =* arguments
# to instmods. We need to decide which one to keep.
if [[ $_mod = =ata && -f $srcmods/modules.block ]]; then
- ( echo -n "$_mpargs"; egrep 'ata|ahci' "${srcmods}/modules.block" ) \
+ ( [[ "$_mpargs" ]] && echo $_mpargs
+ egrep 'ata|ahci' "${srcmods}/modules.block" ) \
| instmods
elif [ -f $srcmods/modules.${_mod#=} ]; then
- ( echo -n "$_mpargs"; cat "${srcmods}/modules.${_mod#=}" ) \
+ ( [[ "$_mpargs" ]] && echo $_mpargs
+ cat "${srcmods}/modules.${_mod#=}" ) \
| instmods
else
- ( echo -n "$_mpargs"; find "$srcmods" -path "*/${_mod#=}/*" ) \
+ ( [[ "$_mpargs" ]] && echo $_mpargs
+ find "$srcmods" -path "*/${_mod#=}/*" ) \
| instmods
fi
;;
- --*) _mpargs+="${_mod##*/}"$'\n' ;; # one _mod per line; lops '--'
+ --*) _mpargs+=" $_mod" ;;
i2o_scsi) return ;; # Do not load this diagnostic-only module
*) _mod=${_mod##*/}

View File

@ -0,0 +1,67 @@
From f9708da22345aa11bfa0d5514eefef11f542526b Mon Sep 17 00:00:00 2001
From: John Reiser <jreiser@BitWagon.com>
Date: Mon, 29 Aug 2011 16:03:35 -0700
Subject: [PATCH] instmods: factor out egrep of "FATAL: Module .* not found"
---
dracut-functions | 34 +++++++++++++++++++---------------
1 files changed, 19 insertions(+), 15 deletions(-)
diff --git a/dracut-functions b/dracut-functions
index 6c16cae..507f0c3 100755
--- a/dracut-functions
+++ b/dracut-functions
@@ -820,7 +820,7 @@ install_kmod_with_fw() {
for_each_kmod_dep() {
local _func=$1 _kmod=$2 _cmd _modpath _options _found=0
shift 2
- modprobe "$@" --ignore-install --show-depends $_kmod 2>"$initdir/modprobe.err" | (
+ modprobe "$@" --ignore-install --show-depends $_kmod 2>&$modprobe_stderr | (
while read _cmd _modpath _options; do
[[ $_cmd = insmod ]] || continue
$_func ${_modpath} || exit $?
@@ -829,9 +829,6 @@ for_each_kmod_dep() {
[[ $_found -eq 0 ]] && exit 1
exit 0
)
- egrep -v 'FATAL: Module .* not found.' "$initdir/modprobe.err" | derror
- rm -f "$initdir/modprobe.err"
- return $?
}
# filter kernel modules to install certain modules that meet specific
@@ -934,16 +931,23 @@ instmods() {
esac
}
- local _mpargs _ret=0
- if (($# == 0)); then # filenames from stdin
- local _mod
- while read _mod; do
- inst1mod "${_mod%.ko*}"
+ function instmods_1() {
+ local _ret=0 _mod _mpargs
+ if (($# == 0)); then # filenames from stdin
+ while read _mod; do
+ inst1mod "${_mod%.ko*}"
+ done
+ fi
+ while (($# > 0)); do # filenames as arguments
+ inst1mod ${1%.ko*}
+ shift
done
- fi
- while (($# > 0)); do # filenames as args
- inst1mod ${1%.ko*}
- shift
- done
- return $_ret
+ return $_ret
+ }
+
+ # Capture all stderr from modprobe onto a new fd $modprobe_stderr,
+ # and pipe it into egrep. See REDIRECTION in bash manpage.
+ ( instmods_1 "$@" ) {modprobe_stderr}>&1 \
+ | egrep -v 'FATAL: Module .* not found.' | derror
+ return $?
}

View File

@ -0,0 +1,23 @@
From dffb93feaf6c179dbe4f854f1266fbe8529dbea9 Mon Sep 17 00:00:00 2001
From: Harald Hoyer <harald@redhat.com>
Date: Thu, 1 Sep 2011 16:01:21 +0200
Subject: [PATCH] 99base/init: do not fail, when importing the original kernel
environment
---
modules.d/99base/init | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/modules.d/99base/init b/modules.d/99base/init
index b666d3e..4cbe342 100755
--- a/modules.d/99base/init
+++ b/modules.d/99base/init
@@ -392,7 +392,7 @@ for i in $(export -p); do
unset "$i";;
esac
done
-. /tmp/export.orig
+. /tmp/export.orig 2>/dev/null || :
rm -f /tmp/export.orig
initargs=""

View File

@ -0,0 +1,36 @@
From 59f288ce631a7793755d16ee26fef0355098d33a Mon Sep 17 00:00:00 2001
From: Harald Hoyer <harald@redhat.com>
Date: Fri, 2 Sep 2011 09:01:47 +0200
Subject: [PATCH] dracut: cp with sparse
---
dracut | 2 +-
dracut-functions | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/dracut b/dracut
index fd36805..0e930c7 100755
--- a/dracut
+++ b/dracut
@@ -650,7 +650,7 @@ if strstr "$modules_loaded" " fips " && command -v prelink >/dev/null; then
done
fi
-if ! ( cd "$initdir"; find . |cpio -R 0:0 -H newc -o --quiet | \
+if ! ( cd "$initdir"; find . |cpio -R 0:0 -H newc -o --quiet| \
$compress > "$outfile"; ); then
dfatal "dracut: creation of $outfile failed"
exit 1
diff --git a/dracut-functions b/dracut-functions
index 507f0c3..b11e37c 100755
--- a/dracut-functions
+++ b/dracut-functions
@@ -317,7 +317,7 @@ inst_simple() {
inst "${_src%/*}/.${_src##*/}.hmac" "${target%/*}/.${target##*/}.hmac"
fi
ddebug "Installing $_src"
- cp -pfL "$_src" "${initdir}$target"
+ cp --sparse=always -pfL "$_src" "${initdir}$target"
}
# find symlinks linked to given library file

View File

@ -0,0 +1,29 @@
From 86880b8ff70993d9a2357892b4ad5f8345b5f798 Mon Sep 17 00:00:00 2001
From: Harald Hoyer <harald@redhat.com>
Date: Fri, 2 Sep 2011 09:01:05 +0200
Subject: [PATCH] 99base/init: removed cdrom polling reset code
This is done globally now.
---
modules.d/99base/init | 8 --------
1 files changed, 0 insertions(+), 8 deletions(-)
diff --git a/modules.d/99base/init b/modules.d/99base/init
index 4cbe342..fe7694a 100755
--- a/modules.d/99base/init
+++ b/modules.d/99base/init
@@ -281,14 +281,6 @@ unset queuetriggered
unset main_loop
unset RDRETRY
-# reset cdrom polling
-for cdrom in /sys/block/sr*; do
- [ -e "$cdrom" ] || continue
- if [ -e "$cdrom"/events_poll_msecs ]; then
- echo -1 > "$cdrom"/events_poll_msecs
- fi
-done
-
# pre-mount happens before we try to mount the root filesystem,
# and happens once.
getarg 'rd.break=pre-mount' 'rdbreak=pre-mount' && emergency_shell -n pre-mount "Break pre-mount"

View File

@ -0,0 +1,27 @@
From 380b8b516e719e32f766ad78c88009bc589126ec Mon Sep 17 00:00:00 2001
From: Harald Hoyer <harald@redhat.com>
Date: Fri, 2 Sep 2011 19:01:16 +0200
Subject: [PATCH] dmsquash-live-root: use blkid to determine fstype of images
prevents:
dracut: FATAL: cannot mount live image (unknown filesystem type)
https://bugzilla.redhat.com/show_bug.cgi?id=735199
---
modules.d/90dmsquash-live/dmsquash-live-root | 4 +---
1 files changed, 1 insertions(+), 3 deletions(-)
diff --git a/modules.d/90dmsquash-live/dmsquash-live-root b/modules.d/90dmsquash-live/dmsquash-live-root
index 90e633c..2b6c0e2 100755
--- a/modules.d/90dmsquash-live/dmsquash-live-root
+++ b/modules.d/90dmsquash-live/dmsquash-live-root
@@ -45,9 +45,7 @@ fi
# determine filesystem type for a filesystem image
det_img_fs() {
- local _img="$1" _loop=$(losetup -f) _fs
- losetup $_loop $_img; _fs=$(det_fs $_loop); losetup -d $_loop
- echo $_fs
+ blkid -s TYPE -u noraid -o value "$1"
}
for arg in $CMDLINE; do case $arg in ro|rw) liverw=$arg ;; esac; done

View File

@ -0,0 +1,31 @@
From baa5c1136310b47ca2ca91eb377fa058dd2793c7 Mon Sep 17 00:00:00 2001
From: Harald Hoyer <harald@redhat.com>
Date: Fri, 2 Sep 2011 19:16:17 +0200
Subject: [PATCH] dmsquash-live-root: load filesystem modules before mounting
loop images
might prevent https://bugzilla.redhat.com/show_bug.cgi?id=735199
---
modules.d/90dmsquash-live/dmsquash-live-root | 6 ++++--
1 files changed, 4 insertions(+), 2 deletions(-)
diff --git a/modules.d/90dmsquash-live/dmsquash-live-root b/modules.d/90dmsquash-live/dmsquash-live-root
index 2b6c0e2..b704139 100755
--- a/modules.d/90dmsquash-live/dmsquash-live-root
+++ b/modules.d/90dmsquash-live/dmsquash-live-root
@@ -54,11 +54,13 @@ mkdir -m 0755 -p /run/initramfs/live
if [ -f $livedev ]; then
# no mount needed - we've already got the LiveOS image in initramfs
# check filesystem type and handle accordingly
- case `det_img_fs $livedev` in
- squashfs) SQUASHED=$livedev ;;
+ fstype=$(det_img_fs $livedev)
+ case $fstype in
+ squashfs) SQUASHED=$livedev;;
auto) die "cannot mount live image (unknown filesystem type)" ;;
*) FSIMG=$livedev ;;
esac
+ [ -e /sys/fs/$fstype ] || modprobe $fstype
else
mount -n -t $fstype -o ${liverw:-ro} $livedev /run/initramfs/live
if [ "$?" != "0" ]; then

View File

@ -0,0 +1,27 @@
From e41e5b78c6ff62797e1da5655d6acd101ddf2ab3 Mon Sep 17 00:00:00 2001
From: Harald Hoyer <harald@redhat.com>
Date: Mon, 19 Sep 2011 12:20:11 +0200
Subject: [PATCH] 90dmsquash-live: do not symlink to /dev/live
/dev/live should not be used anyway
---
.../90dmsquash-live/dmsquash-live-genrules.sh | 6 ------
1 files changed, 0 insertions(+), 6 deletions(-)
diff --git a/modules.d/90dmsquash-live/dmsquash-live-genrules.sh b/modules.d/90dmsquash-live/dmsquash-live-genrules.sh
index ce1ca82..d6d0aa3 100755
--- a/modules.d/90dmsquash-live/dmsquash-live-genrules.sh
+++ b/modules.d/90dmsquash-live/dmsquash-live-genrules.sh
@@ -4,12 +4,6 @@
case "$root" in
live:/dev/*)
{
- printf 'KERNEL=="%s", SYMLINK+="live"\n' \
- ${root#live:/dev/}
- printf 'SYMLINK=="%s", SYMLINK+="live"\n' \
- ${root#live:/dev/}
- } >> $UDEVRULESD/99-live-mount.rules
- {
printf 'KERNEL=="%s", RUN+="/sbin/initqueue --settled --onetime --unique /sbin/dmsquash-live-root $env{DEVNAME}"\n' \
${root#live:/dev/}
printf 'SYMLINK=="%s", RUN+="/sbin/initqueue --settled --onetime --unique /sbin/dmsquash-live-root $env{DEVNAME}"\n' \

View File

@ -0,0 +1,24 @@
From 6d82a0470e7e340eb0353ecc3c524ded2e286e18 Mon Sep 17 00:00:00 2001
From: Harald Hoyer <harald@redhat.com>
Date: Mon, 19 Sep 2011 12:20:55 +0200
Subject: [PATCH] 99base/init: remove /dev/root helper symlink
Any tool relying on /dev/root has to be fixed.
---
modules.d/99base/init | 3 +++
1 files changed, 3 insertions(+), 0 deletions(-)
diff --git a/modules.d/99base/init b/modules.d/99base/init
index fe7694a..4f59818 100755
--- a/modules.d/99base/init
+++ b/modules.d/99base/init
@@ -434,6 +434,9 @@ fi
wait_for_loginit
+# remove helper symlink
+[ -h /dev/root ] && rm -f /dev/root
+
getarg rd.break rdbreak && emergency_shell -n switch_root "Break before switch_root"
info "Switching root"

View File

@ -0,0 +1,54 @@
From ca8d4e8933e6124c2a0cf0e37f0296b80976ab33 Mon Sep 17 00:00:00 2001
From: Harald Hoyer <harald@redhat.com>
Date: Mon, 19 Sep 2011 12:21:51 +0200
Subject: [PATCH] Do not use /run/udev/rules.d for udev rules
for rules, which should not be called in the real root.
Stale rules can cause this:
https://bugzilla.redhat.com/show_bug.cgi?id=734096
---
.../90dmsquash-live/dmsquash-live-genrules.sh | 2 +-
modules.d/95resume/resume-genrules.sh | 2 +-
modules.d/95rootfs-block/block-genrules.sh | 2 +-
3 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/modules.d/90dmsquash-live/dmsquash-live-genrules.sh b/modules.d/90dmsquash-live/dmsquash-live-genrules.sh
index d6d0aa3..aa0654b 100755
--- a/modules.d/90dmsquash-live/dmsquash-live-genrules.sh
+++ b/modules.d/90dmsquash-live/dmsquash-live-genrules.sh
@@ -8,7 +8,7 @@ case "$root" in
${root#live:/dev/}
printf 'SYMLINK=="%s", RUN+="/sbin/initqueue --settled --onetime --unique /sbin/dmsquash-live-root $env{DEVNAME}"\n' \
${root#live:/dev/}
- } >> $UDEVRULESD/99-live-squash.rules
+ } >> /etc/udev/rules.d/99-live-squash.rules
echo '[ -e /dev/root ]' > $hookdir/initqueue/finished/dmsquash.sh
;;
live:*)
diff --git a/modules.d/95resume/resume-genrules.sh b/modules.d/95resume/resume-genrules.sh
index 06b9544..e1afc26 100755
--- a/modules.d/95resume/resume-genrules.sh
+++ b/modules.d/95resume/resume-genrules.sh
@@ -17,7 +17,7 @@ if [ -n "$resume" ]; then
${resume#/dev/};
printf "SYMLINK==\"%s\", ACTION==\"add|change\", SYMLINK+=\"/dev/resume\"\n" \
${resume#/dev/};
- } >> $UDEVRULESD/99-resume-link.rules
+ } >> /etc/udev/rules.d/99-resume-link.rules
{
if [ -x /usr/sbin/resume ]; then
diff --git a/modules.d/95rootfs-block/block-genrules.sh b/modules.d/95rootfs-block/block-genrules.sh
index 4a50aac..a2310a0 100755
--- a/modules.d/95rootfs-block/block-genrules.sh
+++ b/modules.d/95rootfs-block/block-genrules.sh
@@ -8,7 +8,7 @@ if [ "${root%%:*}" = "block" ]; then
${root#block:/dev/}
printf 'SYMLINK=="%s", SYMLINK+="root"\n' \
${root#block:/dev/}
- } >> $UDEVRULESD/99-root.rules
+ } >> /etc/udev/rules.d/99-root.rules
printf '[ -e "%s" ] && { ln -s "%s" /dev/root 2>/dev/null; rm "$job"; }\n' \
"${root#block:}" "${root#block:}" > $hookdir/initqueue/settled/blocksymlink.sh

View File

@ -0,0 +1,23 @@
From d63fdc1198cd13ed68e7f08acd7ca164c9f35262 Mon Sep 17 00:00:00 2001
From: Harald Hoyer <harald@redhat.com>
Date: Tue, 20 Sep 2011 10:10:29 +0200
Subject: [PATCH] 99base/init: mount securityfs with source "securityfs"
instead of dest
---
modules.d/99base/init | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/modules.d/99base/init b/modules.d/99base/init
index 4f59818..fa808ca 100755
--- a/modules.d/99base/init
+++ b/modules.d/99base/init
@@ -89,7 +89,7 @@ RD_DEBUG=""
SECURITYFSDIR="/sys/kernel/security"
export SECURITYFSDIR
if ! ismounted "${SECURITYFSDIR}"; then
- mount -t securityfs -o nosuid,noexec,nodev ${SECURITYFSDIR} ${SECURITYFSDIR} >/dev/null 2>&1
+ mount -t securityfs -o nosuid,noexec,nodev securityfs ${SECURITYFSDIR} >/dev/null 2>&1
fi
if [ -x /lib/systemd/systemd-timestamp ]; then

View File

@ -0,0 +1,81 @@
From 16457c869d3fac6a94e204f1edac1ad9fffae55a Mon Sep 17 00:00:00 2001
From: Harald Hoyer <harald@redhat.com>
Date: Tue, 20 Sep 2011 11:16:53 +0200
Subject: [PATCH] mount securityfs in a seperate dracut module
---
modules.d/96securityfs/module-setup.sh | 15 +++++++++++++++
modules.d/96securityfs/securityfs.sh | 10 ++++++++++
modules.d/98integrity/module-setup.sh | 2 +-
modules.d/99base/init | 6 ------
4 files changed, 26 insertions(+), 7 deletions(-)
create mode 100755 modules.d/96securityfs/module-setup.sh
create mode 100755 modules.d/96securityfs/securityfs.sh
diff --git a/modules.d/96securityfs/module-setup.sh b/modules.d/96securityfs/module-setup.sh
new file mode 100755
index 0000000..fbe3aa3
--- /dev/null
+++ b/modules.d/96securityfs/module-setup.sh
@@ -0,0 +1,15 @@
+#!/bin/bash
+# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
+# ex: ts=8 sw=4 sts=4 et filetype=sh
+
+check() {
+ return 255
+}
+
+depends() {
+ return 0
+}
+
+install() {
+ inst_hook cmdline 60 "$moddir/securityfs.sh"
+}
diff --git a/modules.d/96securityfs/securityfs.sh b/modules.d/96securityfs/securityfs.sh
new file mode 100755
index 0000000..03ee4dd
--- /dev/null
+++ b/modules.d/96securityfs/securityfs.sh
@@ -0,0 +1,10 @@
+#!/bin/sh
+# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
+# ex: ts=8 sw=4 sts=4 et filetype=sh
+
+SECURITYFSDIR="/sys/kernel/security"
+export SECURITYFSDIR
+
+if ! ismounted "${SECURITYFSDIR}"; then
+ mount -t securityfs -o nosuid,noexec,nodev securityfs ${SECURITYFSDIR} >/dev/null 2>&1
+fi
diff --git a/modules.d/98integrity/module-setup.sh b/modules.d/98integrity/module-setup.sh
index cab9027..7d5771c 100755
--- a/modules.d/98integrity/module-setup.sh
+++ b/modules.d/98integrity/module-setup.sh
@@ -7,7 +7,7 @@ check() {
}
depends() {
- echo masterkey
+ echo masterkey securityfs
return 0
}
diff --git a/modules.d/99base/init b/modules.d/99base/init
index fa808ca..06d61a8 100755
--- a/modules.d/99base/init
+++ b/modules.d/99base/init
@@ -86,12 +86,6 @@ RD_DEBUG=""
[ ! -d /sys/kernel ] && \
mount -t sysfs -o nosuid,noexec,nodev sysfs /sys >/dev/null 2>&1
-SECURITYFSDIR="/sys/kernel/security"
-export SECURITYFSDIR
-if ! ismounted "${SECURITYFSDIR}"; then
- mount -t securityfs -o nosuid,noexec,nodev securityfs ${SECURITYFSDIR} >/dev/null 2>&1
-fi
-
if [ -x /lib/systemd/systemd-timestamp ]; then
RD_TIMESTAMP=$(/lib/systemd/systemd-timestamp)
else

View File

@ -0,0 +1,21 @@
From 6d385c7111c81fe730c1823b232d19e8d42f50d4 Mon Sep 17 00:00:00 2001
From: Harald Hoyer <harald@redhat.com>
Date: Tue, 20 Sep 2011 11:16:53 +0200
Subject: [PATCH] mount securityfs in a seperate dracut module
---
dracut.spec | 1 +
1 files changed, 1 insertions(+), 0 deletions(-)
diff --git a/dracut.spec b/dracut.spec
index 76f4fe1..f9848ed 100644
--- a/dracut.spec
+++ b/dracut.spec
@@ -247,6 +247,7 @@ rm -rf $RPM_BUILD_ROOT
%{_datadir}/dracut/modules.d/95zfcp
%{_datadir}/dracut/modules.d/95terminfo
%{_datadir}/dracut/modules.d/95udev-rules
+%{_datadir}/dracut/modules.d/96securityfs
%{_datadir}/dracut/modules.d/97biosdevname
%{_datadir}/dracut/modules.d/97masterkey
%{_datadir}/dracut/modules.d/98ecryptfs

View File

@ -0,0 +1,37 @@
From e3e5128cf20660c0789f9b4e2285dbc1f35f6799 Mon Sep 17 00:00:00 2001
From: Michal Soltys <soltys@ziu.info>
Date: Tue, 6 Sep 2011 00:17:23 +0200
Subject: [PATCH] 90mdraid: adjust stock mdadm udev rules
Currently shipped mdadm rules incrementally assemble all imsm and native
raids, and do so unconditionally. This causes few issues:
- fine-grained controls in 65-md* are shadowed - for example,
mdadm.conf's presence tests or uuid checks
- 90dmraid might also conflict with 90mdraid, if user prefers the former
to handle containers
- possibly other subtle issues
This patch adjusts the behaviour.
Signed-off-by: Michal Soltys <soltys@ziu.info>
---
modules.d/90mdraid/module-setup.sh | 5 +++++
1 files changed, 5 insertions(+), 0 deletions(-)
diff --git a/modules.d/90mdraid/module-setup.sh b/modules.d/90mdraid/module-setup.sh
index de7785d..91a0769 100755
--- a/modules.d/90mdraid/module-setup.sh
+++ b/modules.d/90mdraid/module-setup.sh
@@ -50,6 +50,11 @@ install() {
if [ ! -x /lib/udev/vol_id ]; then
inst_rules 64-md-raid.rules
+ # remove incremental assembly from stock rules, so they don't shadow
+ # 65-md-inc*.rules and its fine-grained controls, or cause other problems
+ # when we explicitly don't want certain components to be incrementally
+ # assembled
+ sed -i -e '/^ENV{ID_FS_TYPE}==.*ACTION=="add".*RUN+="\/sbin\/mdadm --incremental $env{DEVNAME}"$/d' "${initdir}/lib/udev/rules.d/64-md-raid.rules"
fi
inst_rules "$moddir/65-md-incremental-imsm.rules"

View File

@ -0,0 +1,91 @@
From 5f6a71b38af7550d11c790abd5ca0bd0cf7b7f05 Mon Sep 17 00:00:00 2001
From: Michal Soltys <soltys@ziu.info>
Date: Tue, 6 Sep 2011 00:17:25 +0200
Subject: [PATCH] 90mdraid: containers are not runnable
Remove whole "start a container logic".
Containers once assembled, always remain in 'inactive' state.
Any attempt to run a container with mdadm -IR is a no-op, and any
attempt with just mdadm -R ends with an error.
Signed-off-by: Michal Soltys <soltys@ziu.info>
---
modules.d/90mdraid/65-md-incremental-imsm.rules | 20 --------------------
modules.d/90mdraid/md_finished.sh | 2 +-
modules.d/90mdraid/mdcontainer_start.sh | 12 ------------
modules.d/90mdraid/module-setup.sh | 1 -
4 files changed, 1 insertions(+), 34 deletions(-)
delete mode 100755 modules.d/90mdraid/mdcontainer_start.sh
diff --git a/modules.d/90mdraid/65-md-incremental-imsm.rules b/modules.d/90mdraid/65-md-incremental-imsm.rules
index 7c1d503..5e94a57 100644
--- a/modules.d/90mdraid/65-md-incremental-imsm.rules
+++ b/modules.d/90mdraid/65-md-incremental-imsm.rules
@@ -66,23 +66,3 @@ RUN+="/sbin/initqueue --finished --unique --name md_finished /sbin/md_finished.s
RUN+="/sbin/initqueue --timeout --onetime --unique /sbin/mdraid_start"
LABEL="end_raidstart"
-
-#
-# Handle container raid arrays
-#
-ACTION=="add|change", \
- KERNEL=="md[0-9]*|md/*", \
- ENV{DEVTYPE}!="partition", \
- ENV{MD_LEVEL}=="container", \
- ENV{rd_MDADMCONF}!="?*", \
- ENV{rd_NO_MD}!="?*", \
- GOTO="do_container"
-
-GOTO="end_container"
-
-LABEL="do_container"
-
-RUN+="/sbin/initqueue --finished --unique --name md_finished /sbin/md_finished.sh"
-RUN+="/sbin/initqueue --timeout --onetime --unique --name mdcontainer_start-%k /sbin/mdcontainer_start $env{DEVNAME}"
-
-LABEL="end_container"
diff --git a/modules.d/90mdraid/md_finished.sh b/modules.d/90mdraid/md_finished.sh
index cde0966..ce355be 100755
--- a/modules.d/90mdraid/md_finished.sh
+++ b/modules.d/90mdraid/md_finished.sh
@@ -1,7 +1,7 @@
#!/bin/sh
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
# ex: ts=8 sw=4 sts=4 et filetype=sh
-for f in $hookdir/initqueue/settled/mdcontainer_start* $hookdir/initqueue/settled/mdraid_start* $hookdir/initqueue/settled/mdadm_auto*; do
+for f in $hookdir/initqueue/settled/mdraid_start* $hookdir/initqueue/settled/mdadm_auto*; do
[ -e $f ] && exit 1
done
diff --git a/modules.d/90mdraid/mdcontainer_start.sh b/modules.d/90mdraid/mdcontainer_start.sh
deleted file mode 100755
index e7dd3ef..0000000
--- a/modules.d/90mdraid/mdcontainer_start.sh
+++ /dev/null
@@ -1,12 +0,0 @@
-#!/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
-
-md=$1
-udevadm control --stop-exec-queue
-# and activate any containers
-mdadm -IR $md 2>&1 | vinfo
-ln -s $(command -v mdraid-cleanup) $hookdir/pre-pivot/30-mdraid-cleanup.sh 2>/dev/null
-ln -s $(command -v mdraid-cleanup) $hookdir/pre-pivot/31-mdraid-cleanup.sh 2>/dev/null
-udevadm control --start-exec-queue
diff --git a/modules.d/90mdraid/module-setup.sh b/modules.d/90mdraid/module-setup.sh
index 91a0769..2dba8cb 100755
--- a/modules.d/90mdraid/module-setup.sh
+++ b/modules.d/90mdraid/module-setup.sh
@@ -77,7 +77,6 @@ install() {
inst_hook pre-udev 30 "$moddir/mdmon-pre-udev.sh"
inst "$moddir/mdraid_start.sh" /sbin/mdraid_start
- inst "$moddir/mdcontainer_start.sh" /sbin/mdcontainer_start
inst "$moddir/mdadm_auto.sh" /sbin/mdadm_auto
inst "$moddir/md_finished.sh" /sbin/md_finished.sh
inst_hook pre-trigger 30 "$moddir/parse-md.sh"

View File

@ -0,0 +1,66 @@
From 9383421c1cfc5fe1bc94cf3d3194bd96ee503628 Mon Sep 17 00:00:00 2001
From: Michal Soltys <soltys@ziu.info>
Date: Tue, 6 Sep 2011 00:17:26 +0200
Subject: [PATCH] 90mdraid: fix/adjust mdraid-cleanup
Stop both arrays (first pass) and containers (second pass).
Loop only over /dev/md[0-9]*
Call cleanup script only once, make sure it's after crypt cleanup.
Signed-off-by: Michal Soltys <soltys@ziu.info>
---
modules.d/90mdraid/mdraid-cleanup.sh | 30 +++++++++++++++++-------------
modules.d/90mdraid/mdraid_start.sh | 1 -
2 files changed, 17 insertions(+), 14 deletions(-)
diff --git a/modules.d/90mdraid/mdraid-cleanup.sh b/modules.d/90mdraid/mdraid-cleanup.sh
index add02e0..8fc54e2 100755
--- a/modules.d/90mdraid/mdraid-cleanup.sh
+++ b/modules.d/90mdraid/mdraid-cleanup.sh
@@ -2,18 +2,22 @@
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
# ex: ts=8 sw=4 sts=4 et filetype=sh
-# stop everything which is not busy
-for i in /dev/md* /dev/md/*; do
- [ -b $i ] || continue
+type getarg >/dev/null 2>&1 || . /lib/dracut-lib.sh
- mddetail=$(udevadm info --query=property --name=$i)
- case "$mddetail" in
- *MD_LEVEL=container*)
- ;;
- *DEVTYPE=partition*)
- ;;
- *)
- mdadm --stop $i >/dev/null 2>&1
- ;;
- esac
+containers=""
+for md in /dev/md[0-9]*; do
+ [ -b "$md" ] || continue
+ udevinfo="$(udevadm info --query=env --name=$md)"
+ strstr "$udevinfo" "DEVTYPE=partition" && continue
+ if strstr "$udevinfo" "MD_LEVEL=container"; then
+ containers="$containers $md"
+ continue
+ fi
+ mdadm -S "$md" >/dev/null 2>&1
done
+
+for md in $containers; do
+ mdadm -S "$md" >/dev/null 2>&1
+done
+
+unset containers udevinfo
diff --git a/modules.d/90mdraid/mdraid_start.sh b/modules.d/90mdraid/mdraid_start.sh
index 4aa7f82..4c0255e 100755
--- a/modules.d/90mdraid/mdraid_start.sh
+++ b/modules.d/90mdraid/mdraid_start.sh
@@ -21,6 +21,5 @@ for md in /dev/md[0-9]* /dev/md/*; do
done
unset udevinfo
-ln -s $(command -v mdraid-cleanup) $hookdir/pre-pivot/30-mdraid-cleanup.sh 2>/dev/null
ln -s $(command -v mdraid-cleanup) $hookdir/pre-pivot/31-mdraid-cleanup.sh 2>/dev/null
udevadm control --start-exec-queue

View File

@ -0,0 +1,136 @@
From 66426469d024b7760f59051af287e11ec6a94c1f Mon Sep 17 00:00:00 2001
From: Michal Soltys <soltys@ziu.info>
Date: Tue, 6 Sep 2011 00:17:27 +0200
Subject: [PATCH] 90mdraid: fix/adjust force-run script
1) mdadm -As --auto=yes --run 2>&1 | vinfo (removed)
Currently such auto assembly will not complete or force-run partially
assembled arrays. It might assemble "concurrent" separate array and
force-run it, if possible (though the chances of suddenly showing
missing components in this scenario - a script run after udev timeout -
are pretty thin). See [1] for details. Also see #3 below.
2) mdadm -Is --run 2>&1 (removed)
This will only force-run native arrays - arrays in containers will not
be affected. See [1] for details. Also see #3 below.
3) mdadm -R run loop (implicitly handles #1 & #2)
This loop does everywthing that #1 & #2 are expected to do. Thus, the
above invocations are simply redundant and this is the most safe and
flexible option.
Also, it shouldn't be necessary to go under md/ directory, as those are
just symlinks to /dev/md[0-9]*.
Certain checks were changed to strict ones (array state, degraded state)
instead of relying on env tricks.
'cat' was added explicitly to installed programs (it has been used
implicitly in shutdown script either way)
4) mdmon bug
See [1] for details as well. In short - force-run arrays in containers
will not have mdmon started, so we do that manually.
5) stop/run queue magic
Also removed. mdadm -R will only cause change events to the array
itself, and they should not be an issue.
[1] http://article.gmane.org/gmane.linux.raid/35133
Signed-off-by: Michal Soltys <soltys@ziu.info>
---
modules.d/90mdraid/mdraid_start.sh | 51 ++++++++++++++++++++++--------------
modules.d/90mdraid/module-setup.sh | 2 +-
modules.d/90mdraid/parse-md.sh | 1 +
3 files changed, 33 insertions(+), 21 deletions(-)
diff --git a/modules.d/90mdraid/mdraid_start.sh b/modules.d/90mdraid/mdraid_start.sh
index 4c0255e..be5a3ce 100755
--- a/modules.d/90mdraid/mdraid_start.sh
+++ b/modules.d/90mdraid/mdraid_start.sh
@@ -3,23 +3,34 @@
# ex: ts=8 sw=4 sts=4 et filetype=sh
type getarg >/dev/null 2>&1 || . /lib/dracut-lib.sh
-# run mdadm if udev has settled
-info "Assembling MD RAID arrays"
-udevadm control --stop-exec-queue
-mdadm -As --auto=yes --run 2>&1 | vinfo
-mdadm -Is --run 2>&1 | vinfo
-
-# there could still be some leftover devices
-# which have had a container added
-for md in /dev/md[0-9]* /dev/md/*; do
- [ -b "$md" ] || continue
- udevinfo="$(udevadm info --query=env --name=$md)"
- strstr "$udevinfo" "MD_UUID=" && continue
- strstr "$udevinfo" "MD_LEVEL=container" && continue
- strstr "$udevinfo" "DEVTYPE=partition" && continue
- mdadm --run "$md" 2>&1 | vinfo
-done
-unset udevinfo
-
-ln -s $(command -v mdraid-cleanup) $hookdir/pre-pivot/31-mdraid-cleanup.sh 2>/dev/null
-udevadm control --start-exec-queue
+_md_force_run() {
+ local _udevinfo
+ local _path_s
+ local _path_d
+ # try to force-run anything not running yet
+ for md in /dev/md[0-9]*; do
+ [ -b "$md" ] || continue
+ _udevinfo="$(udevadm info --query=env --name="$md")"
+ strstr "$_udevinfo" "MD_LEVEL=container" && continue
+ strstr "$_udevinfo" "DEVTYPE=partition" && continue
+
+ _path_s="$(udevadm info -q path -n "$md")/md/array_state"
+ [ ! -r "$_path_s" ] && continue
+
+ # inactive ?
+ [ "$(cat "$_path_s")" != "inactive" ] && continue
+
+ mdadm -R "$md" 2>&1 | vinfo
+
+ # still inactive ?
+ [ "$(cat "$_path_s")" = "inactive" ] && continue
+
+ _path_d="${_path_s%/*}/degraded"
+ [ ! -r "$_path_d" ] && continue
+
+ # workaround for mdmon bug
+ [ "$(cat "$_path_d")" -gt "0" ] && mdmon --takeover "$md"
+ done
+}
+
+_md_force_run
diff --git a/modules.d/90mdraid/module-setup.sh b/modules.d/90mdraid/module-setup.sh
index 2dba8cb..cfc2a20 100755
--- a/modules.d/90mdraid/module-setup.sh
+++ b/modules.d/90mdraid/module-setup.sh
@@ -37,7 +37,7 @@ installkernel() {
}
install() {
- dracut_install mdadm partx
+ dracut_install mdadm partx cat
# XXX: mdmon really needs to run as non-root?
diff --git a/modules.d/90mdraid/parse-md.sh b/modules.d/90mdraid/parse-md.sh
index 6d1b615..63f3278 100755
--- a/modules.d/90mdraid/parse-md.sh
+++ b/modules.d/90mdraid/parse-md.sh
@@ -34,6 +34,7 @@ fi
if ! getargbool 1 rd.md.conf -n rd_NO_MDADMCONF; then
rm -f /etc/mdadm/mdadm.conf /etc/mdadm.conf
+ ln -s $(command -v mdraid-cleanup) $hookdir/pre-pivot/31-mdraid-cleanup.sh 2>/dev/null
fi
# noiswmd nodmraid for anaconda / rc.sysinit compatibility

View File

@ -0,0 +1,140 @@
From cf5891424ef026eede69606a918dadf5560095fd Mon Sep 17 00:00:00 2001
From: Michal Soltys <soltys@ziu.info>
Date: Tue, 6 Sep 2011 00:17:24 +0200
Subject: [PATCH] 90(md|dm)raid: recognize ddf container
This patch adds ddf support, consistently with imsm/isw options.
Signed-off-by: Michal Soltys <soltys@ziu.info>
---
dracut.kernel.7.xml | 6 ++++++
modules.d/90dmraid/61-dmraid-imsm.rules | 1 +
modules.d/90dmraid/parse-dm.sh | 4 ++++
modules.d/90mdraid/65-md-incremental-imsm.rules | 3 ++-
modules.d/90mdraid/md-noddf.sh | 5 +++++
modules.d/90mdraid/md-noimsm.sh | 2 +-
modules.d/90mdraid/module-setup.sh | 6 +++++-
modules.d/90mdraid/parse-md.sh | 6 ++++++
8 files changed, 30 insertions(+), 3 deletions(-)
create mode 100755 modules.d/90mdraid/md-noddf.sh
diff --git a/dracut.kernel.7.xml b/dracut.kernel.7.xml
index b6e59e6..8d50d94 100644
--- a/dracut.kernel.7.xml
+++ b/dracut.kernel.7.xml
@@ -343,6 +343,12 @@ This parameter can be specified multiple times.</para>
</listitem>
</varlistentry>
<varlistentry>
+ <term><envar>rd.md.ddf</envar>=0</term>
+ <listitem>
+ <para>disable MD RAID for SNIA ddf raids, use DM RAID instead</para>
+ </listitem>
+ </varlistentry>
+ <varlistentry>
<term>
<envar>rd.md.conf</envar>=0
</term>
diff --git a/modules.d/90dmraid/61-dmraid-imsm.rules b/modules.d/90dmraid/61-dmraid-imsm.rules
index d87fce7..73ba58e 100644
--- a/modules.d/90dmraid/61-dmraid-imsm.rules
+++ b/modules.d/90dmraid/61-dmraid-imsm.rules
@@ -10,6 +10,7 @@ ENV{ID_FS_TYPE}=="linux_raid_member", GOTO="dm_end"
ENV{ID_FS_TYPE}!="*_raid_member", , GOTO="dm_end"
ENV{ID_FS_TYPE}=="isw_raid_member", ENV{rd_NO_MDIMSM}!="?*", GOTO="dm_end"
+ENV{ID_FS_TYPE}=="ddf_raid_member", ENV{rd_NO_MDDDF}!="?*", GOTO="dm_end"
ENV{rd_NO_DM}=="?*", GOTO="dm_end"
diff --git a/modules.d/90dmraid/parse-dm.sh b/modules.d/90dmraid/parse-dm.sh
index 059c396..fe38d35 100755
--- a/modules.d/90dmraid/parse-dm.sh
+++ b/modules.d/90dmraid/parse-dm.sh
@@ -12,3 +12,7 @@ if ! command -v mdadm >/dev/null || ! getargbool 1 rd.md.imsm -n rd_NO_MDIMSM |
udevproperty rd_NO_MDIMSM=1
fi
+if ! command -v mdadm >/dev/null || ! getargbool 1 rd.md.ddf -n rd_NO_MDDDF || getarg noddfmd; then
+ info "rd.md.ddf=0: no MD RAID for SNIA ddf raids"
+ udevproperty rd_NO_MDDDF=1
+fi
diff --git a/modules.d/90mdraid/65-md-incremental-imsm.rules b/modules.d/90mdraid/65-md-incremental-imsm.rules
index 5e94a57..bb030cf 100644
--- a/modules.d/90mdraid/65-md-incremental-imsm.rules
+++ b/modules.d/90mdraid/65-md-incremental-imsm.rules
@@ -4,9 +4,10 @@
ACTION!="add|change", GOTO="md_inc_end"
SUBSYSTEM!="block", GOTO="md_inc_end"
-ENV{ID_FS_TYPE}!="linux_raid_member|isw_raid_member", GOTO="md_inc_end"
+ENV{ID_FS_TYPE}!="*_raid_member", GOTO="md_inc_end"
ENV{ID_FS_TYPE}=="isw_raid_member", ENV{rd_NO_MDIMSM}=="?*", GOTO="md_inc_end"
+ENV{ID_FS_TYPE}=="ddf_raid_member", ENV{rd_NO_MDDDF}=="?*", GOTO="md_inc_end"
ENV{rd_NO_MD}=="?*", GOTO="md_inc_end"
diff --git a/modules.d/90mdraid/md-noddf.sh b/modules.d/90mdraid/md-noddf.sh
new file mode 100755
index 0000000..bc46dd7
--- /dev/null
+++ b/modules.d/90mdraid/md-noddf.sh
@@ -0,0 +1,5 @@
+#!/bin/sh
+# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
+# ex: ts=8 sw=4 sts=4 et filetype=sh
+info "rd.md.ddf=0: no MD RAID for SNIA ddf raids"
+udevproperty rd_NO_MDDDF=1
diff --git a/modules.d/90mdraid/md-noimsm.sh b/modules.d/90mdraid/md-noimsm.sh
index bc9cf7f..8272f86 100755
--- a/modules.d/90mdraid/md-noimsm.sh
+++ b/modules.d/90mdraid/md-noimsm.sh
@@ -2,4 +2,4 @@
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
# ex: ts=8 sw=4 sts=4 et filetype=sh
info "rd.md.imsm=0: no MD RAID for imsm/isw raids"
-udevproperty rd_NO_MDIMSM=1
\ No newline at end of file
+udevproperty rd_NO_MDIMSM=1
diff --git a/modules.d/90mdraid/module-setup.sh b/modules.d/90mdraid/module-setup.sh
index cfc2a20..5c526a0 100755
--- a/modules.d/90mdraid/module-setup.sh
+++ b/modules.d/90mdraid/module-setup.sh
@@ -20,7 +20,7 @@ check() {
check_block_and_slaves is_mdraid "$_rootdev" || return 1
else
# root is not on a block device, use the shotgun approach
- blkid | egrep -q '(linux|isw)_raid' || return 1
+ blkid | grep -q '"[^"]*_raid_member"' || return 1
fi
}
@@ -59,9 +59,13 @@ install() {
inst_rules "$moddir/65-md-incremental-imsm.rules"
+ # guard against pre-3.0 mdadm versions, that can't handle containers
if ! mdadm -Q -e imsm /dev/null &> /dev/null; then
inst_hook pre-trigger 30 "$moddir/md-noimsm.sh"
fi
+ if ! mdadm -Q -e ddf /dev/null &> /dev/null; then
+ inst_hook pre-trigger 30 "$moddir/md-noddf.sh"
+ fi
if [[ $hostonly ]] || [[ $mdadmconf = "yes" ]]; then
if [ -f /etc/mdadm.conf ]; then
diff --git a/modules.d/90mdraid/parse-md.sh b/modules.d/90mdraid/parse-md.sh
index 63f3278..33d93dc 100755
--- a/modules.d/90mdraid/parse-md.sh
+++ b/modules.d/90mdraid/parse-md.sh
@@ -43,3 +43,9 @@ if ! getargbool 1 rd.md.imsm -n rd_NO_MDIMSM || getarg noiswmd || getarg nodmrai
info "no MD RAID for imsm/isw raids"
udevproperty rd_NO_MDIMSM=1
fi
+
+# same thing with ddf containers
+if ! getargbool 1 rd.md.ddf -n rd_NO_MDDDF || getarg noddfmd || getarg nodmraid; then
+ info "no MD RAID for SNIA ddf raids"
+ udevproperty rd_NO_MDDDF=1
+fi

View File

@ -0,0 +1,200 @@
From a025cc17f0d8145492ffbb37735deca208e768bd Mon Sep 17 00:00:00 2001
From: Michal Soltys <soltys@ziu.info>
Date: Tue, 6 Sep 2011 00:17:28 +0200
Subject: [PATCH] 90mdraid: fix/adjust 65-md* rules and related scripts
Reworked the flow of the rules file a bit, removed redundant tests, also
should be easier to follow. It's much shorter now as well, a bit more
similar to 90lvm script - both revolve around same concepts after all.
There's no reason to treat conf-assembled arrays differently from
incremental ones. Once we hit timeout in init's udev loop, we can use
common script (mdraid_start.sh) to try force inactive arrays
into degraded mode.
md-finished.sh was kind-of out of place - it didn't really wait for any
particular device(s) to show up, just watched if onetime mdadm scripts
are still in place. Furthermore, after moving mdraid_start to --timeout
initqueue, it didn't really have too much to watch at all, besides
mdadm_auto (and that served no purpose, as we do wait for concrete
devices).
Either way, with stock 64-md fixes, current version of 65-md*.rules does
the following:
- limits assembly to certain uuids, if specified
- watch for no ddf/imsm
- if mdadm.conf => setup onetime -As script, without forced --run option
- if !mdadm.conf => incrementally assemble
- for both cases, setup timeout script, run-forcing arrays as a last resort
Signed-off-by: Michal Soltys <soltys@ziu.info>
---
modules.d/90mdraid/65-md-incremental-imsm.rules | 79 ++++++++---------------
modules.d/90mdraid/md_finished.sh | 9 ---
modules.d/90mdraid/mdadm_auto.sh | 2 +-
modules.d/90mdraid/module-setup.sh | 1 -
modules.d/90mdraid/parse-md.sh | 8 ++-
5 files changed, 34 insertions(+), 65 deletions(-)
delete mode 100755 modules.d/90mdraid/md_finished.sh
diff --git a/modules.d/90mdraid/65-md-incremental-imsm.rules b/modules.d/90mdraid/65-md-incremental-imsm.rules
index bb030cf..209b17b 100644
--- a/modules.d/90mdraid/65-md-incremental-imsm.rules
+++ b/modules.d/90mdraid/65-md-incremental-imsm.rules
@@ -2,68 +2,45 @@
# automatically cause mdadm to be run.
# See udev(8) for syntax
-ACTION!="add|change", GOTO="md_inc_end"
-SUBSYSTEM!="block", GOTO="md_inc_end"
-ENV{ID_FS_TYPE}!="*_raid_member", GOTO="md_inc_end"
-
-ENV{ID_FS_TYPE}=="isw_raid_member", ENV{rd_NO_MDIMSM}=="?*", GOTO="md_inc_end"
-ENV{ID_FS_TYPE}=="ddf_raid_member", ENV{rd_NO_MDDDF}=="?*", GOTO="md_inc_end"
-
-ENV{rd_NO_MD}=="?*", GOTO="md_inc_end"
-
-PROGRAM=="/bin/sh -c 'for i in $sys/$devpath/holders/md[0-9]*; do [ -e $$i ] && exit 0; done; exit 1;' ", \
- GOTO="md_inc_end"
+ACTION!="add|change", GOTO="md_end"
+SUBSYSTEM!="block", GOTO="md_end"
+ENV{rd_NO_MD}=="?*", GOTO="md_end"
+KERNEL=="md*", GOTO="md_end"
+
+ENV{ID_FS_TYPE}!="*_raid_member", GOTO="md_end"
+ENV{ID_FS_TYPE}=="isw_raid_member", ENV{rd_NO_MDIMSM}=="?*", GOTO="md_end"
+ENV{ID_FS_TYPE}=="ddf_raid_member", ENV{rd_NO_MDDDF}=="?*", GOTO="md_end"
+
+# already done ?
+PROGRAM="/bin/sh -c 'for i in $sys/$devpath/holders/md[0-9]*; do [ -e $$i ] && exit 0; done; exit 1;' ", \
+ GOTO="md_end"
+
+# for native arrays - array's uuid has to be specified
+# for containers - container's uuid has to be specified
+# TODO : how to get embedded array's uuid having container's component ?
+#
+# UUID CHECK
ENV{DEVTYPE}!="partition", \
RUN+="/sbin/partx -d --nr 1-1024 $env{DEVNAME}"
-KERNEL!="md*", IMPORT{program}="/sbin/mdadm --examine --export $tempnode"
-
-# UUID CHECK
-
-LABEL="do_md_inc"
+RUN+="/sbin/initqueue --timeout --onetime --unique /sbin/mdraid_start"
+# if rd_MDADMCONF is set, do not assemble incrementally;
+# defer conf-based assembly until the udev queue is settled
#
-# if rd_MDADMCONF do not assemble incrementally
-# defer auto assembly until the udev queue is settled
-#
-ENV{rd_MDADMCONF}!="?*", GOTO="md_auto_end"
+ENV{rd_MDADMCONF}!="?*", GOTO="md_incremental"
-RUN+="/sbin/initqueue --finished --unique --name md_finished /sbin/md_finished.sh"
RUN+="/sbin/initqueue --settled --onetime --unique /sbin/mdadm_auto"
-GOTO="md_inc_end"
-
-LABEL="md_auto_end"
+GOTO="md_end"
#
-# Incrementally build the md array
+# Incrementally build the md array; this will automatically assemble
+# any eventual containers as well (imsm, ddf)
#
-RUN+="/sbin/mdadm -I $env{DEVNAME}"
-
-RUN+="/sbin/initqueue --finished --unique --name md_finished /sbin/md_finished.sh"
-
-LABEL="md_inc_end"
-
-#
-# Handle non-container raid arrays
-#
-ACTION=="add|change", \
- KERNEL=="md[0-9]*|md/*", \
- ENV{MD_LEVEL}!="container", \
- ENV{MD_CONTAINER}!="?*", \
- ENV{rd_MDADMCONF}!="?*", \
- ENV{rd_NO_MD}!="?*", \
- GOTO="do_raidstart"
+LABEL="md_incremental"
-GOTO="end_raidstart"
-
-LABEL="do_raidstart"
-
-# check if array is not inactive anymore
-TEST=="md/array_state", ATTR{md/array_state}!="|inactive", GOTO="end_raidstart"
-
-RUN+="/sbin/initqueue --finished --unique --name md_finished /sbin/md_finished.sh"
-RUN+="/sbin/initqueue --timeout --onetime --unique /sbin/mdraid_start"
+RUN+="/sbin/mdadm -I $env{DEVNAME}"
-LABEL="end_raidstart"
+LABEL="md_end"
diff --git a/modules.d/90mdraid/md_finished.sh b/modules.d/90mdraid/md_finished.sh
deleted file mode 100755
index ce355be..0000000
--- a/modules.d/90mdraid/md_finished.sh
+++ /dev/null
@@ -1,9 +0,0 @@
-#!/bin/sh
-# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
-# ex: ts=8 sw=4 sts=4 et filetype=sh
-for f in $hookdir/initqueue/settled/mdraid_start* $hookdir/initqueue/settled/mdadm_auto*; do
- [ -e $f ] && exit 1
-done
-
-$UDEV_QUEUE_EMPTY >/dev/null 2>&1 || exit 1
-exit 0
diff --git a/modules.d/90mdraid/mdadm_auto.sh b/modules.d/90mdraid/mdadm_auto.sh
index 915fb28..9b61bf5 100755
--- a/modules.d/90mdraid/mdadm_auto.sh
+++ b/modules.d/90mdraid/mdadm_auto.sh
@@ -4,4 +4,4 @@
type getarg >/dev/null 2>&1 || . /lib/dracut-lib.sh
info "Autoassembling MD Raid"
-mdadm -As --auto=yes --run 2>&1 | vinfo
+mdadm -As --auto=yes 2>&1 | vinfo
diff --git a/modules.d/90mdraid/module-setup.sh b/modules.d/90mdraid/module-setup.sh
index 5c526a0..12e6739 100755
--- a/modules.d/90mdraid/module-setup.sh
+++ b/modules.d/90mdraid/module-setup.sh
@@ -82,7 +82,6 @@ install() {
inst "$moddir/mdraid_start.sh" /sbin/mdraid_start
inst "$moddir/mdadm_auto.sh" /sbin/mdadm_auto
- inst "$moddir/md_finished.sh" /sbin/md_finished.sh
inst_hook pre-trigger 30 "$moddir/parse-md.sh"
inst "$moddir/mdraid-cleanup.sh" /sbin/mdraid-cleanup
inst_hook shutdown 30 "$moddir/md-shutdown.sh"
diff --git a/modules.d/90mdraid/parse-md.sh b/modules.d/90mdraid/parse-md.sh
index 33d93dc..b85a3a3 100755
--- a/modules.d/90mdraid/parse-md.sh
+++ b/modules.d/90mdraid/parse-md.sh
@@ -13,12 +13,14 @@ else
[ -e "$f" ] || continue
while read line; do
if [ "${line%%UUID CHECK}" != "$line" ]; then
+ printf 'IMPORT{program}="/sbin/mdadm --examine --export $tempnode"\n'
for uuid in $MD_UUID; do
- printf 'ENV{MD_UUID}=="%s", GOTO="do_md_inc"\n' $uuid
+ printf 'ENV{MD_UUID}=="%s", GOTO="md_uuid_ok"\n' $uuid
done;
- printf 'GOTO="md_inc_end"\n';
+ printf 'GOTO="md_end"\n'
+ printf 'LABEL="md_uuid_ok"\n'
else
- echo $line;
+ echo "$line"
fi
done < "${f}" > "${f}.new"
mv "${f}.new" "$f"

View File

@ -0,0 +1,58 @@
From 75e8f476e7bf33e2759b5a05b9d10f8befc4eedd Mon Sep 17 00:00:00 2001
From: Harald Hoyer <harald@redhat.com>
Date: Thu, 22 Sep 2011 12:56:31 +0200
Subject: [PATCH] TEST-40-NBD: relaxed check on ext3 filesystem options
onerror=continue does not seem to be displayed for new kernels
---
test/TEST-40-NBD/client-init | 1 +
test/TEST-40-NBD/create-root.sh | 1 +
test/TEST-40-NBD/test.sh | 4 ++--
3 files changed, 4 insertions(+), 2 deletions(-)
diff --git a/test/TEST-40-NBD/client-init b/test/TEST-40-NBD/client-init
index 22dacd9..eb65b76 100755
--- a/test/TEST-40-NBD/client-init
+++ b/test/TEST-40-NBD/client-init
@@ -5,6 +5,7 @@ while read dev fs fstype opts rest; do
[ "$dev" = "rootfs" ] && continue
[ "$fs" != "/" ] && continue
echo "nbd-OK $fstype $opts" >/dev/sda
+ echo "nbd-OK $fstype $opts"
break
done < /proc/mounts
export TERM=linux
diff --git a/test/TEST-40-NBD/create-root.sh b/test/TEST-40-NBD/create-root.sh
index bd866e4..4bef5f1 100755
--- a/test/TEST-40-NBD/create-root.sh
+++ b/test/TEST-40-NBD/create-root.sh
@@ -14,6 +14,7 @@ lvm vgcreate dracut /dev/mapper/dracut_crypt_test && \
lvm lvcreate -l 100%FREE -n root dracut && \
lvm vgchange -ay && \
mke2fs -j /dev/dracut/root && \
+/sbin/tune2fs -e continue /dev/dracut/root && \
mkdir -p /sysroot && \
mount /dev/dracut/root /sysroot && \
cp -a -t /sysroot /source/* && \
diff --git a/test/TEST-40-NBD/test.sh b/test/TEST-40-NBD/test.sh
index 675ffd4..c5603fd 100755
--- a/test/TEST-40-NBD/test.sh
+++ b/test/TEST-40-NBD/test.sh
@@ -40,7 +40,7 @@ client_test() {
local found opts nbdinfo
[[ $fstype ]] || fstype=ext3
- [[ $fsopt ]] || fsopt="errors=continue"
+ [[ $fsopt ]] || fsopt="ro"
echo "CLIENT TEST START: $test_name"
@@ -198,7 +198,7 @@ make_encrypted_root() {
(
initdir=overlay
. $basedir/dracut-functions
- dracut_install mke2fs poweroff cp umount
+ dracut_install mke2fs poweroff cp umount tune2fs
inst_hook initqueue 01 ./create-root.sh
inst_simple ./99-idesymlinks.rules /etc/udev/rules.d/99-idesymlinks.rules
)

View File

@ -0,0 +1,61 @@
From 662ed0a13f4b497352fe9b6a1d243f06e45c4f3d Mon Sep 17 00:00:00 2001
From: Harald Hoyer <harald@redhat.com>
Date: Thu, 22 Sep 2011 15:12:14 +0200
Subject: [PATCH] 99fs-lib/fs-lib.sh: fsck btrfs via mounting like xfs
btrfsck is only for manual repairing your filesystem
---
modules.d/99fs-lib/fs-lib.sh | 33 ++++++++++++++++++++++++++++++++-
1 files changed, 32 insertions(+), 1 deletions(-)
diff --git a/modules.d/99fs-lib/fs-lib.sh b/modules.d/99fs-lib/fs-lib.sh
index f7b20dd..edb5852 100755
--- a/modules.d/99fs-lib/fs-lib.sh
+++ b/modules.d/99fs-lib/fs-lib.sh
@@ -59,7 +59,7 @@ fsck_able() {
;;
btrfs)
type btrfsck >/dev/null 2>&1 &&
- _drv="_drv=btrfsck fsck_drv_com" &&
+ _drv="_drv=none fsck_drv_btrfs" &&
return 0
;;
*)
@@ -104,6 +104,37 @@ fsck_drv_xfs() {
return $_ret
}
+fsck_drv_btrfs() {
+ local _ret
+
+ # fs must be cleanly mounted (and umounted) first, before attempting any
+ # btrfs tools - if this works, nothing else should be needed
+ # note, that user is always dropped into the shell, if the filesystem is
+ # not mountable or if -f flag is found among _fop
+ mkdir -p /tmp/.btrfs
+
+ info "trying to mount $_dev"
+ if mount -t btrfs "$_dev" "/tmp/.btrfs" >/dev/null 2>&1; then
+ _ret=0
+ info "btrfs: $_dev is clean"
+ umount "$_dev" >/dev/null 2>&1
+ else
+ _ret=4
+ warn "*** $_dev is unmountable"
+ fi
+ if [ $_ret -gt 0 ] || strstr "$_fop" "-f"; then
+ warn "*** Dropping you to a shell. You have"
+ warn "*** btrfsck available."
+ warn "*** Note that if btrfs didn't mount properly, it's"
+ warn "*** probably pretty serious condition."
+ emergency_shell -n "(Repair filesystem)"
+ fi
+
+ rm -r /tmp/.btrfs
+ return $_ret
+}
+
+
# common code for checkers that follow usual subset of options and return codes
fsck_drv_com() {
local _ret

View File

@ -0,0 +1,37 @@
From 76f5fa549c483a7a38e4757578480096b94615ac Mon Sep 17 00:00:00 2001
From: Harald Hoyer <harald@redhat.com>
Date: Thu, 22 Sep 2011 15:43:34 +0200
Subject: [PATCH] dracut-functions: inst_rules() do not check std dirs for abs
path
if an absolute path is given, we should not check the standard udev rule
directories.
---
dracut-functions | 14 ++++++++------
1 files changed, 8 insertions(+), 6 deletions(-)
diff --git a/dracut-functions b/dracut-functions
index b11e37c..18a2e89 100755
--- a/dracut-functions
+++ b/dracut-functions
@@ -474,12 +474,14 @@ inst_rules() {
inst_dir "/lib/udev/rules.d"
inst_dir "$_target"
for _rule in "$@"; do
- for r in /lib/udev/rules.d /etc/udev/rules.d; do
- if [[ -f $r/$_rule ]]; then
- _found="$r/$_rule"
- inst_simple "$_found"
- fi
- done
+ if [ "${rule#/}" = $rule ]; then
+ for r in /lib/udev/rules.d /etc/udev/rules.d; do
+ if [[ -f $r/$_rule ]]; then
+ _found="$r/$_rule"
+ inst_simple "$_found"
+ fi
+ done
+ fi
for r in '' ./ $dracutbasedir/rules.d/; do
if [[ -f ${r}$_rule ]]; then
_found="${r}$_rule"

View File

@ -0,0 +1,33 @@
From cb288154050ff5293bc9a0a72953cd2b93782abb Mon Sep 17 00:00:00 2001
From: Michal Soltys <soltys@ziu.info>
Date: Thu, 15 Sep 2011 08:45:57 +0200
Subject: [PATCH] str_replace() fix
Whitespace removal in:
out="${out}${chop# }$r"
will damage certain strings, for example the following call:
str_replace ' aax aaxaa' x y
would return 'aayaayaa' instead of ' aay aayaa'.
Signed-off-by: Michal Soltys <soltys@ziu.info>
---
modules.d/99base/dracut-lib.sh | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/modules.d/99base/dracut-lib.sh b/modules.d/99base/dracut-lib.sh
index 50b1ed2..62c3bf5 100755
--- a/modules.d/99base/dracut-lib.sh
+++ b/modules.d/99base/dracut-lib.sh
@@ -24,7 +24,7 @@ str_replace() {
while strstr "${in}" "$s"; do
chop="${in%%$s*}"
- out="${out}${chop# }$r"
+ out="${out}${chop}$r"
in="${in#*$s}"
done
echo "${out}${in}"

View File

@ -0,0 +1,37 @@
From 69063507d4c553cb5c4e51fb401d29eda7106351 Mon Sep 17 00:00:00 2001
From: Harald Hoyer <harald@redhat.com>
Date: Thu, 22 Sep 2011 15:49:25 +0200
Subject: [PATCH] dracut-logger: bail out early, if we don't have to log
anything
---
dracut-logger | 7 +++----
1 files changed, 3 insertions(+), 4 deletions(-)
diff --git a/dracut-logger b/dracut-logger
index d85cbaf..ce28208 100755
--- a/dracut-logger
+++ b/dracut-logger
@@ -271,12 +271,8 @@ _dlvl2syslvl() {
# - @c INFO to @c info
# - @c DEBUG and @c TRACE both to @c debug
_do_dlog() {
- [ -z "$maxloglvl" ] && return 0
local lvl="$1"; shift
local lvlc=$(_lvl2char "$lvl") || return 0
-
- [ $lvl -le $maxloglvl ] || return 0
-
local msg="$lvlc: $*"
[ $lvl -le $stdloglvl ] && echo "$msg" >&2
@@ -307,6 +303,9 @@ _do_dlog() {
# dwarn "This is a warning"
# echo "This is a warning" | dwarn
dlog() {
+ [ -z "$maxloglvl" ] && return 0
+ [ $1 -le $maxloglvl ] || return 0
+
if [ $# -gt 1 ]; then
_do_dlog "$@"
else

View File

@ -0,0 +1,24 @@
From 7c14b3688c83b14c95bafb4989871ffac2092c42 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Amadeusz=20=C5=BBo=C5=82nowski?= <aidecoe@aidecoe.name>
Date: Sun, 4 Sep 2011 16:38:35 +0200
Subject: [PATCH] dracut: create /dev besides /proc, /sys and so
How it worked without it? The issue only manifests itself with
initramfs integrated into kernel.
---
dracut | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/dracut b/dracut
index 0e930c7..c9329bd 100755
--- a/dracut
+++ b/dracut
@@ -510,7 +510,7 @@ if [[ $kernel_only != yes ]]; then
fi
done
- for d in proc sys sysroot root run run/lock run/initramfs; do
+ for d in dev proc sys sysroot root run run/lock run/initramfs; do
if [ -h "/$d" ]; then
inst "/$d"
else

View File

@ -0,0 +1,26 @@
From f07aaccd0600cefd113d1393cb4ca6a7e969a8e1 Mon Sep 17 00:00:00 2001
From: Michal Soltys <soltys@ziu.info>
Date: Tue, 6 Sep 2011 01:22:15 +0200
Subject: [PATCH] 99fs-lib: export FSTAB_FILE before fsck call
Signed-off-by: Michal Soltys <soltys@ziu.info>
---
modules.d/99fs-lib/fs-lib.sh | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/modules.d/99fs-lib/fs-lib.sh b/modules.d/99fs-lib/fs-lib.sh
index edb5852..f36299a 100755
--- a/modules.d/99fs-lib/fs-lib.sh
+++ b/modules.d/99fs-lib/fs-lib.sh
@@ -210,10 +210,10 @@ fsck_batch() {
info " $_dev"
done
+ export FSTAB_FILE
_out="$(fsck -M -T "$@" -- -a)"
_ret=$?
- export FSTAB_FILE
fsck_tail
return $_ret

View File

@ -0,0 +1,22 @@
From 08769b7f8a9efc57cd95d1f81e8aaf1a48db0d28 Mon Sep 17 00:00:00 2001
From: Harald Hoyer <harald@redhat.com>
Date: Thu, 22 Sep 2011 16:14:38 +0200
Subject: [PATCH] dracut-functions: inst_rules() add missing ""
---
dracut-functions | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/dracut-functions b/dracut-functions
index 18a2e89..5508809 100755
--- a/dracut-functions
+++ b/dracut-functions
@@ -474,7 +474,7 @@ inst_rules() {
inst_dir "/lib/udev/rules.d"
inst_dir "$_target"
for _rule in "$@"; do
- if [ "${rule#/}" = $rule ]; then
+ if [ "${rule#/}" = "$rule" ]; then
for r in /lib/udev/rules.d /etc/udev/rules.d; do
if [[ -f $r/$_rule ]]; then
_found="$r/$_rule"

View File

@ -0,0 +1,46 @@
From db9b9f396e8d923591725f648c0a35789286254b Mon Sep 17 00:00:00 2001
From: Michal Soltys <soltys@ziu.info>
Date: Thu, 22 Sep 2011 17:09:56 +0200
Subject: [PATCH] 90mdraid: check precisely for supported contaiers
ID_FS_TYPE can be much more than just ddf/imsm/linux raid member, so
do the proper checks.
This reverts certain changes from:
cf5891424ef026eede69606a918dadf5560095fd
Signed-off-by: Michal Soltys <soltys@ziu.info>
---
modules.d/90mdraid/65-md-incremental-imsm.rules | 5 ++++-
modules.d/90mdraid/module-setup.sh | 2 +-
2 files changed, 5 insertions(+), 2 deletions(-)
diff --git a/modules.d/90mdraid/65-md-incremental-imsm.rules b/modules.d/90mdraid/65-md-incremental-imsm.rules
index 209b17b..ea3a889 100644
--- a/modules.d/90mdraid/65-md-incremental-imsm.rules
+++ b/modules.d/90mdraid/65-md-incremental-imsm.rules
@@ -7,7 +7,10 @@ SUBSYSTEM!="block", GOTO="md_end"
ENV{rd_NO_MD}=="?*", GOTO="md_end"
KERNEL=="md*", GOTO="md_end"
-ENV{ID_FS_TYPE}!="*_raid_member", GOTO="md_end"
+ENV{ID_FS_TYPE}=="ddf_raid_member|isw_raid_member|linux_raid_member", GOTO="md_try"
+GOTO="md_end"
+
+LABEL="md_try"
ENV{ID_FS_TYPE}=="isw_raid_member", ENV{rd_NO_MDIMSM}=="?*", GOTO="md_end"
ENV{ID_FS_TYPE}=="ddf_raid_member", ENV{rd_NO_MDDDF}=="?*", GOTO="md_end"
diff --git a/modules.d/90mdraid/module-setup.sh b/modules.d/90mdraid/module-setup.sh
index 12e6739..d4a9870 100755
--- a/modules.d/90mdraid/module-setup.sh
+++ b/modules.d/90mdraid/module-setup.sh
@@ -20,7 +20,7 @@ check() {
check_block_and_slaves is_mdraid "$_rootdev" || return 1
else
# root is not on a block device, use the shotgun approach
- blkid | grep -q '"[^"]*_raid_member"' || return 1
+ blkid | egrep -q '(linux|isw|ddf)_raid' || return 1
fi
}

View File

@ -0,0 +1,25 @@
From ae816bb6aa461eb561debc9188e69f726b31d805 Mon Sep 17 00:00:00 2001
From: Michal Soltys <soltys@ziu.info>
Date: Thu, 22 Sep 2011 17:23:21 +0200
Subject: [PATCH] 90mdraid: more thorough 64-md-raid.rules edit
Catch more variations of incremental assembly.
Signed-off-by: Michal Soltys <soltys@ziu.info>
---
modules.d/90mdraid/module-setup.sh | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/modules.d/90mdraid/module-setup.sh b/modules.d/90mdraid/module-setup.sh
index d4a9870..5e819b1 100755
--- a/modules.d/90mdraid/module-setup.sh
+++ b/modules.d/90mdraid/module-setup.sh
@@ -54,7 +54,7 @@ install() {
# 65-md-inc*.rules and its fine-grained controls, or cause other problems
# when we explicitly don't want certain components to be incrementally
# assembled
- sed -i -e '/^ENV{ID_FS_TYPE}==.*ACTION=="add".*RUN+="\/sbin\/mdadm --incremental $env{DEVNAME}"$/d' "${initdir}/lib/udev/rules.d/64-md-raid.rules"
+ sed -ire '/RUN\+?="[[:alpha:]/]*mdadm[[:blank:]]+(--incremental|-I)[[:blank:]]+(\$env\{DEVNAME\}|\$tempnode)"/d' "${initdir}/lib/udev/rules.d/64-md-raid.rules"
fi
inst_rules "$moddir/65-md-incremental-imsm.rules"

View File

@ -0,0 +1,53 @@
From 9fc3f0452023c42c235c3312ad311243e7f900a2 Mon Sep 17 00:00:00 2001
From: Michal Soltys <soltys@ziu.info>
Date: Thu, 22 Sep 2011 17:16:39 +0200
Subject: [PATCH] 90mdraid: adjust /dev/md loops
Include '_' to also handle old partitionable arrays (pre-2.6.28).
Signed-off-by: Michal Soltys <soltys@ziu.info>
---
modules.d/90mdraid/65-md-incremental-imsm.rules | 2 +-
modules.d/90mdraid/mdraid-cleanup.sh | 2 +-
modules.d/90mdraid/mdraid_start.sh | 2 +-
3 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/modules.d/90mdraid/65-md-incremental-imsm.rules b/modules.d/90mdraid/65-md-incremental-imsm.rules
index ea3a889..2a80700 100644
--- a/modules.d/90mdraid/65-md-incremental-imsm.rules
+++ b/modules.d/90mdraid/65-md-incremental-imsm.rules
@@ -15,7 +15,7 @@ ENV{ID_FS_TYPE}=="isw_raid_member", ENV{rd_NO_MDIMSM}=="?*", GOTO="md_end"
ENV{ID_FS_TYPE}=="ddf_raid_member", ENV{rd_NO_MDDDF}=="?*", GOTO="md_end"
# already done ?
-PROGRAM="/bin/sh -c 'for i in $sys/$devpath/holders/md[0-9]*; do [ -e $$i ] && exit 0; done; exit 1;' ", \
+PROGRAM="/bin/sh -c 'for i in $sys/$devpath/holders/md[0-9_]*; do [ -e $$i ] && exit 0; done; exit 1;' ", \
GOTO="md_end"
# for native arrays - array's uuid has to be specified
diff --git a/modules.d/90mdraid/mdraid-cleanup.sh b/modules.d/90mdraid/mdraid-cleanup.sh
index 8fc54e2..3ffa2d3 100755
--- a/modules.d/90mdraid/mdraid-cleanup.sh
+++ b/modules.d/90mdraid/mdraid-cleanup.sh
@@ -5,7 +5,7 @@
type getarg >/dev/null 2>&1 || . /lib/dracut-lib.sh
containers=""
-for md in /dev/md[0-9]*; do
+for md in /dev/md[0-9_]*; do
[ -b "$md" ] || continue
udevinfo="$(udevadm info --query=env --name=$md)"
strstr "$udevinfo" "DEVTYPE=partition" && continue
diff --git a/modules.d/90mdraid/mdraid_start.sh b/modules.d/90mdraid/mdraid_start.sh
index be5a3ce..f79f16e 100755
--- a/modules.d/90mdraid/mdraid_start.sh
+++ b/modules.d/90mdraid/mdraid_start.sh
@@ -8,7 +8,7 @@ _md_force_run() {
local _path_s
local _path_d
# try to force-run anything not running yet
- for md in /dev/md[0-9]*; do
+ for md in /dev/md[0-9_]*; do
[ -b "$md" ] || continue
_udevinfo="$(udevadm info --query=env --name="$md")"
strstr "$_udevinfo" "MD_LEVEL=container" && continue

View File

@ -0,0 +1,38 @@
From 9e103df45e4ca2c2392cedf3c9ecb84713962838 Mon Sep 17 00:00:00 2001
From: John Reiser <jreiser@bitwagon.com>
Date: Fri, 23 Sep 2011 08:02:23 -0700
Subject: [PATCH] dracut [PATCH] Parameter expansion occurs before command
evaluation.
Bash shell expands all ${parameter} before evaluating a command.
For multiple declarations and assignments within the same 'local' command,
then new variables or new values that appear towards the left
do not affect parameter expansion towards the right.
--
John Reiser, jreiser@BitWagon.com
>From 507ad6f66fc66f868a9e5fdd3806e012c4022baa Mon Sep 17 00:00:00 2001
From: John Reiser <jreiser@BitWagon.com>
Date: Fri, 23 Sep 2011 07:37:43 -0700
Subject: [PATCH] Parameter expansion occurs before command evaluation.
${parameter} on the right is expanded before evaluating "local var=value"
on the left.
---
dracut-functions | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/dracut-functions b/dracut-functions
index 5508809..c4f7f61 100755
--- a/dracut-functions
+++ b/dracut-functions
@@ -272,7 +272,7 @@ check_vol_slaves() {
inst_dir() {
[[ -e ${initdir}"$1" ]] && return 0 # already there
- local _dir="$1" _part=${_dir%/*} _file
+ local _dir="$1" _part="${1%/*}" _file
while [[ "$_part" != "${_part%/*}" ]] && ! [[ -e "${initdir}${_part}" ]]; do
_dir="$_part $_dir"
_part=${_part%/*}

View File

@ -0,0 +1,100 @@
From d23159a69c818274486f1287ba6267b96f3febb7 Mon Sep 17 00:00:00 2001
From: John Reiser <jreiser@bitwagon.com>
Date: Fri, 23 Sep 2011 09:17:13 -0700
Subject: [PATCH] dracut [PATCH]es: parallelize block_module filter and
net_module_filter
Filtering modules requires enough work that instmods() in the
next pipeline stage was rarely busy. Parallelize the two
filters which do the most work. Also fix a filename-vs-contents
mistake in net_module_filter.
--
John Reiser, jreiser@BitWagon.com
>From f4533a2ceca52c443ddebec01eeaa35d51c39c1b Mon Sep 17 00:00:00 2001
From: John Reiser <jreiser@BitWagon.com>
Date: Tue, 13 Sep 2011 17:41:43 -0700
Subject: [PATCH 1/3] Parallelize block_module_filter
---
modules.d/40network/module-setup.sh | 33 +++++++++++++++++----------
modules.d/90kernel-modules/module-setup.sh | 22 +++++++++++++-----
2 files changed, 37 insertions(+), 18 deletions(-)
diff --git a/modules.d/40network/module-setup.sh b/modules.d/40network/module-setup.sh
index cb81269..03684f1 100755
--- a/modules.d/40network/module-setup.sh
+++ b/modules.d/40network/module-setup.sh
@@ -27,18 +27,27 @@ installkernel() {
net_module_filter() {
local _net_drivers='eth_type_trans|register_virtio_device'
local _unwanted_drivers='/(wireless|isdn|uwb)/'
- local _fname
- while read _fname; do
- local _fcont
- case "$_fname" in
- *.ko) _fcont="$(< $_fname)" ;;
- *.ko.gz) _fcont="$(gzip -dc $_fname)" ;;
- esac
- [[ $_fcont =~ $_net_drivers
- && ! $_fcont =~ iw_handler_get_spy \
- && ! $_fname =~ $_unwanted_drivers ]] \
- && echo "$_fname"
- done
+ function nmf1() {
+ local _fname _fcont
+ while read _fname; do
+ [[ $_fname =~ $_unwanted_drivers ]] && continue
+ case "$_fname" in
+ *.ko) _fcont="$(< $_fname)" ;;
+ *.ko.gz) _fcont="$(gzip -dc $_fname)" ;;
+ esac
+ [[ $_fcont =~ $_net_drivers
+ && ! $_fcont =~ iw_handler_get_spy ]] \
+ && echo "$_fname"
+ done
+ }
+ # Use two parallel streams to filter alternating modules.
+ local merge side2
+ ( ( local _f1 _f2
+ while read _f1; do echo "$_f1"
+ if read _f2; then echo "$_f2" 1>&${side2}; fi
+ done \
+ | nmf1 1>&${merge} ) {side2}>&1 \
+ | nmf1 ) {merge}>&1
}
find_kernel_modules_by_path drivers/net | net_module_filter | instmods
diff --git a/modules.d/90kernel-modules/module-setup.sh b/modules.d/90kernel-modules/module-setup.sh
index 9fc4248..09bd87e 100755
--- a/modules.d/90kernel-modules/module-setup.sh
+++ b/modules.d/90kernel-modules/module-setup.sh
@@ -11,12 +11,22 @@ installkernel() {
}
block_module_filter() {
local _blockfuncs='ahci_init_controller|ata_scsi_ioctl|scsi_add_host|blk_init_queue|register_mtd_blktrans|scsi_esp_register|register_virtio_device'
- local _f
- while read _f; do case "$_f" in
- *.ko) [[ $(< $_f) =~ $_blockfuncs ]] && echo "$_f" ;;
- *.ko.gz) [[ $(gzip -dc <$_f) =~ $_blockfuncs ]] && echo "$_f" ;;
- esac
- done
+ function bmf1() {
+ local _f
+ while read _f; do case "$_f" in
+ *.ko) [[ $(< $_f) =~ $_blockfuncs ]] && echo "$_f" ;;
+ *.ko.gz) [[ $(gzip -dc <$_f) =~ $_blockfuncs ]] && echo "$_f" ;;
+ esac
+ done
+ }
+ # Use two parallel streams to filter alternating modules.
+ local merge side2
+ ( ( local _f1 _f2
+ while read _f1; do echo "$_f1"
+ if read _f2; then echo "$_f2" 1>&${side2}; fi
+ done \
+ | bmf1 1>&${merge} ) {side2}>&1 \
+ | bmf1 ) {merge}>&1
}
hostonly='' instmods sr_mod sd_mod scsi_dh scsi_dh_rdac scsi_dh_emc
hostonly='' instmods pcmcia firewire-ohci

View File

@ -0,0 +1,36 @@
From 77a57d5eafc3e46d01b196312d5dd4f28e0e8010 Mon Sep 17 00:00:00 2001
From: Harald Hoyer <harald@redhat.com>
Date: Tue, 4 Oct 2011 13:03:45 +0200
Subject: [PATCH] order mdadm and lvm timeout operations
---
modules.d/90lvm/64-lvm.rules | 2 +-
modules.d/90mdraid/65-md-incremental-imsm.rules | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/modules.d/90lvm/64-lvm.rules b/modules.d/90lvm/64-lvm.rules
index 487d08a..ab827a9 100644
--- a/modules.d/90lvm/64-lvm.rules
+++ b/modules.d/90lvm/64-lvm.rules
@@ -13,7 +13,7 @@ PROGRAM=="/bin/sh -c 'for i in $sys/$devpath/holders/dm-[0-9]*; do [ -e $$i ] &&
GOTO="lvm_end"
RUN+="/sbin/initqueue --settled --onetime --unique /sbin/lvm_scan"
-RUN+="/sbin/initqueue --timeout --onetime --unique /sbin/lvm_scan --partial"
+RUN+="/sbin/initqueue --timeout --name 51-lvm_scan --onetime --unique /sbin/lvm_scan --partial"
RUN+="/bin/sh -c '>/tmp/.lvm_scan-%k;'"
LABEL="lvm_end"
diff --git a/modules.d/90mdraid/65-md-incremental-imsm.rules b/modules.d/90mdraid/65-md-incremental-imsm.rules
index 2a80700..139a599 100644
--- a/modules.d/90mdraid/65-md-incremental-imsm.rules
+++ b/modules.d/90mdraid/65-md-incremental-imsm.rules
@@ -27,7 +27,7 @@ PROGRAM="/bin/sh -c 'for i in $sys/$devpath/holders/md[0-9_]*; do [ -e $$i ] &&
ENV{DEVTYPE}!="partition", \
RUN+="/sbin/partx -d --nr 1-1024 $env{DEVNAME}"
-RUN+="/sbin/initqueue --timeout --onetime --unique /sbin/mdraid_start"
+RUN+="/sbin/initqueue --timeout --name 50-mdraid_start --onetime --unique /sbin/mdraid_start"
# if rd_MDADMCONF is set, do not assemble incrementally;
# defer conf-based assembly until the udev queue is settled

View File

@ -0,0 +1,22 @@
From e0e9221e23f783ce670349df52da46bf6dc05c14 Mon Sep 17 00:00:00 2001
From: Harald Hoyer <harald@redhat.com>
Date: Tue, 4 Oct 2011 13:06:33 +0200
Subject: [PATCH] 90mdraid/mdraid_start.sh: fix path to md sysfs
---
modules.d/90mdraid/mdraid_start.sh | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/modules.d/90mdraid/mdraid_start.sh b/modules.d/90mdraid/mdraid_start.sh
index f79f16e..f4b7ad0 100755
--- a/modules.d/90mdraid/mdraid_start.sh
+++ b/modules.d/90mdraid/mdraid_start.sh
@@ -14,7 +14,7 @@ _md_force_run() {
strstr "$_udevinfo" "MD_LEVEL=container" && continue
strstr "$_udevinfo" "DEVTYPE=partition" && continue
- _path_s="$(udevadm info -q path -n "$md")/md/array_state"
+ _path_s="/sys/$(udevadm info -q path -n "$md")/md/array_state"
[ ! -r "$_path_s" ] && continue
# inactive ?

View File

@ -0,0 +1,22 @@
From 54ffd5447da0a912f91d21dde22d56b0f5762484 Mon Sep 17 00:00:00 2001
From: Harald Hoyer <harald@redhat.com>
Date: Tue, 4 Oct 2011 13:30:35 +0200
Subject: [PATCH] 90mdraid/module-setup.sh: fixed sed arguments
---
modules.d/90mdraid/module-setup.sh | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/modules.d/90mdraid/module-setup.sh b/modules.d/90mdraid/module-setup.sh
index 5e819b1..fe793bb 100755
--- a/modules.d/90mdraid/module-setup.sh
+++ b/modules.d/90mdraid/module-setup.sh
@@ -54,7 +54,7 @@ install() {
# 65-md-inc*.rules and its fine-grained controls, or cause other problems
# when we explicitly don't want certain components to be incrementally
# assembled
- sed -ire '/RUN\+?="[[:alpha:]/]*mdadm[[:blank:]]+(--incremental|-I)[[:blank:]]+(\$env\{DEVNAME\}|\$tempnode)"/d' "${initdir}/lib/udev/rules.d/64-md-raid.rules"
+ sed -i -r -e '/RUN\+?="[[:alpha:]/]*mdadm[[:blank:]]+(--incremental|-I)[[:blank:]]+(\$env\{DEVNAME\}|\$tempnode)"/d' "${initdir}/lib/udev/rules.d/64-md-raid.rules"
fi
inst_rules "$moddir/65-md-incremental-imsm.rules"

View File

@ -0,0 +1,41 @@
From e0f9ecc6a47bb01de04e6b44ade38f347fe057da Mon Sep 17 00:00:00 2001
From: Harald Hoyer <harald@redhat.com>
Date: Thu, 6 Oct 2011 10:25:08 +0200
Subject: [PATCH] 95udev-rules/module-setup.sh: also search in /lib/udev and
/usr/lib/udev
---
modules.d/95udev-rules/module-setup.sh | 9 ++++++++-
1 files changed, 8 insertions(+), 1 deletions(-)
diff --git a/modules.d/95udev-rules/module-setup.sh b/modules.d/95udev-rules/module-setup.sh
index 876f7a3..eddf2b0 100755
--- a/modules.d/95udev-rules/module-setup.sh
+++ b/modules.d/95udev-rules/module-setup.sh
@@ -7,7 +7,9 @@ install() {
# FIXME: would be nice if we didn't have to know which rules to grab....
# ultimately, /lib/initramfs/rules.d or somesuch which includes links/copies
# of the rules we want so that we just copy those in would be best
- dracut_install udevd udevadm
+ dracut_install udevadm
+ [ -x /sbin/udevd ] && dracut_install udevd
+
for i in /etc/udev/udev.conf /etc/group; do
inst_simple $i
done
@@ -55,10 +57,15 @@ install() {
vol_id \
pcmcia-socket-startup \
pcmcia-check-broken-cis \
+ udevd \
; do
[ -e /lib/udev/$_i ] && dracut_install /lib/udev/$_i
+ [ -e /usr/lib/udev/$_i ] && dracut_install /usr/lib/udev/$_i
done
+ [ -x /lib/udev/udevd ] && ln -s ../lib/udev/udevd /sbin/udevd
+ [ -x /usr/lib/udev/udevd ] && ln -s ../usr/lib/udev/udevd /sbin/udevd
+
[ -f /etc/arch-release ] && \
inst "$moddir/load-modules.sh" /lib/udev/load-modules.sh

View File

@ -0,0 +1,48 @@
From 0c3a8dea88a7c7f3fdda5000d3e77b61bfbe7f6a Mon Sep 17 00:00:00 2001
From: WANG Cong <xiyou.wangcong@gmail.com>
Date: Fri, 7 Oct 2011 15:44:10 +0800
Subject: [PATCH] update the documentation of '--[no]prefix'
In
commit fd786adcf515d9d3ee77eb29fa4c6b60020c7209
Author: Harald Hoyer <harald@redhat.com>
Date: Wed Apr 20 16:47:40 2011 +0200
dracut: make prefix configurable
Harald changed the meaning of --prefix/--noprefix, but
forgot to update their documentation. This patch
fixes that.
Signed-off-by: WANG Cong <xiyou.wangcong@gmail.com>
---
dracut.8.xml | 6 +++---
1 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/dracut.8.xml b/dracut.8.xml
index 11ea8c3..709f1a6 100644
--- a/dracut.8.xml
+++ b/dracut.8.xml
@@ -245,10 +245,10 @@ include in the generic initramfs. This parameter can be specified multiple times
</varlistentry>
<varlistentry>
<term>
- <option>--prefix</option>
+ <option>--prefix&nbsp;<replaceable>&lt;dir&gt;</replaceable></option>
</term>
<listitem>
- <para>prefix initramfs files with /run/initramfs/</para>
+ <para>prefix initramfs files with the specified directory</para>
</listitem>
</varlistentry>
<varlistentry>
@@ -256,7 +256,7 @@ include in the generic initramfs. This parameter can be specified multiple times
<option>--noprefix</option>
</term>
<listitem>
- <para>do not prefix initramfs files with /run/initramfs/ (default)</para>
+ <para>do not prefix initramfs files (default)</para>
</listitem>
</varlistentry>
<varlistentry>

View File

@ -0,0 +1,29 @@
From 88b3e00515804f7e6906590ab02534d1fe4ec91f Mon Sep 17 00:00:00 2001
From: Dave Young <dyoung@redhat.com>
Date: Mon, 10 Oct 2011 11:41:14 +0200
Subject: [PATCH] dracut: check mktemp return value
in slackware the default mktemp is not from coreutils.
A simply make in test directory mangled my rootfs due
to initdir is blank
Also mktemp could failed with other reason like ENOSPC or EPERM
---
dracut | 4 ++++
1 files changed, 4 insertions(+), 0 deletions(-)
diff --git a/dracut b/dracut
index c9329bd..de13445 100755
--- a/dracut
+++ b/dracut
@@ -472,6 +472,10 @@ fi
readonly TMPDIR=/var/tmp
readonly initdir=$(mktemp --tmpdir=/var/tmp/ -d -t initramfs.XXXXXX)
+[ -d "$initdir" ] || {
+ dfatal "mktemp failed."
+ exit 1
+}
# clean up after ourselves no matter how we die.
trap 'ret=$?;[[ $keep ]] && echo "Not removing $initdir." >&2 || rm -rf "$initdir";exit $ret;' EXIT

View File

@ -0,0 +1,54 @@
From c1609dd497bb8f8f083a258ff2f7702385eb940b Mon Sep 17 00:00:00 2001
From: Michal Soltys <soltys@ziu.info>
Date: Fri, 7 Oct 2011 22:23:49 +0200
Subject: [PATCH] convert_abs_rel() fixups
- IFS was not preserved, and modified value could leak to outside functions
- the '.' relative path should be returned for arguments such as /x/y/z
/x/y - but not for $1 == $2 ones
- $1 == $2 is self-looping link, so it returns final component of its
name
Signed-off-by: Michal Soltys <soltys@ziu.info>
---
dracut-functions | 18 +++++++++++-------
1 files changed, 11 insertions(+), 7 deletions(-)
diff --git a/dracut-functions b/dracut-functions
index c4f7f61..12dfa70 100755
--- a/dracut-functions
+++ b/dracut-functions
@@ -91,20 +91,24 @@ normalize_path() {
}
convert_abs_rel() {
- local __current __absolute __abssize __cursize __i __level __newpath
+ local __current __absolute __abssize __cursize __newpath="" __oldifs
+ local -i __i __level=0
# PS4='${BASH_SOURCE}@${LINENO}(${FUNCNAME[0]}): ';
- if [[ "$1" == "$2" ]]
- then
- echo "."
- return
- fi
+ # corner case #1 - self looping link
+ [[ "$1" == "$2" ]] && { echo "${1##*/}"; return; }
+
+ # corner case #2 - own dir link
+ [[ "${1%/*}" == "$2" ]] && { echo "."; return; }
+
__current=$(normalize_path "$1")
__absolute=$(normalize_path "$2")
- IFS="/"
+ __oldifs="$IFS"
+ IFS="/"
__current=($__current)
__absolute=($__absolute)
+ IFS="$__oldifs"
__abssize=${#__absolute[@]}
__cursize=${#__current[@]}

View File

@ -0,0 +1,44 @@
From 77270329ba94b15c03e2f8154b0866d249e2d71f Mon Sep 17 00:00:00 2001
From: Michal Soltys <soltys@ziu.info>
Date: Fri, 7 Oct 2011 22:23:50 +0200
Subject: [PATCH] dracut.8: add missing lvmconf info
Signed-off-by: Michal Soltys <soltys@ziu.info>
---
dracut.8.xml | 17 +++++++++++++++++
1 files changed, 17 insertions(+), 0 deletions(-)
diff --git a/dracut.8.xml b/dracut.8.xml
index 709f1a6..47cc371 100644
--- a/dracut.8.xml
+++ b/dracut.8.xml
@@ -1,5 +1,6 @@
<?xml version='1.0' encoding='UTF-8'?>
<!-- This document was created with Syntext Serna Free. --><!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN" "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" []>
+<!-- vim: set ts=8 sts=2 sw=2 et: -->
<refentry id="dracut8">
<refentryinfo>
<title>dracut</title>
@@ -229,6 +230,22 @@ include in the generic initramfs. This parameter can be specified multiple times
</varlistentry>
<varlistentry>
<term>
+ <option>--lvmconf</option>
+ </term>
+ <listitem>
+ <para>include local <filename>/etc/lvm/lvm.conf</filename></para>
+ </listitem>
+ </varlistentry>
+ <varlistentry>
+ <term>
+ <option>--nolvmconf</option>
+ </term>
+ <listitem>
+ <para>do not include local <filename>/etc/lvm/lvm.conf</filename></para>
+ </listitem>
+ </varlistentry>
+ <varlistentry>
+ <term>
<option>--strip</option>
</term>
<listitem>

View File

@ -0,0 +1,155 @@
From 25b45979f20e5b6b4dfb5a15b1b8f93bccc60625 Mon Sep 17 00:00:00 2001
From: Michal Soltys <soltys@ziu.info>
Date: Fri, 7 Oct 2011 22:23:51 +0200
Subject: [PATCH] fs-lib: add ability to choose fsck tools
in dracut.conf:
fscks="<tools>"
nofscks="yes"
and similary on command line:
--fscks [LIST] (in addition to conf's, if defined there)
--nofscks
Signed-off-by: Michal Soltys <soltys@ziu.info>
---
dracut | 13 ++++++++++++-
dracut.conf | 9 +++++++++
modules.d/99fs-lib/fs-lib.sh | 6 +++---
modules.d/99fs-lib/module-setup.sh | 23 ++++++++++++++++-------
4 files changed, 40 insertions(+), 11 deletions(-)
diff --git a/dracut b/dracut
index de13445..63d4ea6 100755
--- a/dracut
+++ b/dracut
@@ -59,6 +59,8 @@ Creates initial ramdisk images for preloading modules
--nomdadmconf Do not include local /etc/mdadm.conf
--lvmconf Include local /etc/lvm/lvm.conf
--nolvmconf Do not include local /etc/lvm/lvm.conf
+ --fscks [LIST] Add a space-separated list of fsck helpers.
+ --nofscks Inhibit installation of any fsck helpers.
-h, --help This message
--debug Output debug information of the build process
--profile Output profile information of the build process
@@ -204,6 +206,8 @@ while (($# > 0)); do
--filesystems) push_arg filesystems_l "$@" || shift;;
-I|--install) push_arg install_items "$@" || shift;;
--fwdir) push_arg fw_dir_l "$@" || shift;;
+ --fscks) push_arg fscks_l "$@" || shift;;
+ --nofscks) nofscks_l="yes";;
-k|--kmoddir) read_arg drivers_dir_l "$@" || shift;;
-c|--conf) read_arg conffile "$@" || shift;;
--confdir) read_arg confdir "$@" || shift;;
@@ -324,6 +328,12 @@ if (( ${#add_drivers_l[@]} )); then
done
fi
+if (( ${#fscks_l[@]} )); then
+ while pop fscks_l val; do
+ fscks+=" $val "
+ done
+fi
+
# these options override the stuff in the config file
if (( ${#dracutmodules_l[@]} )); then
dracutmodules=''
@@ -379,6 +389,7 @@ stdloglvl=$((stdloglvl + verbosity_mod_l))
[[ $do_strip ]] || do_strip=no
[[ $compress_l ]] && compress=$compress_l
[[ $show_modules_l ]] && show_modules=$show_modules_l
+[[ $nofscks_l ]] && nofscks="yes"
# eliminate IFS hackery when messing with fw_dir
fw_dir=${fw_dir//:/ }
@@ -488,7 +499,7 @@ chmod 755 "$initdir"
export initdir dracutbasedir dracutmodules drivers \
fw_dir drivers_dir debug no_kernel kernel_only \
add_drivers mdadmconf lvmconf filesystems \
- use_fstab libdir usrlibdir \
+ use_fstab libdir usrlibdir fscks nofscks \
stdloglvl sysloglvl fileloglvl kmsgloglvl logfile \
debug
diff --git a/dracut.conf b/dracut.conf
index 8684328..a502066 100644
--- a/dracut.conf
+++ b/dracut.conf
@@ -29,3 +29,12 @@ mdadmconf="yes"
# install local /etc/lvm/lvm.conf
lvmconf="yes"
+
+# A list of fsck tools to install. If it's not specified, module's hardcoded
+# default is used, currently: "umount mount /sbin/fsck* xfs_db xfs_check
+# xfs_repair e2fsck jfs_fsck reiserfsck btrfsck". The installation is
+# opportunistic, so non-existing tools are just ignored.
+#fscks=""
+
+# inhibit installation of any fsck tools
+#nofscks="yes"
diff --git a/modules.d/99fs-lib/fs-lib.sh b/modules.d/99fs-lib/fs-lib.sh
index f36299a..772d5c0 100755
--- a/modules.d/99fs-lib/fs-lib.sh
+++ b/modules.d/99fs-lib/fs-lib.sh
@@ -177,7 +177,7 @@ fsck_drv_std() {
# returns 255 if filesystem wasn't checked at all (e.g. due to lack of
# necessary tools or insufficient options)
fsck_single() {
- local FSTAB_FILE=/etc/fstab.fslib
+ local FSTAB_FILE=/etc/fstab.empty
local _dev="$1"
local _fs="${2:-auto}"
local _fop="$3"
@@ -197,13 +197,13 @@ fsck_single() {
# takes list of filesystems to check in parallel; we don't rely on automatic
# checking based on fstab, so empty one is passed
fsck_batch() {
- local FSTAB_FILE=/etc/fstab.fslib
+ local FSTAB_FILE=/etc/fstab.empty
local _drv=fsck
local _dev
local _ret
local _out
- [ $# -eq 0 ] && return 255
+ [ $# -eq 0 ] || ! type fsck >/dev/null 2>&1 && return 255
info "Checking filesystems (fsck -M -T -a):"
for _dev in "$@"; do
diff --git a/modules.d/99fs-lib/module-setup.sh b/modules.d/99fs-lib/module-setup.sh
index cbf69a5..68ea9b1 100755
--- a/modules.d/99fs-lib/module-setup.sh
+++ b/modules.d/99fs-lib/module-setup.sh
@@ -11,13 +11,22 @@ depends() {
}
install() {
- dracut_install -o umount mount xfs_db xfs_check xfs_repair
- dracut_install -o e2fsck
- dracut_install -o jfs_fsck
- dracut_install -o reiserfsck
- dracut_install -o btrfsck
- dracut_install -o /sbin/fsck*
+ local _helpers
inst "$moddir/fs-lib.sh" "/lib/fs-lib.sh"
- touch ${initdir}/etc/fstab.fslib
+ touch ${initdir}/etc/fstab.empty
+
+ [[ "$nofscks" = "yes" ]] && return
+
+ if [[ "$fscks" = "${fscks#*[^ ]*}" ]]; then
+ _helpers="\
+ umount mount /sbin/fsck*
+ xfs_db xfs_check xfs_repair
+ e2fsck jfs_fsck reiserfsck btrfsck
+ "
+ else
+ _helpers="$fscks"
+ fi
+
+ dracut_install -o $_helpers
}

View File

@ -0,0 +1,82 @@
From 4c5da0157fad6bde8318dc653d88871f30cd645a Mon Sep 17 00:00:00 2001
From: Michal Soltys <soltys@ziu.info>
Date: Fri, 7 Oct 2011 22:23:52 +0200
Subject: [PATCH] manuals: add info about fs-lib (fsck) configuration
in dracut.8.xml & dracut.conf.5.xml
Signed-off-by: Michal Soltys <soltys@ziu.info>
---
dracut.8.xml | 19 +++++++++++++++++++
dracut.conf.5.xml | 22 ++++++++++++++++++++++
2 files changed, 41 insertions(+), 0 deletions(-)
diff --git a/dracut.8.xml b/dracut.8.xml
index 47cc371..882eac6 100644
--- a/dracut.8.xml
+++ b/dracut.8.xml
@@ -246,6 +246,25 @@ include in the generic initramfs. This parameter can be specified multiple times
</varlistentry>
<varlistentry>
<term>
+ <option>--fscks [LIST]</option>
+ </term>
+ <listitem>
+ <para>add a space-separated list of fsck tools, in addition to
+ <filename>dracut.conf</filename>'s specification; the
+ installation is opportunistic (non-exisiting tools are ignored)
+ </para>
+ </listitem>
+ </varlistentry>
+ <varlistentry>
+ <term>
+ <option>--nofscks</option>
+ </term>
+ <listitem>
+ <para>inhibit installation of any fsck tools</para>
+ </listitem>
+ </varlistentry>
+ <varlistentry>
+ <term>
<option>--strip</option>
</term>
<listitem>
diff --git a/dracut.conf.5.xml b/dracut.conf.5.xml
index 697e655..dbcdb90 100644
--- a/dracut.conf.5.xml
+++ b/dracut.conf.5.xml
@@ -1,5 +1,6 @@
<?xml version='1.0' encoding='UTF-8'?>
<!-- This document was created with Syntext Serna Free. --><!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN" "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" []>
+<!-- vim: set ts=8 sts=2 sw=2 et: -->
<refentry id="dracutconf5">
<refentryinfo>
<title>dracut.conf</title>
@@ -156,6 +157,27 @@ initramfs.</para>
</varlistentry>
<varlistentry>
<term>
+ <envar>fscks=&quot;&nbsp;<replaceable>&lt;fsck tools&gt;</replaceable>&nbsp;&quot;</envar>
+ </term>
+ <listitem>
+ <para>Add a space-separated list of fsck tools. If nothing is
+ specified, the default is: &quot;<replaceable>umount mount
+ /sbin/fsck* xfs_db xfs_check xfs_repair e2fsck jfs_fsck
+ reiserfsck btrfsck</replaceable>&quot;
+ </para>
+ <para>The installation is opportunistic (non-exisiting tools are ignored).<para>
+ </listitem>
+ </varlistentry>
+ <varlistentry>
+ <term>
+ <envar>nofscks=&quot;<replaceable>{yes}</replaceable>&quot;</envar>
+ </term>
+ <listitem>
+ <para>If specified, inhibit installation of any fsck tools.</para>
+ </listitem>
+ </varlistentry>
+ <varlistentry>
+ <term>
<envar>kernel_only=&quot;<replaceable>{yes|no}</replaceable>&quot;</envar>
</term>
<listitem>

View File

@ -0,0 +1,63 @@
From c44e3cb4e5ace39247c0a6619668add2d1dc92e8 Mon Sep 17 00:00:00 2001
From: Michal Soltys <soltys@ziu.info>
Date: Sat, 8 Oct 2011 00:20:50 +0200
Subject: [PATCH] dracut-functions: conv/normalize minor corrections
mostly with reference to earlier commit:
- bash doesn't need unsetting locals
- make normalize_path() a bit faster, also make sure we remove all
trailing slashes
- normalize paths before tests
Signed-off-by: Michal Soltys <soltys@ziu.info>
---
dracut-functions | 22 ++++++++++------------
1 files changed, 10 insertions(+), 12 deletions(-)
diff --git a/dracut-functions b/dracut-functions
index 12dfa70..ce593c9 100755
--- a/dracut-functions
+++ b/dracut-functions
@@ -83,31 +83,29 @@ print_vars() {
}
normalize_path() {
- p=$1
- while [[ ${p#*//*} != $p ]]; do
- p=${p/\/\///}
- done
- echo $p
+ shopt -q -s extglob
+ set -- "${1//+(\/)//}"
+ shopt -q -u extglob
+ echo "${1%/}"
}
convert_abs_rel() {
- local __current __absolute __abssize __cursize __newpath="" __oldifs
- local -i __i __level=0
+ local __current __absolute __abssize __cursize __newpath __oldifs
+ local -i __i __level
# PS4='${BASH_SOURCE}@${LINENO}(${FUNCNAME[0]}): ';
+ set -- "$(normalize_path "$1")" "$(normalize_path "$2")"
+
# corner case #1 - self looping link
[[ "$1" == "$2" ]] && { echo "${1##*/}"; return; }
# corner case #2 - own dir link
[[ "${1%/*}" == "$2" ]] && { echo "."; return; }
- __current=$(normalize_path "$1")
- __absolute=$(normalize_path "$2")
-
__oldifs="$IFS"
IFS="/"
- __current=($__current)
- __absolute=($__absolute)
+ __current=($1)
+ __absolute=($2)
IFS="$__oldifs"
__abssize=${#__absolute[@]}

View File

@ -0,0 +1,36 @@
From ffcfc0e432e7b61159fa7e5d0bb992c2e0704f2c Mon Sep 17 00:00:00 2001
From: Harald Hoyer <harald@redhat.com>
Date: Mon, 10 Oct 2011 11:55:17 +0200
Subject: [PATCH] dracut.*.xml: s/exisiting/existing/g
---
dracut.8.xml | 2 +-
dracut.conf.5.xml | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/dracut.8.xml b/dracut.8.xml
index 882eac6..d4689ee 100644
--- a/dracut.8.xml
+++ b/dracut.8.xml
@@ -251,7 +251,7 @@ include in the generic initramfs. This parameter can be specified multiple times
<listitem>
<para>add a space-separated list of fsck tools, in addition to
<filename>dracut.conf</filename>'s specification; the
- installation is opportunistic (non-exisiting tools are ignored)
+ installation is opportunistic (non-existing tools are ignored)
</para>
</listitem>
</varlistentry>
diff --git a/dracut.conf.5.xml b/dracut.conf.5.xml
index dbcdb90..6909a4a 100644
--- a/dracut.conf.5.xml
+++ b/dracut.conf.5.xml
@@ -165,7 +165,7 @@ initramfs.</para>
/sbin/fsck* xfs_db xfs_check xfs_repair e2fsck jfs_fsck
reiserfsck btrfsck</replaceable>&quot;
</para>
- <para>The installation is opportunistic (non-exisiting tools are ignored).<para>
+ <para>The installation is opportunistic (non-existing tools are ignored).<para>
</listitem>
</varlistentry>
<varlistentry>

View File

@ -0,0 +1,25 @@
From 450f5d66944e4a4ae005c75a818c3cccd28836f3 Mon Sep 17 00:00:00 2001
From: Harald Hoyer <harald@redhat.com>
Date: Mon, 10 Oct 2011 20:17:16 +0200
Subject: [PATCH] 95udev-rules/module-setup.s: fixed symlink for udevd to
initdir
---
modules.d/95udev-rules/module-setup.sh | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/modules.d/95udev-rules/module-setup.sh b/modules.d/95udev-rules/module-setup.sh
index eddf2b0..915c1fc 100755
--- a/modules.d/95udev-rules/module-setup.sh
+++ b/modules.d/95udev-rules/module-setup.sh
@@ -63,8 +63,8 @@ install() {
[ -e /usr/lib/udev/$_i ] && dracut_install /usr/lib/udev/$_i
done
- [ -x /lib/udev/udevd ] && ln -s ../lib/udev/udevd /sbin/udevd
- [ -x /usr/lib/udev/udevd ] && ln -s ../usr/lib/udev/udevd /sbin/udevd
+ [ -x /lib/udev/udevd ] && ln -s ../lib/udev/udevd "$initdir/sbin/udevd"
+ [ -x /usr/lib/udev/udevd ] && ln -s ../usr/lib/udev/udevd "$initdir/sbin/udevd"
[ -f /etc/arch-release ] && \
inst "$moddir/load-modules.sh" /lib/udev/load-modules.sh

View File

@ -0,0 +1,30 @@
From 61bc3bbc0e55716e64b78b6709708ce773fbae2d Mon Sep 17 00:00:00 2001
From: Dave Young <dyoung@redhat.com>
Date: Tue, 11 Oct 2011 11:26:54 +0800
Subject: [PATCH] dracut.conf.5.xml: tag mismatch fix
build failed with:
xsltproc -o dracut.conf.5 -nonet http://docbook.sourceforge.net/release/xsl/current/manpages/docbook.xsl dracut.conf.5.xml
dracut.conf.5.xml:169: parser error : Opening and ending tag mismatch: para line 168 and listitem
</listitem>
Fix it by change to </para> at the end
Signed-off-by: Dave Young <dyoung@redhat.com>
---
dracut.conf.5.xml | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/dracut.conf.5.xml b/dracut.conf.5.xml
index 6909a4a..169e11b 100644
--- a/dracut.conf.5.xml
+++ b/dracut.conf.5.xml
@@ -165,7 +165,7 @@ initramfs.</para>
/sbin/fsck* xfs_db xfs_check xfs_repair e2fsck jfs_fsck
reiserfsck btrfsck</replaceable>&quot;
</para>
- <para>The installation is opportunistic (non-existing tools are ignored).<para>
+ <para>The installation is opportunistic (non-existing tools are ignored).</para>
</listitem>
</varlistentry>
<varlistentry>

View File

@ -0,0 +1,169 @@
From c32bda6bb9ae085116dc071087afc0431e51a5fb Mon Sep 17 00:00:00 2001
From: Michal Soltys <soltys@ziu.info>
Date: Mon, 10 Oct 2011 23:58:04 +0200
Subject: [PATCH] bash3 compat patch
This patch replaces:
- {var}>... redirections with functionally identical eval construct +
explicit FDs
- ^^ and ,, case modifiers with temporary shopt
This allows us to lower minimum required bash version
to at least 3.1 (with current code).
Signed-off-by: Michal Soltys <soltys@ziu.info>
---
dracut-functions | 11 +++++++----
modules.d/10i18n/module-setup.sh | 8 +++++---
modules.d/40network/module-setup.sh | 19 ++++++++++++-------
modules.d/90kernel-modules/module-setup.sh | 19 ++++++++++++-------
4 files changed, 36 insertions(+), 21 deletions(-)
diff --git a/dracut-functions b/dracut-functions
index ce593c9..1ef5269 100755
--- a/dracut-functions
+++ b/dracut-functions
@@ -821,10 +821,11 @@ install_kmod_with_fw() {
# It will be passed the full path to the found kernel module
# $2 = module to get dependencies for
# rest of args = arguments to modprobe
+# _fderr specifies FD passed from surrounding scope
for_each_kmod_dep() {
local _func=$1 _kmod=$2 _cmd _modpath _options _found=0
shift 2
- modprobe "$@" --ignore-install --show-depends $_kmod 2>&$modprobe_stderr | (
+ modprobe "$@" --ignore-install --show-depends $_kmod 2>&${_fderr} | (
while read _cmd _modpath _options; do
[[ $_cmd = insmod ]] || continue
$_func ${_modpath} || exit $?
@@ -885,6 +886,8 @@ find_kernel_modules () {
# install kernel modules along with all their dependencies.
instmods() {
[[ $no_kernel = yes ]] && return
+ # called [sub]functions inherit _fderr
+ local _fderr=9
function inst1mod() {
local _mod="$1"
@@ -949,9 +952,9 @@ instmods() {
return $_ret
}
- # Capture all stderr from modprobe onto a new fd $modprobe_stderr,
- # and pipe it into egrep. See REDIRECTION in bash manpage.
- ( instmods_1 "$@" ) {modprobe_stderr}>&1 \
+ # Capture all stderr from modprobe to _fderr. We could use {var}>...
+ # redirections, but that would make dracut require bash4 at least.
+ eval "( instmods_1 \"\$@\" ) ${_fderr}>&1" \
| egrep -v 'FATAL: Module .* not found.' | derror
return $?
}
diff --git a/modules.d/10i18n/module-setup.sh b/modules.d/10i18n/module-setup.sh
index 5c09100..6248607 100755
--- a/modules.d/10i18n/module-setup.sh
+++ b/modules.d/10i18n/module-setup.sh
@@ -150,22 +150,24 @@ install() {
inst_simple ${kbddir}/unimaps/${FONT_UNIMAP}.uni
fi
+ shopt -q -s nocasematch
if [[ ${UNICODE} ]]
then
- if [[ ${UNICODE^^} = YES || ${UNICODE} = 1 ]]
+ if [[ ${UNICODE} = YES || ${UNICODE} = 1 ]]
then
UNICODE=1
- elif [[ ${UNICODE^^} = NO || ${UNICODE} = 0 ]]
+ elif [[ ${UNICODE} = NO || ${UNICODE} = 0 ]]
then
UNICODE=0
else
UNICODE=''
fi
fi
- if [[ ! ${UNICODE} && ${LANG^^} =~ .*\.UTF-?8 ]]
+ if [[ ! ${UNICODE} && ${LANG} =~ .*\.UTF-?8 ]]
then
UNICODE=1
fi
+ shopt -q -u nocasematch
mksubdirs ${initdir}${I18N_CONF}
mksubdirs ${initdir}${VCONFIG_CONF}
diff --git a/modules.d/40network/module-setup.sh b/modules.d/40network/module-setup.sh
index 03684f1..eb7ef9b 100755
--- a/modules.d/40network/module-setup.sh
+++ b/modules.d/40network/module-setup.sh
@@ -27,6 +27,8 @@ installkernel() {
net_module_filter() {
local _net_drivers='eth_type_trans|register_virtio_device'
local _unwanted_drivers='/(wireless|isdn|uwb)/'
+ # subfunctions inherit following FDs
+ local _merge=8 _side2=9
function nmf1() {
local _fname _fcont
while read _fname; do
@@ -40,14 +42,17 @@ installkernel() {
&& echo "$_fname"
done
}
+ function rotor() {
+ local _f1 _f2
+ while read _f1; do
+ echo "$_f1"
+ if read _f2; then
+ echo "$_f2" 1>&${_side2}
+ fi
+ done | nmf1 1>&${_merge}
+ }
# Use two parallel streams to filter alternating modules.
- local merge side2
- ( ( local _f1 _f2
- while read _f1; do echo "$_f1"
- if read _f2; then echo "$_f2" 1>&${side2}; fi
- done \
- | nmf1 1>&${merge} ) {side2}>&1 \
- | nmf1 ) {merge}>&1
+ eval "( ( rotor ) ${_side2}>&1 | nmf1 ) ${_merge}>&1"
}
find_kernel_modules_by_path drivers/net | net_module_filter | instmods
diff --git a/modules.d/90kernel-modules/module-setup.sh b/modules.d/90kernel-modules/module-setup.sh
index 09bd87e..6e3a918 100755
--- a/modules.d/90kernel-modules/module-setup.sh
+++ b/modules.d/90kernel-modules/module-setup.sh
@@ -11,6 +11,8 @@ installkernel() {
}
block_module_filter() {
local _blockfuncs='ahci_init_controller|ata_scsi_ioctl|scsi_add_host|blk_init_queue|register_mtd_blktrans|scsi_esp_register|register_virtio_device'
+ # subfunctions inherit following FDs
+ local _merge=8 _side2=9
function bmf1() {
local _f
while read _f; do case "$_f" in
@@ -19,14 +21,17 @@ installkernel() {
esac
done
}
+ function rotor() {
+ local _f1 _f2
+ while read _f1; do
+ echo "$_f1"
+ if read _f2; then
+ echo "$_f2" 1>&${_side2}
+ fi
+ done | bmf1 1>&${_merge}
+ }
# Use two parallel streams to filter alternating modules.
- local merge side2
- ( ( local _f1 _f2
- while read _f1; do echo "$_f1"
- if read _f2; then echo "$_f2" 1>&${side2}; fi
- done \
- | bmf1 1>&${merge} ) {side2}>&1 \
- | bmf1 ) {merge}>&1
+ eval "( ( rotor ) ${_side2}>&1 | bmf1 ) ${_merge}>&1"
}
hostonly='' instmods sr_mod sd_mod scsi_dh scsi_dh_rdac scsi_dh_emc
hostonly='' instmods pcmcia firewire-ohci

View File

@ -0,0 +1,30 @@
From d239b550ce9e6a80342965974c4503cfde736fbe Mon Sep 17 00:00:00 2001
From: Michal Soltys <soltys@ziu.info>
Date: Mon, 10 Oct 2011 23:58:05 +0200
Subject: [PATCH] explicitly verify bash version
A simple check in main dracut script.
Signed-off-by: Michal Soltys <soltys@ziu.info>
---
dracut | 7 +++++++
1 files changed, 7 insertions(+), 0 deletions(-)
diff --git a/dracut b/dracut
index 63d4ea6..205f5d1 100755
--- a/dracut
+++ b/dracut
@@ -418,6 +418,13 @@ else
exit 1
fi
+# Verify bash version, curret minimum is 3.1
+if (( ${BASH_VERSINFO[0]} < 3 ||
+ ( ${BASH_VERSINFO[0]} == 3 && ${BASH_VERSINFO[1]} < 1 ) )); then
+ dfatal 'You need at least Bash 3.1 to use dracut, sorry.'
+ exit 1
+fi
+
dracutfunctions=$dracutbasedir/dracut-functions
export dracutfunctions

View File

@ -0,0 +1,26 @@
From 7e8228cf5aa43722d2e6a71b5593ed1478938a31 Mon Sep 17 00:00:00 2001
From: Michal Soltys <soltys@ziu.info>
Date: Mon, 17 Oct 2011 23:01:49 +0200
Subject: [PATCH] dracut: remove duplicate options
'-I' and '--fwdir' were both read_arg and push_arg, and the latter has
priority.
Signed-off-by: Michal Soltys <soltys@ziu.info>
---
dracut | 2 --
1 files changed, 0 insertions(+), 2 deletions(-)
diff --git a/dracut b/dracut
index 205f5d1..4bc0db3 100755
--- a/dracut
+++ b/dracut
@@ -212,8 +212,6 @@ while (($# > 0)); do
-c|--conf) read_arg conffile "$@" || shift;;
--confdir) read_arg confdir "$@" || shift;;
-L|--stdlog) read_arg stdloglvl_l "$@" || shift;;
- -I|--install) read_arg install_items "$@" || shift;;
- --fwdir) read_arg fw_dir_l "$@" || shift;;
--compress) read_arg compress_l "$@" || shift;;
--prefix) read_arg prefix_l "$@" || shift;;
-f|--force) force=yes;;

View File

@ -0,0 +1,31 @@
From 2cd4a8065ac2bb6bf3708d681de56bbe1984c3ce Mon Sep 17 00:00:00 2001
From: Will Woods <wwoods@redhat.com>
Date: Wed, 12 Oct 2011 22:48:08 -0400
Subject: [PATCH] dracut-lib.sh: fix dropped backslashes in CMDLINE
The "read" shell builtin consumes backslashes, which is a problem if
your root device is something like "LABEL=Fedora\x2016".
Using "read -r" tells the shell to leave backslashes alone.
---
modules.d/99base/dracut-lib.sh | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/modules.d/99base/dracut-lib.sh b/modules.d/99base/dracut-lib.sh
index 62c3bf5..bc4d7c9 100755
--- a/modules.d/99base/dracut-lib.sh
+++ b/modules.d/99base/dracut-lib.sh
@@ -35,11 +35,11 @@ _getcmdline() {
unset _line
if [ -z "$CMDLINE" ]; then
if [ -e /etc/cmdline ]; then
- while read _line; do
+ while read -r _line; do
CMDLINE_ETC="$CMDLINE_ETC $_line";
done </etc/cmdline;
fi
- read CMDLINE </proc/cmdline;
+ read -r CMDLINE </proc/cmdline;
CMDLINE="$CMDLINE $CMDLINE_ETC"
fi
}

View File

@ -0,0 +1,22 @@
From 54ba7acba14a5db036914f2b18ff6ef569665d4e Mon Sep 17 00:00:00 2001
From: Will Woods <wwoods@redhat.com>
Date: Wed, 12 Oct 2011 22:49:35 -0400
Subject: [PATCH] dmsquash-live: fix log message about root/liveroot
---
modules.d/90dmsquash-live/parse-dmsquash-live.sh | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/modules.d/90dmsquash-live/parse-dmsquash-live.sh b/modules.d/90dmsquash-live/parse-dmsquash-live.sh
index 6e0db29..5cbcd2c 100755
--- a/modules.d/90dmsquash-live/parse-dmsquash-live.sh
+++ b/modules.d/90dmsquash-live/parse-dmsquash-live.sh
@@ -41,7 +41,7 @@ case "$liveroot" in
live:/*.[Ii][Mm][Gg]|/*.[Ii][Mm][Gg])
[ -f "${root#live:}" ] && rootok=1 ;;
esac
-info "root was $root, liveroot is now $liveroot"
+info "liveroot was $liveroot, is now $root"
# make sure that init doesn't complain
[ -z "$root" ] && root="live"

View File

@ -0,0 +1,61 @@
From f8342dd5f2235979db7b5fc0d54df408538921e6 Mon Sep 17 00:00:00 2001
From: Michal Soltys <soltys@ziu.info>
Date: Mon, 17 Oct 2011 23:36:33 +0200
Subject: [PATCH] check root candidates more carefully
This is from the following thread:
http://thread.gmane.org/gmane.linux.raid/35753/focus=35795
Additional tests + more specific info.
Signed-off-by: Michal Soltys <soltys@ziu.info>
[harald@redhat.com: usable_root(): relaxed check for root]
---
modules.d/99base/dracut-lib.sh | 9 +++++++++
modules.d/99base/init | 12 ++++++++++--
2 files changed, 19 insertions(+), 2 deletions(-)
diff --git a/modules.d/99base/dracut-lib.sh b/modules.d/99base/dracut-lib.sh
index bc4d7c9..2cfaf93 100755
--- a/modules.d/99base/dracut-lib.sh
+++ b/modules.d/99base/dracut-lib.sh
@@ -544,3 +544,12 @@ foreach_uuid_until() (
return 1
)
+
+usable_root() {
+ local _d
+ [ -d $1 ] || return 1
+ for _d in proc sys dev; do
+ [ -e "$1"/$_d ] || return 1
+ done
+ return 0
+}
diff --git a/modules.d/99base/init b/modules.d/99base/init
index 06d61a8..556ac68 100755
--- a/modules.d/99base/init
+++ b/modules.d/99base/init
@@ -286,10 +286,18 @@ getarg 'rd.break=mount' 'rdbreak=mount' && emergency_shell -n mount "Break mount
# be sourced any number of times. As soon as one suceeds, no more are sourced.
i=0
while :; do
- [ -d "$NEWROOT/proc" ] && break;
+ if ismounted "$NEWROOT"; then
+ usable_root "$NEWROOT" && break;
+ umount "$NEWROOT"
+ fi
for f in $hookdir/mount/*.sh; do
[ -f "$f" ] && . "$f"
- [ -d "$NEWROOT/proc" ] && break;
+ if ismounted "$NEWROOT"; then
+ usable_root "$NEWROOT" && break;
+ warn "$NEWROOT has no proper rootfs layout, ignoring and removing offending mount hook"
+ umount "$NEWROOT"
+ rm -f "$f"
+ fi
done
i=$(($i+1))

View File

@ -0,0 +1,22 @@
From d3be5a89e5714f43a6c288878e4b2746aa781159 Mon Sep 17 00:00:00 2001
From: Harald Hoyer <harald@redhat.com>
Date: Wed, 19 Oct 2011 14:24:07 +0200
Subject: [PATCH] netroot: do not die, if arping failed
---
modules.d/40network/netroot | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/modules.d/40network/netroot b/modules.d/40network/netroot
index 462da51..9d996cc 100755
--- a/modules.d/40network/netroot
+++ b/modules.d/40network/netroot
@@ -119,7 +119,7 @@ if [ -n "$netroot_ip" ]; then
fi
fi
if [ -n "$dest" ] && ! arping -q -f -w 60 -I $netif $dest ; then
- die "Resolving $dest via ARP on $netif failed"
+ dinfo "Resolving $dest via ARP on $netif failed"
fi
# Source netroot hooks before we start the handler

View File

@ -1,6 +0,0 @@
Patch:
@for i in 00*.patch; do n=$$[$$(echo $$i|cut -f 1 -d '-'|sed -e 's#^0*##')]; echo "Patch$$n: $$i";done
patch:
@for i in 00*.patch; do n=$$[$$(echo $$i|cut -f 1 -d '-'|sed -e 's#^0*##')]; echo "%patch$$n -p1";done

View File

@ -8,10 +8,10 @@
Name: dracut
Version: 013
Release: 4%{?dist}
Release: 85.git20111019%{?dist}
Summary: Initramfs generator using udev
%if 0%{?fedora}
%if 0%{?fedora} || 0%{?rhel} > 6
Group: System Environment/Base
%endif
%if 0%{?suse_version}
@ -24,17 +24,99 @@ URL: https://dracut.wiki.kernel.org/
Source0: http://www.kernel.org/pub/linux/utils/boot/dracut/dracut-%{version}.tar.bz2
Patch1: 0002-90dmsquash-live-dmsquash-live-root-include-fs_lib.sh.patch
Patch2: 0003-fix-live-crash-with-livenet-installed.patch
Patch3: 0004-profile.py-parse-the-output-of-dracut-profile-for-pr.patch
Patch4: 0005-add-TEST-16-DMSQUASH.patch
Patch5: 0006-dracut-functions-s-emergency-shutdown-shutdown-emerg.patch
Patch6: 0007-dracut-unset-LD_LIBRARY_PATH.patch
Patch7: 0008-build-initramfs-prelink-undo-sbin.patch
Patch8: 0009-dracut-functions-speed-up-inst_dir.patch
Patch9: 0010-90crypt-ask_for_password-pings-plymouthd.patch
Patch10: 0011-99base-whitespace-fix.patch
Patch11: 0012-dracut-functions-new-function-inst_any-d-dest-f1-f2-.patch
Patch12: 0013-livenet-take-into-account-other-ca-bundle-paths-use-.patch
Patch13: 0014-luks-key-on-ext-dev-wait-for-luks.patch
Patch14: 0015-crypt-changed-cmdline-arg-name-from-rd.luks.tout-to-.patch
Patch15: 0016-luks-key-on-ext-dev-wait-for-luks.patch
Patch16: 0017-dracut-functions-fix-inst_dir-for-non-absolute-dirs.patch
Patch17: 0018-90mdraid-65-md-incremental-imsm.rules-incremental-ru.patch
Patch18: 0019-dracut.spec-fixed-rhel-fedora-version-checks.patch
Patch19: 0020-50plymouth-add-plymouth.enable-kernel-command-line-o.patch
Patch20: 0021-99base-init-only-poll-cdroms-if-the-kernel-does-supp.patch
Patch21: 0022-build-initramfs-unclear-_mpargs-in-instmods.patch
Patch22: 0023-90crypt-parse-crypt.sh-also-accept-the-beginning-of-.patch
Patch23: 0024-99base-init-save-and-restore-environment-given-from-.patch
Patch24: 0025-99base-init-move-switch_root-breakpoint-to-a-later-p.patch
Patch25: 0026-dracut-functions-hmac-checksum-files-can-be-symlinks.patch
Patch26: 0027-95udev-rules-add-input_id.patch
Patch27: 0028-inst_simple-inst_dir-make-fast-case-faster.patch
Patch28: 0029-filter_kernel_modules-is-a-specialized-filter_kernel.patch
Patch29: 0030-install_kmod_with_fw-make-fast-case-faster.patch
Patch30: 0031-instmods-get-filenames-from-stdin-if-no-args-use-it.patch
Patch31: 0032-instmods-sanity-for-_mpargs.patch
Patch32: 0033-instmods-factor-out-egrep-of-FATAL-Module-.-not-foun.patch
Patch33: 0034-99base-init-do-not-fail-when-importing-the-original-.patch
Patch34: 0035-dracut-cp-with-sparse.patch
Patch35: 0036-99base-init-removed-cdrom-polling-reset-code.patch
Patch36: 0037-dmsquash-live-root-use-blkid-to-determine-fstype-of-.patch
Patch37: 0038-dmsquash-live-root-load-filesystem-modules-before-mo.patch
Patch38: 0039-90dmsquash-live-do-not-symlink-to-dev-live.patch
Patch39: 0040-99base-init-remove-dev-root-helper-symlink.patch
Patch40: 0041-Do-not-use-run-udev-rules.d-for-udev-rules.patch
Patch41: 0042-99base-init-mount-securityfs-with-source-securityfs-.patch
Patch42: 0043-mount-securityfs-in-a-seperate-dracut-module.patch
Patch43: 0044-mount-securityfs-in-a-seperate-dracut-module.patch
Patch44: 0045-90mdraid-adjust-stock-mdadm-udev-rules.patch
Patch45: 0046-90mdraid-containers-are-not-runnable.patch
Patch46: 0047-90mdraid-fix-adjust-mdraid-cleanup.patch
Patch47: 0048-90mdraid-fix-adjust-force-run-script.patch
Patch48: 0049-90-md-dm-raid-recognize-ddf-container.patch
Patch49: 0050-90mdraid-fix-adjust-65-md-rules-and-related-scripts.patch
Patch50: 0051-TEST-40-NBD-relaxed-check-on-ext3-filesystem-options.patch
Patch51: 0052-99fs-lib-fs-lib.sh-fsck-btrfs-via-mounting-like-xfs.patch
Patch52: 0053-dracut-functions-inst_rules-do-not-check-std-dirs-fo.patch
Patch53: 0054-str_replace-fix.patch
Patch54: 0055-dracut-logger-bail-out-early-if-we-don-t-have-to-log.patch
Patch55: 0056-dracut-create-dev-besides-proc-sys-and-so.patch
Patch56: 0057-99fs-lib-export-FSTAB_FILE-before-fsck-call.patch
Patch57: 0058-dracut-functions-inst_rules-add-missing.patch
Patch58: 0059-90mdraid-check-precisely-for-supported-contaiers.patch
Patch59: 0060-90mdraid-more-thorough-64-md-raid.rules-edit.patch
Patch60: 0061-90mdraid-adjust-dev-md-loops.patch
Patch61: 0062-dracut-PATCH-Parameter-expansion-occurs-before-comma.patch
Patch62: 0063-dracut-PATCH-es-parallelize-block_module-filter-and-.patch
Patch63: 0064-order-mdadm-and-lvm-timeout-operations.patch
Patch64: 0065-90mdraid-mdraid_start.sh-fix-path-to-md-sysfs.patch
Patch65: 0066-90mdraid-module-setup.sh-fixed-sed-arguments.patch
Patch66: 0067-95udev-rules-module-setup.sh-also-search-in-lib-udev.patch
Patch67: 0068-update-the-documentation-of-no-prefix.patch
Patch68: 0069-dracut-check-mktemp-return-value.patch
Patch69: 0070-convert_abs_rel-fixups.patch
Patch70: 0071-dracut.8-add-missing-lvmconf-info.patch
Patch71: 0072-fs-lib-add-ability-to-choose-fsck-tools.patch
Patch72: 0073-manuals-add-info-about-fs-lib-fsck-configuration.patch
Patch73: 0074-dracut-functions-conv-normalize-minor-corrections.patch
Patch74: 0075-dracut.-.xml-s-exisiting-existing-g.patch
Patch75: 0076-95udev-rules-module-setup.s-fixed-symlink-for-udevd-.patch
Patch76: 0077-dracut.conf.5.xml-tag-mismatch-fix.patch
Patch77: 0078-bash3-compat-patch.patch
Patch78: 0079-explicitly-verify-bash-version.patch
Patch79: 0080-dracut-remove-duplicate-options.patch
Patch80: 0081-dracut-lib.sh-fix-dropped-backslashes-in-CMDLINE.patch
Patch81: 0082-dmsquash-live-fix-log-message-about-root-liveroot.patch
Patch82: 0083-check-root-candidates-more-carefully.patch
Patch83: 0084-netroot-do-not-die-if-arping-failed.patch
BuildArch: noarch
BuildRequires: dash bash
%if 0%{?fedora}
%if 0%{?fedora} || 0%{?rhel} > 6
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
%endif
%if 0%{?suse_version}
BuildRoot: %{_tmppath}/%{name}-%{version}-build
%endif
%if 0%{?fedora}
%if 0%{?fedora} || 0%{?rhel} > 6
BuildRequires: docbook-style-xsl docbook-dtds libxslt
%endif
@ -75,7 +157,7 @@ Requires: sed
Requires: tar
Requires: udev
%if 0%{?fedora}
%if 0%{?fedora} || 0%{?rhel} > 6
Requires: util-linux >= 2.16
Requires: initscripts >= 8.63-1
Requires: plymouth >= 0.8.0-0.2009.29.09.19.1
@ -103,7 +185,7 @@ Requires: nbd
Requires: iproute
Requires: bridge-utils
%if 0%{?fedora}
%if 0%{?fedora} || 0%{?rhel} > 6
Requires: iscsi-initiator-utils
Requires: nfs-utils
Requires: dhclient
@ -121,7 +203,7 @@ Provides: dracut-generic = %{version}-%{release}
This package requires everything which is needed to build a generic
all purpose initramfs with network support with dracut.
%if 0%{?fedora}
%if 0%{?fedora} || 0%{?rhel} > 6
%package fips
Summary: Dracut modules to build a dracut initramfs with an integrity check
Requires: %{name} = %{version}-%{release}
@ -159,12 +241,94 @@ This package contains tools to assemble the local initrd and host configuration.
%setup -q -n %{name}-%{version}
%patch1 -p1
%patch2 -p1
%patch3 -p1
%patch4 -p1
%patch5 -p1
%patch6 -p1
%patch7 -p1
%patch8 -p1
%patch9 -p1
%patch10 -p1
%patch11 -p1
%patch12 -p1
%patch13 -p1
%patch14 -p1
%patch15 -p1
%patch16 -p1
%patch17 -p1
%patch18 -p1
%patch19 -p1
%patch20 -p1
%patch21 -p1
%patch22 -p1
%patch23 -p1
%patch24 -p1
%patch25 -p1
%patch26 -p1
%patch27 -p1
%patch28 -p1
%patch29 -p1
%patch30 -p1
%patch31 -p1
%patch32 -p1
%patch33 -p1
%patch34 -p1
%patch35 -p1
%patch36 -p1
%patch37 -p1
%patch38 -p1
%patch39 -p1
%patch40 -p1
%patch41 -p1
%patch42 -p1
%patch43 -p1
%patch44 -p1
%patch45 -p1
%patch46 -p1
%patch47 -p1
%patch48 -p1
%patch49 -p1
%patch50 -p1
%patch51 -p1
%patch52 -p1
%patch53 -p1
%patch54 -p1
%patch55 -p1
%patch56 -p1
%patch57 -p1
%patch58 -p1
%patch59 -p1
%patch60 -p1
%patch61 -p1
%patch62 -p1
%patch63 -p1
%patch64 -p1
%patch65 -p1
%patch66 -p1
%patch67 -p1
%patch68 -p1
%patch69 -p1
%patch70 -p1
%patch71 -p1
%patch72 -p1
%patch73 -p1
%patch74 -p1
%patch75 -p1
%patch76 -p1
%patch77 -p1
%patch78 -p1
%patch79 -p1
%patch80 -p1
%patch81 -p1
%patch82 -p1
%patch83 -p1
%build
make
%install
%if 0%{?fedora}
%if 0%{?fedora} || 0%{?rhel} > 6
rm -rf $RPM_BUILD_ROOT
%endif
make install DESTDIR=$RPM_BUILD_ROOT sbindir=/sbin \
@ -172,7 +336,7 @@ make install DESTDIR=$RPM_BUILD_ROOT sbindir=/sbin \
echo %{name}-%{version}-%{release} > $RPM_BUILD_ROOT/%{_datadir}/dracut/modules.d/10rpmversion/dracut-version
%if 0%{?fedora} == 0
%if 0%{?fedora} == 0 && 0%{?rhel} == 0
rm -fr $RPM_BUILD_ROOT/%{_datadir}/dracut/modules.d/01fips
%endif
@ -185,7 +349,7 @@ mkdir -p $RPM_BUILD_ROOT%{_localstatedir}/log
touch $RPM_BUILD_ROOT%{_localstatedir}/log/dracut.log
mkdir -p $RPM_BUILD_ROOT%{_sharedstatedir}/initramfs
%if 0%{?fedora}
%if 0%{?fedora} || 0%{?rhel} > 6
install -m 0644 dracut.conf.d/fedora.conf.example $RPM_BUILD_ROOT/etc/dracut.conf.d/01-dist.conf
install -m 0644 dracut.conf.d/fips.conf.example $RPM_BUILD_ROOT/etc/dracut.conf.d/40-fips.conf
%endif
@ -218,7 +382,7 @@ rm -rf $RPM_BUILD_ROOT
%{_datadir}/dracut/dracut-functions
%{_datadir}/dracut/dracut-logger
%config(noreplace) /etc/dracut.conf
%if 0%{?fedora} || 0%{?suse_version}
%if 0%{?fedora} || 0%{?suse_version} || 0%{?rhel} > 6
%config /etc/dracut.conf.d/01-dist.conf
%endif
%dir /etc/dracut.conf.d
@ -251,6 +415,7 @@ rm -rf $RPM_BUILD_ROOT
%{_datadir}/dracut/modules.d/95zfcp
%{_datadir}/dracut/modules.d/95terminfo
%{_datadir}/dracut/modules.d/95udev-rules
%{_datadir}/dracut/modules.d/96securityfs
%{_datadir}/dracut/modules.d/97biosdevname
%{_datadir}/dracut/modules.d/97masterkey
%{_datadir}/dracut/modules.d/98ecryptfs
@ -275,7 +440,7 @@ rm -rf $RPM_BUILD_ROOT
%{_datadir}/dracut/modules.d/45ifcfg
%{_datadir}/dracut/modules.d/95znet
%if 0%{?fedora}
%if 0%{?fedora} || 0%{?rhel} > 6
%files fips
%defattr(-,root,root,0755)
%{_datadir}/dracut/modules.d/01fips
@ -297,6 +462,50 @@ rm -rf $RPM_BUILD_ROOT
%dir /var/lib/dracut/overlay
%changelog
* Wed Oct 19 2011 Harald Hoyer <harald@redhat.com> 013-85.git20111019
- update to latest git
* Tue Oct 04 2011 Harald Hoyer <harald@redhat.com> 013-15
- fixed mdraid container handling
Resolves: rhbz#743240
* Thu Sep 22 2011 Harald Hoyer <harald@redhat.com> 013-13
- fixed mdraid issues
- fixed btrfsck
Resolves: rhbz#735602
* Wed Sep 21 2011 Harald Hoyer <harald@redhat.com> 013-12
- removed patch backup files
- reintroduced /dev/live
* Tue Sep 20 2011 Harald Hoyer <harald@redhat.com> 013-11
- move mounting of securitfs to a seperate module
Resolves: rhbz#737140
* Tue Sep 20 2011 Harald Hoyer <harald@redhat.com> 013-10
- mount securitfs with the correct source
Resolves: rhbz#737140
* Tue Sep 20 2011 Harald Hoyer <harald@redhat.com> 013-9
- do not carry over initramfs udev rules
Resolves: rhbz#734096
* Fri Sep 02 2011 Harald Hoyer <harald@redhat.com> 013-8
- hopefully fixed one part of a loop/udev and loop/mount race
Resolves: rhbz#735199
* Wed Aug 31 2011 Harald Hoyer <harald@redhat.com> 013-7
- add /lib/udev/input_id to the initramfs
- fix hmac install
* Tue Aug 30 2011 Harald Hoyer <harald@redhat.com> 013-6
- fixed environment passing to real init
Resolves: rhbz#733674
- fixed lvm on md
* Mon Aug 29 2011 Harald Hoyer <harald@redhat.com> 013-5
- fixed rhel/fedora version checks
* Wed Aug 17 2011 Harald Hoyer <harald@redhat.com> 013-4
- fixed crash with livenet installed