dracut-031-22.git20130809

- lsinitrd.sh: add old cpio signature
- dracut.sh: call find with -print0 and cpio with --null
- dracut.asc: small corrections
- systemd/dracut-initqueue.sh: continue to boot if finished failed
- dracut.sh/dracut-functions.sh: handle root on non-block device
- dracut-functions.sh: removed non dracut-install shell functions
- dracut-functions.sh: inst_multiple == dracut_install
- 51-dracut-rescue.install: fixed rescue image creation
- dracut.sh: do not strip in FIPS mode
Resolves: rhbz#990250
- dracut.sh: check the value of --kver
- crypt: Fix typo--/etc/crypttab not /etc/cryptab
- network/net-lib.sh: fix ibft interface configuration
- iscsi/module-setup.sh: install some modules regardless of hostonly
- multipath: need_shutdown if multipath devices exist
Resolves: rhbz#994913
- omit drivers fix
This commit is contained in:
Harald Hoyer 2013-08-09 14:21:29 +02:00
parent da021423ae
commit f8c4a0f4e5
16 changed files with 2747 additions and 1 deletions

View File

@ -0,0 +1,21 @@
From 1cb652491858464a1ce04f263bb78f313338aa68 Mon Sep 17 00:00:00 2001
From: Harald Hoyer <harald@redhat.com>
Date: Mon, 5 Aug 2013 11:14:24 +0200
Subject: [PATCH] lsinitrd.sh: add old cpio signature
---
lsinitrd.sh | 1 +
1 file changed, 1 insertion(+)
diff --git a/lsinitrd.sh b/lsinitrd.sh
index ae71d2e..ef1c262 100755
--- a/lsinitrd.sh
+++ b/lsinitrd.sh
@@ -109,6 +109,7 @@ case $bin in
CAT="zcat";;
BZh*)
CAT="bzcat";;
+ $'\x71\xc7'*)
070701)
CAT="cat";;
*)

View File

@ -0,0 +1,31 @@
From 283c34fc2b0b3ecb06613e57163a88dc4ce53ff7 Mon Sep 17 00:00:00 2001
From: Harald Hoyer <harald@redhat.com>
Date: Mon, 5 Aug 2013 11:22:21 +0200
Subject: [PATCH] dracut.sh: call find with -print0 and cpio with --null
---
dracut.sh | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/dracut.sh b/dracut.sh
index cf92397..3140b7e 100755
--- a/dracut.sh
+++ b/dracut.sh
@@ -1259,7 +1259,7 @@ if [[ $early_microcode = yes ]]; then
fi
done
done
- (cd "$microcode_dir/d"; find . | cpio -o -H newc --quiet >../ucode.cpio)
+ (cd "$microcode_dir/d"; find . -print0 | cpio --null -o -H newc --quiet >../ucode.cpio)
fi
rm -f -- "$outfile"
@@ -1268,7 +1268,7 @@ if [[ $early_microcode = yes ]]; then
# The microcode blob is _before_ the initramfs blob, not after
mv $microcode_dir/ucode.cpio $outfile.$$
fi
-if ! ( umask 077; cd "$initdir"; find . |cpio -R 0:0 -H newc -o --quiet| \
+if ! ( umask 077; cd "$initdir"; find . -print0 | cpio --null -R 0:0 -H newc -o --quiet| \
$compress >> "$outfile.$$"; ); then
dfatal "dracut: creation of $outfile.$$ failed"
exit 1

View File

@ -0,0 +1,198 @@
From 89f7217954231dc11307cc481f1e3ca8ad3ad001 Mon Sep 17 00:00:00 2001
From: Harald Hoyer <harald@redhat.com>
Date: Mon, 5 Aug 2013 11:22:55 +0200
Subject: [PATCH] dracut.asc: small corrections
---
dracut.asc | 75 ++++++++++++++------------------------------------------------
1 file changed, 16 insertions(+), 59 deletions(-)
diff --git a/dracut.asc b/dracut.asc
index 4de3dbf..dfad67e 100644
--- a/dracut.asc
+++ b/dracut.asc
@@ -777,25 +777,12 @@ scripts and udev rules.
[[stages]]
== Boot Process Stages
-The init script in _99base_ is the main script, which prepares the root file
-system for usage, runs udev, mounts the real root device, kills the remaining
-processes, and switches to the real root device for further booting. dracut
-modules can insert custom script at various points, to control the boot process.
+dracut modules can insert custom script at various points, to control the boot
+process.
These hooks are plain directories containing shell scripts ending with ".sh",
which are sourced by init.
Common used functions are in _dracut-lib.sh_, which can be sourced by any script.
-
-
-=== Basic Setup
-
-The first thing init does, is to mount _/proc_ and _/sys_ and manually create
-the basic device nodes and symbolic links in _/dev_ needed to execute basic
-commands. Then logging is setup according to kernel command line arguments.
-_/dev/pts_ and _/dev/shm_ are mounted and the first hook is sourced.
-
-
-
=== Hook: cmdline
The _cmdline_ hook is a place to insert scripts to parse the kernel command line
@@ -813,63 +800,49 @@ This hook is executed right after the cmdline hook and a check if root and
rootok were set. Here modules can take action with the final root, and before
udev has been run.
-
-
=== Start Udev
Now udev is started and the logging for udev is setup.
-
-
=== Hook: pre-trigger
In this hook, you can set udev environment variables with **udevadm control
--property=KEY=_value_** or control the further execution of udev with
udevadm.
-
-
=== Trigger Udev
udev is triggered by calling udevadm trigger, which sends add events for all
devices and subsystems.
-
-
=== Main Loop
-Now the main loop of 99base/init begins. Here we loop until udev has settled and
-all scripts in _initqueue/finished_ returned true. In this loop there are three
-hooks, where scripts can be inserted by calling /sbin/initqueue.
-
-
+In the main loop of dracut loops until udev has settled and
+all scripts in _initqueue/finished_ returned true.
+In this loop there are three hooks, where scripts can be inserted
+by calling /sbin/initqueue.
==== Initqueue
This hook gets executed every time a script is inserted here, regardless of the
udev state.
-
-
==== Initqueue settled
-This hooks gets executed every time udev has settled.
-
+This hooks (initqueue/settled) gets executed every time udev has settled.
==== Initqueue timeout
-This hooks gets executed, when the main loop counter becomes half of the
+This hooks (initqueue/timeout) gets executed, when the main loop counter becomes half of the
rd.retry counter.
-
-
==== Initqueue finished
-This hook is called after udev has settled and if all scripts herein return 0
-the main loop will be ended.
-
-
+This hook (initqueue/finished) is called after udev has settled and
+if all scripts herein return 0 the main loop will be ended.
+Abritary scripts can be added here, to loop in the
+initqueue until something happens, which a dracut module wants to wait for.
=== Hook: pre-mount
@@ -877,20 +850,15 @@ Before the root device is mounted all scripts in the hook pre-mount are
executed. In some cases (e.g. NFS) the real root device is already mounted,
though.
-
-
=== Hook: mount
This hook is mainly to mount the real root device.
-
-
=== Hook: pre-pivot
This hook is called before cleanup hook, This is a good place for
actions other than cleanups which need to be called before pivot.
-
=== Hook: cleanup
This hook is the last hook and is called before init finally switches root to
@@ -900,21 +868,18 @@ needed anymore.
=== Cleanup and switch_root
-Init kills all udev processes, cleans up the environment, sets up the arguments
-for the real init process and finally calls switch_root. switch_root removes the
-whole filesystem hierarchy of the initramfs, chroot()s to the real root device
-and calls /sbin/init with the specified arguments.
+Init (or systemd) kills all udev processes, cleans up the environment,
+sets up the arguments for the real init process and finally calls switch_root.
+switch_root removes the whole filesystem hierarchy of the initramfs,
+chroot()s to the real root device and calls /sbin/init with the specified arguments.
To ensure all files in the initramfs hierarchy can be removed, all processes
still running from the initramfs should not have any open file descriptors left.
-
-
== Network Infrastructure
FIXME
-
== Writing a Module
A simple example module is _96insmodpost_, which modprobes a kernel module after
@@ -926,8 +891,6 @@ First we create a check() function, which just exits with 0 indicating that this
module should be included by default.
check():
-
-
----
return 0
----
@@ -937,8 +900,6 @@ priority number 20 called _parse-insmodpost.sh_. It also installs the
_insmodpost.sh_ script in _/sbin_.
install():
-
-
----
inst_hook cmdline 20 "$moddir/parse-insmodpost.sh"
inst_simple "$moddir/insmodpost.sh" /sbin/insmodpost.sh
@@ -949,8 +910,6 @@ rd.driver.post, blacklists the module from being autoloaded and installs the
hook _insmodpost.sh_ in the _initqueue/settled_.
_parse-insmodpost.sh_:
-
-
----
for p in $(getargs rd.driver.post=); do
echo "blacklist $p" >> /etc/modprobe.d/initramfsblacklist.conf
@@ -967,8 +926,6 @@ modprobe the kernel modules specified in all rd.driver.post kernel command line
parameters. It runs after udev has settled and is only called once (--onetime).
_insmodpost.sh_:
-
-
----
. /lib/dracut-lib.sh

View File

@ -0,0 +1,31 @@
From 226e3710b4236c69a8f821b6a5c53a264fe4892a Mon Sep 17 00:00:00 2001
From: Harald Hoyer <harald@redhat.com>
Date: Mon, 5 Aug 2013 11:23:16 +0200
Subject: [PATCH] systemd/dracut-initqueue.sh: continue to boot if finished
failed
but /sysroot/etc/fstab exists.
---
modules.d/98systemd/dracut-initqueue.sh | 9 ++++++++-
1 file changed, 8 insertions(+), 1 deletion(-)
diff --git a/modules.d/98systemd/dracut-initqueue.sh b/modules.d/98systemd/dracut-initqueue.sh
index 35cd76f..893ebc4 100755
--- a/modules.d/98systemd/dracut-initqueue.sh
+++ b/modules.d/98systemd/dracut-initqueue.sh
@@ -62,7 +62,14 @@ while :; do
fi
main_loop=$(($main_loop+1))
- [ $main_loop -gt $RDRETRY ] && action_on_fail "Could not boot." && break
+ if [ $main_loop -gt $RDRETRY ];
+ if ! [ -d /sysroot/etc/fstab ] || ! [ -e /sysroot/sbin/init ] ; then
+ action_on_fail "Could not boot." && break
+ fi
+ warn "Not all disks have been found."
+ warn "You might want to regenerate your initramfs."
+ break
+ fi
done
unset job

View File

@ -0,0 +1,42 @@
From a4f7b504712bd7499d60d16f358ec89ab31bbb47 Mon Sep 17 00:00:00 2001
From: Harald Hoyer <harald@redhat.com>
Date: Mon, 5 Aug 2013 11:25:45 +0200
Subject: [PATCH] dracut.sh/dracut-functions.sh: handle root on non-block
device
---
dracut-functions.sh | 4 +++-
dracut.sh | 5 ++++-
2 files changed, 7 insertions(+), 2 deletions(-)
diff --git a/dracut-functions.sh b/dracut-functions.sh
index eb1278e..dee53bb 100755
--- a/dracut-functions.sh
+++ b/dracut-functions.sh
@@ -421,7 +421,9 @@ find_mp_fstype() {
find_dev_fstype() {
local _find_dev _fs
_find_dev="$1"
- [[ "$_find_dev" = /dev* ]] || _find_dev="/dev/block/$_find_dev"
+ if ! [[ "$_find_dev" = /dev* ]]; then
+ [[ -b "/dev/block/$_find_dev" ]] && _find_dev="/dev/block/$_find_dev"
+ fi
if [[ $use_fstab != yes ]]; then
findmnt -e -v -n -o 'FSTYPE' --source "$_find_dev" | { \
diff --git a/dracut.sh b/dracut.sh
index 3140b7e..c35d771 100755
--- a/dracut.sh
+++ b/dracut.sh
@@ -871,7 +871,10 @@ if [[ $hostonly ]]; then
do
mp=$(readlink -f "$mp")
mountpoint "$mp" >/dev/null 2>&1 || continue
- _dev="$(readlink -f "/dev/block/$(find_block_device "$mp")")"
+ _dev=$(find_block_device "$mp")
+ _bdev=$(readlink -f "/dev/block/$dev")
+ [[ -b $_bdev ]] && _dev=$_bdev
+ push host_devs $_dev
[[ "$_mp" == "/" ]] && root_dev="$_dev"
push host_devs "$_dev"
done

View File

@ -0,0 +1,354 @@
From 55a0b3abc7b8da4f3714cfcb5d34f7aa4e78e5bc Mon Sep 17 00:00:00 2001
From: Harald Hoyer <harald@redhat.com>
Date: Mon, 5 Aug 2013 11:47:54 +0200
Subject: [PATCH] dracut-functions.sh: removed non dracut-install shell
functions
---
dracut-functions.sh | 315 ++++++++++------------------------------------------
1 file changed, 56 insertions(+), 259 deletions(-)
diff --git a/dracut-functions.sh b/dracut-functions.sh
index dee53bb..c0a12cd 100755
--- a/dracut-functions.sh
+++ b/dracut-functions.sh
@@ -55,14 +55,6 @@ if ! [[ $dracutbasedir ]]; then
dracutbasedir="$(readlink -f $dracutbasedir)"
fi
-if ! [[ $DRACUT_INSTALL ]]; then
- DRACUT_INSTALL=$(find_binary dracut-install)
-fi
-
-if ! [[ $DRACUT_INSTALL ]] && [[ -x $dracutbasedir/dracut-install ]]; then
- DRACUT_INSTALL=$dracutbasedir/dracut-install
-fi
-
# Detect lib paths
if ! [[ $libdirs ]] ; then
if [[ "$(ldd /bin/sh)" == */lib64/* ]] &>/dev/null \
@@ -588,268 +580,73 @@ fs_get_option() {
done
}
-if [[ $DRACUT_INSTALL ]]; then
- [[ $DRACUT_RESOLVE_LAZY ]] || export DRACUT_RESOLVE_DEPS=1
- inst_dir() {
- [[ -e ${initdir}/"$1" ]] && return 0 # already there
- $DRACUT_INSTALL ${initdir+-D "$initdir"} -d "$@"
- (($? != 0)) && derror $DRACUT_INSTALL ${initdir+-D "$initdir"} -d "$@" || :
- }
-
- inst() {
- [[ -e ${initdir}/"${2:-$1}" ]] && return 0 # already there
- #dinfo "$DRACUT_INSTALL -l $@"
- $DRACUT_INSTALL ${initdir+-D "$initdir"} ${DRACUT_RESOLVE_DEPS+-l} ${DRACUT_FIPS_MODE+-H} "$@"
- (($? != 0)) && derror $DRACUT_INSTALL ${initdir+-D "$initdir"} ${DRACUT_RESOLVE_DEPS+-l} ${DRACUT_FIPS_MODE+-H} "$@" || :
- }
-
- inst_simple() {
- [[ -e ${initdir}/"${2:-$1}" ]] && return 0 # already there
- [[ -e $1 ]] || return 1 # no source
- $DRACUT_INSTALL ${initdir+-D "$initdir"} "$@"
- (($? != 0)) && derror $DRACUT_INSTALL ${initdir+-D "$initdir"} "$@" || :
- }
-
- inst_symlink() {
- [[ -e ${initdir}/"${2:-$1}" ]] && return 0 # already there
- [[ -L $1 ]] || return 1
- $DRACUT_INSTALL ${initdir+-D "$initdir"} ${DRACUT_RESOLVE_DEPS+-l} ${DRACUT_FIPS_MODE+-H} "$@"
- (($? != 0)) && derror $DRACUT_INSTALL ${initdir+-D "$initdir"} ${DRACUT_RESOLVE_DEPS+-l} ${DRACUT_FIPS_MODE+-H} "$@" || :
- }
-
- dracut_install() {
- local ret
- #dinfo "initdir=$initdir $DRACUT_INSTALL -l $@"
- $DRACUT_INSTALL ${initdir+-D "$initdir"} -a ${DRACUT_RESOLVE_DEPS+-l} ${DRACUT_FIPS_MODE+-H} "$@"
- ret=$?
- (($ret != 0)) && derror $DRACUT_INSTALL ${initdir+-D "$initdir"} -a ${DRACUT_RESOLVE_DEPS+-l} ${DRACUT_FIPS_MODE+-H} "$@" || :
- return $ret
- }
-
- inst_library() {
- [[ -e ${initdir}/"${2:-$1}" ]] && return 0 # already there
- [[ -e $1 ]] || return 1 # no source
- $DRACUT_INSTALL ${initdir+-D "$initdir"} ${DRACUT_RESOLVE_DEPS+-l} ${DRACUT_FIPS_MODE+-H} "$@"
- (($? != 0)) && derror $DRACUT_INSTALL ${initdir+-D "$initdir"} ${DRACUT_RESOLVE_DEPS+-l} ${DRACUT_FIPS_MODE+-H} "$@" || :
- }
-
- inst_binary() {
- $DRACUT_INSTALL ${initdir+-D "$initdir"} ${DRACUT_RESOLVE_DEPS+-l} ${DRACUT_FIPS_MODE+-H} "$@"
- (($? != 0)) && derror $DRACUT_INSTALL ${initdir+-D "$initdir"} ${DRACUT_RESOLVE_DEPS+-l} ${DRACUT_FIPS_MODE+-H} "$@" || :
- }
-
- inst_script() {
- $DRACUT_INSTALL ${initdir+-D "$initdir"} ${DRACUT_RESOLVE_DEPS+-l} ${DRACUT_FIPS_MODE+-H} "$@"
- (($? != 0)) && derror $DRACUT_INSTALL ${initdir+-D "$initdir"} ${DRACUT_RESOLVE_DEPS+-l} ${DRACUT_FIPS_MODE+-H} "$@" || :
- }
-
-else
-
- # Install a directory, keeping symlinks as on the original system.
- # 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() {
- [[ -e ${initdir}/"$1" ]] && return 0 # already there
-
- local _dir="$1" _part="${1%/*}" _file
- while [[ "$_part" != "${_part%/*}" ]] && ! [[ -e "${initdir}/${_part}" ]]; do
- _dir="$_part $_dir"
- _part=${_part%/*}
- done
-
- # iterate over parent directories
- for _file in $_dir; do
- [[ -e "${initdir}/$_file" ]] && continue
- if [[ -L $_file ]]; then
- inst_symlink "$_file"
- else
- # create directory
- mkdir -m 0755 -p "${initdir}/$_file" || return 1
- [[ -e "$_file" ]] && chmod --reference="$_file" "${initdir}/$_file"
- chmod u+w "${initdir}/$_file"
- fi
- done
- }
- # $1 = file to copy to ramdisk
- # $2 (optional) Name for the file on the ramdisk
- # Location of the image dir is assumed to be $initdir
- # We never overwrite the target if it exists.
- inst_simple() {
- [[ -f "$1" ]] || return 1
- [[ "$1" == */* ]] || return 1
- local _src=$1 _target="${2:-$1}"
-
- [[ -L $_src ]] && { inst_symlink $_src $_target; return $?; }
-
- if ! [[ -d ${initdir}/$_target ]]; then
- [[ -e ${initdir}/$_target ]] && return 0
- [[ -L ${initdir}/$_target ]] && return 0
- [[ -d "${initdir}/${_target%/*}" ]] || inst_dir "${_target%/*}"
- fi
- if [[ $DRACUT_FIPS_MODE ]]; then
- # install checksum files also
- if [[ -e "${_src%/*}/.${_src##*/}.hmac" ]]; then
- inst "${_src%/*}/.${_src##*/}.hmac" "${_target%/*}/.${_target##*/}.hmac"
- fi
- if [[ -e "/lib/fipscheck/${_src##*/}.hmac" ]]; then
- inst "/lib/fipscheck/${_src##*/}.hmac" "/lib/fipscheck/${_target##*/}.hmac"
- fi
- if [[ -e "/lib64/fipscheck/${_src##*/}.hmac" ]]; then
- inst "/lib64/fipscheck/${_src##*/}.hmac" "/lib64/fipscheck/${_target##*/}.hmac"
- fi
- fi
- ddebug "Installing $_src"
- cp --reflink=auto --sparse=auto -pfL "$_src" "${initdir}/$_target"
- }
+if ! [[ $DRACUT_INSTALL ]]; then
+ DRACUT_INSTALL=$(find_binary dracut-install)
+fi
- # same as above, but specialized for symlinks
- inst_symlink() {
- local _src=$1 _target=${2:-$1} _realsrc
- [[ "$1" == */* ]] || return 1
- [[ -L $1 ]] || return 1
- [[ -L $initdir/$_target ]] && return 0
- _realsrc=$(readlink -f "$_src")
- if ! [[ -e $initdir/$_realsrc ]]; then
- if [[ -d $_realsrc ]]; then
- inst_dir "$_realsrc"
- else
- inst "$_realsrc"
- fi
- fi
- [[ ! -e $initdir/${_target%/*} ]] && inst_dir "${_target%/*}"
+if ! [[ $DRACUT_INSTALL ]] && [[ -x $dracutbasedir/dracut-install ]]; then
+ DRACUT_INSTALL=$dracutbasedir/dracut-install
+fi
- ln_r "${_realsrc}" "${_target}"
- }
+if ! [[ -x $DRACUT_INSTALL ]]; then
+ dfatal "dracut-install not found!"
+ exit 10
+fi
- # Same as above, but specialized to handle dynamic libraries.
- # It handles making symlinks according to how the original library
- # is referenced.
- inst_library() {
- local _src="$1" _dest=${2:-$1} _lib _reallib _symlink
- [[ "$1" == */* ]] || return 1
- [[ -e $initdir/$_dest ]] && return 0
- if [[ -L $_src ]]; then
- if [[ $DRACUT_FIPS_MODE ]]; then
- # install checksum files also
- if [[ -e "${_src%/*}/.${_src##*/}.hmac" ]]; then
- inst "${_src%/*}/.${_src##*/}.hmac" "${_dest%/*}/.${_dest##*/}.hmac"
- fi
- if [[ -e "/lib/fipscheck/${_src##*/}.hmac" ]]; then
- inst "/lib/fipscheck/${_src##*/}.hmac" "/lib/fipscheck/${_dest##*/}.hmac"
- fi
- if [[ -e "/lib64/fipscheck/${_src##*/}.hmac" ]]; then
- inst "/lib64/fipscheck/${_src##*/}.hmac" "/lib64/fipscheck/${_dest##*/}.hmac"
- fi
- fi
- _reallib=$(readlink -f "$_src")
- inst_simple "$_reallib" "$_reallib"
- inst_dir "${_dest%/*}"
- ln_r "${_reallib}" "${_dest}"
- else
- inst_simple "$_src" "$_dest"
- fi
+[[ $DRACUT_RESOLVE_LAZY ]] || export DRACUT_RESOLVE_DEPS=1
+inst_dir() {
+ [[ -e ${initdir}/"$1" ]] && return 0 # already there
+ $DRACUT_INSTALL ${initdir+-D "$initdir"} -d "$@"
+ (($? != 0)) && derror $DRACUT_INSTALL ${initdir+-D "$initdir"} -d "$@" || :
+}
- # Create additional symlinks. See rev_symlinks description.
- for _symlink in $(rev_lib_symlinks $_src) $(rev_lib_symlinks $_reallib); do
- [[ ! -e $initdir/$_symlink ]] && {
- ddebug "Creating extra symlink: $_symlink"
- inst_symlink $_symlink
- }
- done
- }
+inst() {
+ [[ -e ${initdir}/"${2:-$1}" ]] && return 0 # already there
+ #dinfo "$DRACUT_INSTALL -l $@"
+ $DRACUT_INSTALL ${initdir+-D "$initdir"} ${DRACUT_RESOLVE_DEPS+-l} ${DRACUT_FIPS_MODE+-H} "$@"
+ (($? != 0)) && derror $DRACUT_INSTALL ${initdir+-D "$initdir"} ${DRACUT_RESOLVE_DEPS+-l} ${DRACUT_FIPS_MODE+-H} "$@" || :
+}
- # Same as above, but specialized to install binary executables.
- # Install binary executable, and all shared library dependencies, if any.
- inst_binary() {
- local _bin _target
- _bin=$(find_binary "$1") || return 1
- _target=${2:-$_bin}
- [[ -e $initdir/$_target ]] && return 0
- local _file _line
- local _so_regex='([^ ]*/lib[^/]*/[^ ]*\.so[^ ]*)'
- # I love bash!
- LC_ALL=C ldd "$_bin" 2>/dev/null | while read _line; do
- [[ $_line = 'not a dynamic executable' ]] && break
-
- if [[ $_line =~ $_so_regex ]]; then
- _file=${BASH_REMATCH[1]}
- [[ -e ${initdir}/$_file ]] && continue
- inst_library "$_file"
- continue
- fi
+inst_simple() {
+ [[ -e ${initdir}/"${2:-$1}" ]] && return 0 # already there
+ [[ -e $1 ]] || return 1 # no source
+ $DRACUT_INSTALL ${initdir+-D "$initdir"} "$@"
+ (($? != 0)) && derror $DRACUT_INSTALL ${initdir+-D "$initdir"} "$@" || :
+}
- if [[ $_line == *not\ found* ]]; then
- dfatal "Missing a shared library required by $_bin."
- dfatal "Run \"ldd $_bin\" to find out what it is."
- dfatal "$_line"
- dfatal "dracut cannot create an initrd."
- exit 1
- fi
- done
- inst_simple "$_bin" "$_target"
- }
+inst_symlink() {
+ [[ -e ${initdir}/"${2:-$1}" ]] && return 0 # already there
+ [[ -L $1 ]] || return 1
+ $DRACUT_INSTALL ${initdir+-D "$initdir"} ${DRACUT_RESOLVE_DEPS+-l} ${DRACUT_FIPS_MODE+-H} "$@"
+ (($? != 0)) && derror $DRACUT_INSTALL ${initdir+-D "$initdir"} ${DRACUT_RESOLVE_DEPS+-l} ${DRACUT_FIPS_MODE+-H} "$@" || :
+}
- # same as above, except for shell scripts.
- # If your shell script does not start with shebang, it is not a shell script.
- inst_script() {
- local _bin
- _bin=$(find_binary "$1") || return 1
- shift
- local _line _shebang_regex
- read -r -n 80 _line <"$_bin"
- # If debug is set, clean unprintable chars to prevent messing up the term
- [[ $debug ]] && _line=$(echo -n "$_line" | tr -c -d '[:print:][:space:]')
- _shebang_regex='(#! *)(/[^ ]+).*'
- [[ $_line =~ $_shebang_regex ]] || return 1
- inst "${BASH_REMATCH[2]}" && inst_simple "$_bin" "$@"
- }
+dracut_install() {
+ local ret
+ #dinfo "initdir=$initdir $DRACUT_INSTALL -l $@"
+ $DRACUT_INSTALL ${initdir+-D "$initdir"} -a ${DRACUT_RESOLVE_DEPS+-l} ${DRACUT_FIPS_MODE+-H} "$@"
+ ret=$?
+ (($ret != 0)) && derror $DRACUT_INSTALL ${initdir+-D "$initdir"} -a ${DRACUT_RESOLVE_DEPS+-l} ${DRACUT_FIPS_MODE+-H} "$@" || :
+ return $ret
+}
- # general purpose installation function
- # Same args as above.
- inst() {
- local _x
-
- case $# in
- 1) ;;
- 2) [[ ! $initdir && -d $2 ]] && export initdir=$2
- [[ $initdir = $2 ]] && set $1;;
- 3) [[ -z $initdir ]] && export initdir=$2
- set $1 $3;;
- *) dfatal "inst only takes 1 or 2 or 3 arguments"
- exit 1;;
- esac
- for _x in inst_symlink inst_script inst_binary inst_simple; do
- $_x "$@" && return 0
- done
- return 1
- }
+inst_library() {
+ [[ -e ${initdir}/"${2:-$1}" ]] && return 0 # already there
+ [[ -e $1 ]] || return 1 # no source
+ $DRACUT_INSTALL ${initdir+-D "$initdir"} ${DRACUT_RESOLVE_DEPS+-l} ${DRACUT_FIPS_MODE+-H} "$@"
+ (($? != 0)) && derror $DRACUT_INSTALL ${initdir+-D "$initdir"} ${DRACUT_RESOLVE_DEPS+-l} ${DRACUT_FIPS_MODE+-H} "$@" || :
+}
- # dracut_install [-o ] <file> [<file> ... ]
- # Install <file> to the initramfs image
- # -o optionally install the <file> and don't fail, if it is not there
- dracut_install() {
- local _optional=no
- if [[ $1 = '-o' ]]; then
- _optional=yes
- shift
- fi
- while (($# > 0)); do
- if ! inst "$1" ; then
- if [[ $_optional = yes ]]; then
- dinfo "Skipping program $1 as it cannot be found and is" \
- "flagged to be optional"
- else
- dfatal "Failed to install $1"
- exit 1
- fi
- fi
- shift
- done
- }
+inst_binary() {
+ $DRACUT_INSTALL ${initdir+-D "$initdir"} ${DRACUT_RESOLVE_DEPS+-l} ${DRACUT_FIPS_MODE+-H} "$@"
+ (($? != 0)) && derror $DRACUT_INSTALL ${initdir+-D "$initdir"} ${DRACUT_RESOLVE_DEPS+-l} ${DRACUT_FIPS_MODE+-H} "$@" || :
+}
-fi
+inst_script() {
+ $DRACUT_INSTALL ${initdir+-D "$initdir"} ${DRACUT_RESOLVE_DEPS+-l} ${DRACUT_FIPS_MODE+-H} "$@"
+ (($? != 0)) && derror $DRACUT_INSTALL ${initdir+-D "$initdir"} ${DRACUT_RESOLVE_DEPS+-l} ${DRACUT_FIPS_MODE+-H} "$@" || :
+}
# find symlinks linked to given library file
# $1 = library file

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,31 @@
From 8652d5493d139105620ab82f34334f8acae13f13 Mon Sep 17 00:00:00 2001
From: Harald Hoyer <harald@redhat.com>
Date: Tue, 6 Aug 2013 11:01:45 +0200
Subject: [PATCH] 51-dracut-rescue.install: fixed rescue image creation
---
51-dracut-rescue.install | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/51-dracut-rescue.install b/51-dracut-rescue.install
index 39d01a7..b655bc2 100755
--- a/51-dracut-rescue.install
+++ b/51-dracut-rescue.install
@@ -6,6 +6,9 @@ export LANG=C
COMMAND="$1"
KERNEL_VERSION="$2"
+BOOT_DIR_ABS="${3%/*}/0-rescue"
+KERNEL_IMAGE="$4"
+
dropindirs_sort()
{
@@ -50,7 +53,6 @@ fi
LOADER_ENTRY="/boot/loader/entries/${MACHINE_ID}-0-rescue.conf"
BOOT_DIR="/${MACHINE_ID}/0-rescue"
-BOOT_DIR_ABS="/boot${BOOT_DIR}"
ret=0

View File

@ -0,0 +1,43 @@
From 5ae33613ab3145db12f21bca491d97832160cc1a Mon Sep 17 00:00:00 2001
From: Harald Hoyer <harald@redhat.com>
Date: Tue, 6 Aug 2013 11:43:58 +0200
Subject: [PATCH] dracut.sh: do not strip in FIPS mode
---
dracut.sh | 22 ++++------------------
1 file changed, 4 insertions(+), 18 deletions(-)
diff --git a/dracut.sh b/dracut.sh
index e119bd2..4ef71f3 100755
--- a/dracut.sh
+++ b/dracut.sh
@@ -1209,25 +1209,11 @@ if [[ $do_strip = yes ]] ; then
done
fi
-if [[ $do_strip = yes ]] ; then
+if [[ $do_strip = yes ]] && ! [[ $DRACUT_FIPS_MODE ]]; then
dinfo "*** Stripping files ***"
- if [[ $DRACUT_FIPS_MODE ]]; then
- find "$initdir" -type f \
- -executable -not -path '*/lib/modules/*.ko' -print0 \
- | while read -r -d $'\0' f; do
- if ! [[ -e "${f%/*}/.${f##*/}.hmac" ]] \
- && ! [[ -e "/lib/hmaccalc/${f##*/}.hmac" ]] \
- && ! [[ -e "/lib64/hmaccalc/${f##*/}.hmac" ]] \
- && ! [[ -e "/lib/fipscheck/${f##*/}.hmac" ]] \
- && ! [[ -e "/lib64/fipscheck/${f##*/}.hmac" ]]; then
- printf "%s\000" "$f";
- fi
- done | xargs -r -0 strip -g 2>/dev/null
- else
- find "$initdir" -type f \
- -executable -not -path '*/lib/modules/*.ko' -print0 \
- | xargs -r -0 strip -g 2>/dev/null
- fi
+ find "$initdir" -type f \
+ -executable -not -path '*/lib/modules/*.ko' -print0 \
+ | xargs -r -0 strip -g 2>/dev/null
# strip kernel modules, but do not touch signed modules
find "$initdir" -type f -path '*/lib/modules/*.ko' -print0 \

View File

@ -0,0 +1,26 @@
From aacdba2bdb3efddd7b3b9cdb149204d86f5020b0 Mon Sep 17 00:00:00 2001
From: Harald Hoyer <harald@redhat.com>
Date: Tue, 6 Aug 2013 16:56:42 +0200
Subject: [PATCH] dracut.sh: check the value of --kver
https://bugzilla.redhat.com/show_bug.cgi?id=993327
---
dracut.sh | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/dracut.sh b/dracut.sh
index 4ef71f3..0b674ae 100755
--- a/dracut.sh
+++ b/dracut.sh
@@ -478,6 +478,11 @@ if [[ $regenerate_all == "yes" ]]; then
((ret+=$?))
done
exit $ret
+elif [[ $kernel ]]; then
+ if ! [[ -d /lib/modules/$kernel ]] && [[ $no_kernel != yes ]]; then
+ printf -- "Kernel version $kernel has no modules in /lib/modules/$kernel\n" >&2
+ exit 1
+ fi
fi
if ! [[ $kernel ]]; then

View File

@ -0,0 +1,24 @@
From 7deba0428a23b3f410a7cf8cac7cf8355e4dc150 Mon Sep 17 00:00:00 2001
From: James Lee <jlee@thestaticvoid.com>
Date: Tue, 6 Aug 2013 11:25:58 -0400
Subject: [PATCH] crypt: Fix typo--/etc/crypttab not /etc/cryptab
1ae8b8a breaks the crypt module for those who use keyfiles due to a
typo leading to the exclusion of /etc/crypttab from the initrd.
---
modules.d/90crypt/module-setup.sh | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/modules.d/90crypt/module-setup.sh b/modules.d/90crypt/module-setup.sh
index 975f115..68b5fbe 100755
--- a/modules.d/90crypt/module-setup.sh
+++ b/modules.d/90crypt/module-setup.sh
@@ -57,7 +57,7 @@ install() {
inst_hook cleanup 30 "$moddir/crypt-cleanup.sh"
fi
- if [[ $hostonly ]] && [[ -f /etc/cryptab ]]; then
+ if [[ $hostonly ]] && [[ -f /etc/crypttab ]]; then
# filter /etc/crypttab for the devices we need
while read _mapper _dev _rest; do
[[ $_mapper = \#* ]] && continue

View File

@ -0,0 +1,58 @@
From 0b11ea71996a7b804afbc38d1d5461fb0f4ef882 Mon Sep 17 00:00:00 2001
From: Harald Hoyer <harald@redhat.com>
Date: Wed, 7 Aug 2013 16:05:03 +0200
Subject: [PATCH] network/net-lib.sh: fix ibft interface configuration
also skip ibft$num names, which have been already given
https://bugzilla.redhat.com/show_bug.cgi?id=989944
---
modules.d/40network/net-lib.sh | 16 ++++++++++++++--
1 file changed, 14 insertions(+), 2 deletions(-)
diff --git a/modules.d/40network/net-lib.sh b/modules.d/40network/net-lib.sh
index 494960c..ca4b393 100644
--- a/modules.d/40network/net-lib.sh
+++ b/modules.d/40network/net-lib.sh
@@ -172,13 +172,20 @@ save_netinfo() {
}
set_ifname() {
- local name="$1" mac="$2" num=0 n=""
+ local name="$1" mac="$2" num=-1 n=""
# if it's already set, return the existing name
for n in $(getargs ifname=); do
strstr "$n" "$mac" && echo ${n%%:*} && return
done
# otherwise, pick a new name and use that
- while [ -e /sys/class/net/$name$num ]; do num=$(($num+1)); done
+ while :; do
+ num=$(($num+1));
+ [ -e /sys/class/net/$name$num ] && continue
+ for n in $(getargs ifname=); do
+ [ "$name$num" = "${n%%:*}" ] && continue 2
+ done
+ break
+ done
echo "ifname=$name$num:$mac" >> /etc/cmdline.d/45-ifname.conf
echo "$name$num"
}
@@ -205,6 +212,9 @@ ibft_to_cmdline() {
mac=$(read a < ${iface}/mac; echo $a)
[ -z "$mac" ] && continue
dev=$(set_ifname ibft $mac)
+
+ [ -e /tmp/net.${dev}.has_ibft_config ] && continue
+
[ -e ${iface}/dhcp ] && dhcp=$(read a < ${iface}/dhcp; echo $a)
if [ -e ${iface}/vlan ]; then
vlan=$(read a < ${iface}/vlan; echo $a)
@@ -215,6 +225,8 @@ ibft_to_cmdline() {
echo "ip=$dev:dhcp"
elif [ -e ${iface}/ip-addr ]; then
[ -e ${iface}/ip-addr ] && ip=$(read a < ${iface}/ip-addr; echo $a)
+ # skip not assigned ip adresses
+ [ "$ip" = "0.0.0.0" ] && continue
[ -e ${iface}/gateway ] && gw=$(read a < ${iface}/gateway; echo $a)
[ -e ${iface}/subnet-mask ] && mask=$(read a < ${iface}/subnet-mask; echo $a)
[ -e ${iface}/hostname ] && hostname=$(read a < ${iface}/hostname; echo $a)

View File

@ -0,0 +1,24 @@
From 7929ec198fa693f07160518b6858e967fdd53f48 Mon Sep 17 00:00:00 2001
From: Harald Hoyer <harald@redhat.com>
Date: Fri, 9 Aug 2013 10:33:27 +0200
Subject: [PATCH] iscsi/module-setup.sh: install some modules regardless of
hostonly
---
modules.d/95iscsi/module-setup.sh | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/modules.d/95iscsi/module-setup.sh b/modules.d/95iscsi/module-setup.sh
index 3f817ec..502e834 100755
--- a/modules.d/95iscsi/module-setup.sh
+++ b/modules.d/95iscsi/module-setup.sh
@@ -36,7 +36,8 @@ depends() {
installkernel() {
local _arch=$(uname -m)
- instmods iscsi_tcp iscsi_ibft crc32c bnx2i iscsi_boot_sysfs qla4xxx cxgb3i cxgb4i be2iscsi
+ instmods bnx2i qla4xxx cxgb3i cxgb4i be2iscsi
+ hostonly="" instmods iscsi_tcp iscsi_ibft crc32c iscsi_boot_sysfs
iscsi_module_filter() {
local _funcs='iscsi_register_transport'
# subfunctions inherit following FDs

View File

@ -0,0 +1,41 @@
From e84d115b93428bf93e82a2c808721aadc048b163 Mon Sep 17 00:00:00 2001
From: Harald Hoyer <harald@redhat.com>
Date: Fri, 9 Aug 2013 10:44:34 +0200
Subject: [PATCH] multipath: need_shutdown if multipath devices exist
https://bugzilla.redhat.com/show_bug.cgi?id=994913
---
modules.d/90multipath/module-setup.sh | 3 +++
modules.d/90multipath/multipathd-needshutdown.sh | 9 +++++++++
2 files changed, 12 insertions(+)
create mode 100755 modules.d/90multipath/multipathd-needshutdown.sh
diff --git a/modules.d/90multipath/module-setup.sh b/modules.d/90multipath/module-setup.sh
index 6cdc511..feb58dc 100755
--- a/modules.d/90multipath/module-setup.sh
+++ b/modules.d/90multipath/module-setup.sh
@@ -95,6 +95,9 @@ install() {
inst_hook pre-trigger 02 "$moddir/multipathd.sh"
inst_hook cleanup 02 "$moddir/multipathd-stop.sh"
fi
+
+ inst_hook cleanup 80 "$moddir/multipathd-needshutdown.sh"
+
inst_rules 40-multipath.rules 62-multipath.rules 65-multipath.rules 66-kpartx.rules
}
diff --git a/modules.d/90multipath/multipathd-needshutdown.sh b/modules.d/90multipath/multipathd-needshutdown.sh
new file mode 100755
index 0000000..1565d4d
--- /dev/null
+++ b/modules.d/90multipath/multipathd-needshutdown.sh
@@ -0,0 +1,9 @@
+#!/bin/sh
+# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
+# ex: ts=8 sw=4 sts=4 et filetype=sh
+
+for i in /dev/mapper/mpath*; do
+ [ -b "$i" ] || continue
+ need_shutdown
+ break
+done

View File

@ -0,0 +1,30 @@
From beb26a084794a4bc8baffc8384cb8e41844f89f9 Mon Sep 17 00:00:00 2001
From: "dyoung@redhat.com" <dyoung@redhat.com>
Date: Thu, 8 Aug 2013 14:05:02 +0800
Subject: [PATCH] omit drivers fix
Because omit_drivers list use underline always, so when maching with it
the _mod need to be converted as well or sometimes omit-drivers will fail
silently.
Fix this by replace '-' with '_' in instmods function.
Signed-off-by: Dave Young <dyoung@redhat.com>
---
dracut-functions.sh | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/dracut-functions.sh b/dracut-functions.sh
index fbe0633..6033a1a 100755
--- a/dracut-functions.sh
+++ b/dracut-functions.sh
@@ -1420,7 +1420,8 @@ instmods() {
return $_ret
fi
- if [[ $omit_drivers ]] && [[ "$1" =~ $omit_drivers ]]; then
+ _mod=${_mod/-/_}
+ if [[ $omit_drivers ]] && [[ "$_mod" =~ $omit_drivers ]]; then
dinfo "Omitting driver ${_mod##$srcmods}"
return 0
fi

View File

@ -10,7 +10,7 @@
Name: dracut
Version: 031
Release: 7.git20130801%{?dist}
Release: 22.git20130809%{?dist}
Summary: Initramfs generator using udev
%if 0%{?fedora} || 0%{?rhel}
@ -35,6 +35,21 @@ Patch3: 0003-Change-the-implementation-of-action_on_fail.patch
Patch4: 0004-lvm-add-yes-to-lvm-lvchange.patch
Patch5: 0005-cms-cmssetup.sh-correct-port-for-zfcp.conf.patch
Patch6: 0006-95terminfo-install-vt102.patch
Patch7: 0007-lsinitrd.sh-add-old-cpio-signature.patch
Patch8: 0008-dracut.sh-call-find-with-print0-and-cpio-with-null.patch
Patch9: 0009-dracut.asc-small-corrections.patch
Patch10: 0010-systemd-dracut-initqueue.sh-continue-to-boot-if-fini.patch
Patch11: 0011-dracut.sh-dracut-functions.sh-handle-root-on-non-blo.patch
Patch12: 0012-dracut-functions.sh-removed-non-dracut-install-shell.patch
Patch13: 0013-dracut-functions.sh-inst_multiple-dracut_install.patch
Patch14: 0014-51-dracut-rescue.install-fixed-rescue-image-creation.patch
Patch15: 0015-dracut.sh-do-not-strip-in-FIPS-mode.patch
Patch16: 0016-dracut.sh-check-the-value-of-kver.patch
Patch17: 0017-crypt-Fix-typo-etc-crypttab-not-etc-cryptab.patch
Patch18: 0018-network-net-lib.sh-fix-ibft-interface-configuration.patch
Patch19: 0019-iscsi-module-setup.sh-install-some-modules-regardles.patch
Patch20: 0020-multipath-need_shutdown-if-multipath-devices-exist.patch
Patch21: 0021-omit-drivers-fix.patch
BuildRequires: bash git
@ -450,6 +465,25 @@ rm -rf -- $RPM_BUILD_ROOT
%endif
%changelog
* Fri Aug 09 2013 Harald Hoyer <harald@redhat.com> 031-22.git20130809
- lsinitrd.sh: add old cpio signature
- dracut.sh: call find with -print0 and cpio with --null
- dracut.asc: small corrections
- systemd/dracut-initqueue.sh: continue to boot if finished failed
- dracut.sh/dracut-functions.sh: handle root on non-block device
- dracut-functions.sh: removed non dracut-install shell functions
- dracut-functions.sh: inst_multiple == dracut_install
- 51-dracut-rescue.install: fixed rescue image creation
- dracut.sh: do not strip in FIPS mode
Resolves: rhbz#990250
- dracut.sh: check the value of --kver
- crypt: Fix typo--/etc/crypttab not /etc/cryptab
- network/net-lib.sh: fix ibft interface configuration
- iscsi/module-setup.sh: install some modules regardless of hostonly
- multipath: need_shutdown if multipath devices exist
Resolves: rhbz#994913
- omit drivers fix
* Thu Aug 01 2013 Harald Hoyer <harald@redhat.com> 031-7.git20130801
- also install vt102 terminfo