diff --git a/0048-remove-the-incomplete-.img-file.patch b/0048-remove-the-incomplete-.img-file.patch new file mode 100644 index 0000000..f554694 --- /dev/null +++ b/0048-remove-the-incomplete-.img-file.patch @@ -0,0 +1,31 @@ +From 7eeaa4ab146907eb56bc03d4aeba1feea8357c1e Mon Sep 17 00:00:00 2001 +From: Chao Fan +Date: Tue, 21 Jul 2015 17:18:42 +0800 +Subject: [PATCH] remove the incomplete .img file + +If the directory where the .img file is saved has no enough space, or in +other wrong conditions, dracut will get an incomplete file xxx.img. But +sometimes this .img file will be loaded when rebooting the system. And then +some bugs will happen because this .img file is wrong. + +So I think dracut should remove the incomplete file because this .img file +with problems was made by dracut. And then the wrong file will not be loaded +anymore. + +Signed-off-by: Chao Fan +--- + dracut.sh | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/dracut.sh b/dracut.sh +index ee0a039..122ae0c 100755 +--- a/dracut.sh ++++ b/dracut.sh +@@ -1651,6 +1651,7 @@ if ! ( + | $compress >> "$outfile" + ); then + dfatal "dracut: creation of $outfile failed" ++ rm -f $outfile + exit 1 + fi + dinfo "*** Creating initrd image file '$outfile' done ***" diff --git a/0048-Cleanup-compressor-handling.patch b/0049-Cleanup-compressor-handling.patch similarity index 100% rename from 0048-Cleanup-compressor-handling.patch rename to 0049-Cleanup-compressor-handling.patch diff --git a/0049-Add-missing-echo-to-output-the-result.patch b/0050-Add-missing-echo-to-output-the-result.patch similarity index 100% rename from 0049-Add-missing-echo-to-output-the-result.patch rename to 0050-Add-missing-echo-to-output-the-result.patch diff --git a/0050-crypt-s-allow-discards-discard-for-crypttab.patch b/0051-crypt-s-allow-discards-discard-for-crypttab.patch similarity index 100% rename from 0050-crypt-s-allow-discards-discard-for-crypttab.patch rename to 0051-crypt-s-allow-discards-discard-for-crypttab.patch diff --git a/0051-qemu-add-spapr-vscsi-kernel-module.patch b/0052-qemu-add-spapr-vscsi-kernel-module.patch similarity index 100% rename from 0051-qemu-add-spapr-vscsi-kernel-module.patch rename to 0052-qemu-add-spapr-vscsi-kernel-module.patch diff --git a/0053-dracut-initramfs-restore-make-mount-error-nonfatal.patch b/0053-dracut-initramfs-restore-make-mount-error-nonfatal.patch new file mode 100644 index 0000000..f14429b --- /dev/null +++ b/0053-dracut-initramfs-restore-make-mount-error-nonfatal.patch @@ -0,0 +1,25 @@ +From da5304aabcb7c1b541a8eeabc69627f05ad47c09 Mon Sep 17 00:00:00 2001 +From: Alexander Tsoy +Date: Tue, 28 Jul 2015 14:55:59 +0300 +Subject: [PATCH] dracut-initramfs-restore: make mount error nonfatal + +Script enables errexit option (set -e). So if /boot is not a mount point +or is already mounted, then script dies after unsuccessful mount +command. Fix this by always returning successful result. +--- + dracut-initramfs-restore.sh | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/dracut-initramfs-restore.sh b/dracut-initramfs-restore.sh +index 0e6a1a8..0c41a59 100644 +--- a/dracut-initramfs-restore.sh ++++ b/dracut-initramfs-restore.sh +@@ -14,7 +14,7 @@ SKIP="$dracutbasedir/skipcpio" + + [[ -f /etc/machine-id ]] && read MACHINE_ID < /etc/machine-id + +-mount -o ro /boot &>/dev/null ++mount -o ro /boot &>/dev/null || true + + if [[ $MACHINE_ID ]] && [[ -d /boot/${MACHINE_ID} || -L /boot/${MACHINE_ID} ]] ; then + IMG="/boot/${MACHINE_ID}/${KERNEL_VERSION}/initrd" diff --git a/0052-dracut.sh-simplify-modalias-reading.patch b/0054-dracut.sh-simplify-modalias-reading.patch similarity index 100% rename from 0052-dracut.sh-simplify-modalias-reading.patch rename to 0054-dracut.sh-simplify-modalias-reading.patch diff --git a/0053-90qemu-fixed-systemd-detect-virt-output-parsing.patch b/0055-90qemu-fixed-systemd-detect-virt-output-parsing.patch similarity index 100% rename from 0053-90qemu-fixed-systemd-detect-virt-output-parsing.patch rename to 0055-90qemu-fixed-systemd-detect-virt-output-parsing.patch diff --git a/0054-Remove-98integrity-s-dependency-on-selinux.patch b/0056-Remove-98integrity-s-dependency-on-selinux.patch similarity index 100% rename from 0054-Remove-98integrity-s-dependency-on-selinux.patch rename to 0056-Remove-98integrity-s-dependency-on-selinux.patch diff --git a/0055-Extend-evm-enable.sh-to-load-the-EVM-public-key.patch b/0057-Extend-evm-enable.sh-to-load-the-EVM-public-key.patch similarity index 100% rename from 0055-Extend-evm-enable.sh-to-load-the-EVM-public-key.patch rename to 0057-Extend-evm-enable.sh-to-load-the-EVM-public-key.patch diff --git a/0056-Define-new-script-to-load-keys-on-the-IMA-keyring-up.patch b/0058-Define-new-script-to-load-keys-on-the-IMA-keyring-up.patch similarity index 100% rename from 0056-Define-new-script-to-load-keys-on-the-IMA-keyring-up.patch rename to 0058-Define-new-script-to-load-keys-on-the-IMA-keyring-up.patch diff --git a/0057-Revert-securitfs-change.patch b/0059-Revert-securitfs-change.patch similarity index 100% rename from 0057-Revert-securitfs-change.patch rename to 0059-Revert-securitfs-change.patch diff --git a/0058-base-dracut-lib.sh-Dup-stdout-and-stderr.patch b/0060-base-dracut-lib.sh-Dup-stdout-and-stderr.patch similarity index 100% rename from 0058-base-dracut-lib.sh-Dup-stdout-and-stderr.patch rename to 0060-base-dracut-lib.sh-Dup-stdout-and-stderr.patch diff --git a/0059-dracut.sh-remove-quotes-from-install_items-and-insta.patch b/0061-dracut.sh-remove-quotes-from-install_items-and-insta.patch similarity index 100% rename from 0059-dracut.sh-remove-quotes-from-install_items-and-insta.patch rename to 0061-dracut.sh-remove-quotes-from-install_items-and-insta.patch diff --git a/0062-network-net-lib.sh-add-is_ip.patch b/0062-network-net-lib.sh-add-is_ip.patch new file mode 100644 index 0000000..94db0bb --- /dev/null +++ b/0062-network-net-lib.sh-add-is_ip.patch @@ -0,0 +1,32 @@ +From 01b23b6900eabefbfd1f589b9f12c8ff38c5afc0 Mon Sep 17 00:00:00 2001 +From: Harald Hoyer +Date: Wed, 12 Aug 2015 14:24:05 +0200 +Subject: [PATCH] network/net-lib.sh: add is_ip() + +add function to test if string is a valid IP +--- + modules.d/40network/net-lib.sh | 12 ++++++++++++ + 1 file changed, 12 insertions(+) + +diff --git a/modules.d/40network/net-lib.sh b/modules.d/40network/net-lib.sh +index 68bc095..5c65a2e 100755 +--- a/modules.d/40network/net-lib.sh ++++ b/modules.d/40network/net-lib.sh +@@ -1,5 +1,17 @@ + #!/bin/sh + ++is_ip() { ++ echo "$1" | { ++ IFS=. read a b c d ++ test "$a" -ge 0 -a "$a" -le 255 \ ++ -a "$b" -ge 0 -a "$b" -le 255 \ ++ -a "$c" -ge 0 -a "$c" -le 255 \ ++ -a "$d" -ge 0 -a "$d" -le 255 \ ++ 2> /dev/null ++ } && return 0 ++ return 1 ++} ++ + get_ip() { + local iface="$1" ip="" + ip=$(ip -o -f inet addr show $iface) diff --git a/0063-systemd-add-systemd-run-and-systemd-escape.patch b/0063-systemd-add-systemd-run-and-systemd-escape.patch new file mode 100644 index 0000000..825a618 --- /dev/null +++ b/0063-systemd-add-systemd-run-and-systemd-escape.patch @@ -0,0 +1,21 @@ +From b1b704bd67d0b397585618affcf12ad30ceae183 Mon Sep 17 00:00:00 2001 +From: Harald Hoyer +Date: Wed, 12 Aug 2015 14:24:45 +0200 +Subject: [PATCH] systemd: add systemd-run and systemd-escape + +--- + modules.d/00systemd/module-setup.sh | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/modules.d/00systemd/module-setup.sh b/modules.d/00systemd/module-setup.sh +index e763d9f..da95aee 100755 +--- a/modules.d/00systemd/module-setup.sh ++++ b/modules.d/00systemd/module-setup.sh +@@ -129,6 +129,7 @@ install() { + echo swapoff \ + kmod insmod rmmod modprobe modinfo depmod lsmod \ + mount umount reboot poweroff \ ++ systemd-run systemd-escape \ + systemd-cgls systemd-tmpfiles + + inst_multiple -o \ diff --git a/0064-network-parse-ip-opts.sh-assume-rd.neednet-for-multi.patch b/0064-network-parse-ip-opts.sh-assume-rd.neednet-for-multi.patch new file mode 100644 index 0000000..c253c83 --- /dev/null +++ b/0064-network-parse-ip-opts.sh-assume-rd.neednet-for-multi.patch @@ -0,0 +1,37 @@ +From 4e9ba952bfa607ac47bfe3cf4943ae3386da22bc Mon Sep 17 00:00:00 2001 +From: Harald Hoyer +Date: Wed, 12 Aug 2015 14:25:23 +0200 +Subject: [PATCH] network/parse-ip-opts.sh: assume rd.neednet for multiple ip + options + +set rd.neednet on the kernel cmdline to disable this behaviour +--- + modules.d/40network/parse-ip-opts.sh | 8 +++++--- + 1 file changed, 5 insertions(+), 3 deletions(-) + +diff --git a/modules.d/40network/parse-ip-opts.sh b/modules.d/40network/parse-ip-opts.sh +index a481b46..33bb068 100755 +--- a/modules.d/40network/parse-ip-opts.sh ++++ b/modules.d/40network/parse-ip-opts.sh +@@ -36,8 +36,10 @@ unset count + # If needed, check if bootdev= contains anything usable + BOOTDEV=$(getarg bootdev=) + +-if [ -n "$NEEDBOOTDEV" ] ; then +- [ -z "$BOOTDEV" ] && warn "Please supply bootdev argument for multiple ip= lines" ++if [ -n "$NEEDBOOTDEV" ] && getargbool 1 rd.neednet; then ++ #[ -z "$BOOTDEV" ] && warn "Please supply bootdev argument for multiple ip= lines" ++ echo "rd.neednet=1" > /etc/cmdline.d/dracut-neednet.conf ++ info "Multiple ip= arguments: assuming rd.neednet=1" + fi + + # Check ip= lines +@@ -48,7 +50,7 @@ for p in $(getargs ip=); do + # make first device specified the BOOTDEV + if [ -z "$BOOTDEV" ] && [ -n "$dev" ]; then + BOOTDEV="$dev" +- [ -n "$NEEDBOOTDEV" ] && warn "Setting bootdev to '$BOOTDEV'" ++ [ -n "$NEEDBOOTDEV" ] && info "Setting bootdev to '$BOOTDEV'" + fi + + # skip ibft since we did it above diff --git a/0065-nfs-parse-nfsroot.sh-silence-useless-warning-if-netr.patch b/0065-nfs-parse-nfsroot.sh-silence-useless-warning-if-netr.patch new file mode 100644 index 0000000..9b690d3 --- /dev/null +++ b/0065-nfs-parse-nfsroot.sh-silence-useless-warning-if-netr.patch @@ -0,0 +1,23 @@ +From 50e86bf02be003f3de6214f8012e62edde0085fc Mon Sep 17 00:00:00 2001 +From: Harald Hoyer +Date: Wed, 12 Aug 2015 14:27:01 +0200 +Subject: [PATCH] nfs/parse-nfsroot.sh: silence useless warning if netroot is + not nfs + +--- + modules.d/95nfs/parse-nfsroot.sh | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/modules.d/95nfs/parse-nfsroot.sh b/modules.d/95nfs/parse-nfsroot.sh +index 2200cad..54f73d8 100755 +--- a/modules.d/95nfs/parse-nfsroot.sh ++++ b/modules.d/95nfs/parse-nfsroot.sh +@@ -38,7 +38,7 @@ if [ -n "$netroot" ] ; then + [ "$n" = "$netroot" ] && break + done + if [ "$n" = "$netroot" ]; then +- warn "Ignoring netroot argument for NFS" ++ #warn "Ignoring netroot argument for NFS" + netroot=$root + fi + else diff --git a/0066-dracut-systemd-dracut-initqueue.sh-be-verbose-about-.patch b/0066-dracut-systemd-dracut-initqueue.sh-be-verbose-about-.patch new file mode 100644 index 0000000..dcbc9ae --- /dev/null +++ b/0066-dracut-systemd-dracut-initqueue.sh-be-verbose-about-.patch @@ -0,0 +1,22 @@ +From 8ba684be1c04976204d2b671ab90cb27791f467b Mon Sep 17 00:00:00 2001 +From: Harald Hoyer +Date: Wed, 12 Aug 2015 14:27:39 +0200 +Subject: [PATCH] dracut-systemd/dracut-initqueue.sh: be verbose about timeout + +Issue a warning, if timeout scripts are executed +--- + modules.d/98dracut-systemd/dracut-initqueue.sh | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/modules.d/98dracut-systemd/dracut-initqueue.sh b/modules.d/98dracut-systemd/dracut-initqueue.sh +index af9cec2..881f639 100755 +--- a/modules.d/98dracut-systemd/dracut-initqueue.sh ++++ b/modules.d/98dracut-systemd/dracut-initqueue.sh +@@ -55,6 +55,7 @@ while :; do + done + + if [ $main_loop -gt $((2*$RDRETRY/3)) ]; then ++ warn "dracut-initqueue timeout - starting timeout scripts" + for job in $hookdir/initqueue/timeout/*.sh; do + [ -e "$job" ] || break + job=$job . $job diff --git a/0067-base-dracut-lib.sh-forget-about-the-idea-of-output-r.patch b/0067-base-dracut-lib.sh-forget-about-the-idea-of-output-r.patch new file mode 100644 index 0000000..2e341a4 --- /dev/null +++ b/0067-base-dracut-lib.sh-forget-about-the-idea-of-output-r.patch @@ -0,0 +1,65 @@ +From f41720c3115011afb9577ed063a4bc521dc707ec Mon Sep 17 00:00:00 2001 +From: Harald Hoyer +Date: Wed, 12 Aug 2015 14:28:45 +0200 +Subject: [PATCH] base/dracut-lib.sh: forget about the idea of output + redirection + +It's just not working :-/ +--- + modules.d/99base/dracut-lib.sh | 24 ++++-------------------- + 1 file changed, 4 insertions(+), 20 deletions(-) + +diff --git a/modules.d/99base/dracut-lib.sh b/modules.d/99base/dracut-lib.sh +index 200c263..1eaf4b3 100755 +--- a/modules.d/99base/dracut-lib.sh ++++ b/modules.d/99base/dracut-lib.sh +@@ -51,45 +51,29 @@ str_ends() { + [ "${1%*"$2"}" != "$1" ] + } + +-# Dup stdout and stderr, so that subshell redirection does not affect logging. +-if [ -z "$DRACUT_STDOUT" ]; then +- if [ -n "$BASH" ]; then +- readonly DRACUT_STDOUT=98 +- readonly DRACUT_STDERR=98 +- exec 98>&1 +- exec 99>&2 +- else +- readonly DRACUT_STDOUT=8 +- readonly DRACUT_STDERR=9 +- exec 8>&1 +- exec 9>&2 +- fi +-fi +- +- + if [ -z "$DRACUT_SYSTEMD" ]; then + + warn() { + check_quiet + echo "<28>dracut Warning: $*" > /dev/kmsg +- echo "dracut Warning: $*" >&$DRACUT_STDERR ++ echo "dracut Warning: $*" >&2 + } + + info() { + check_quiet + echo "<30>dracut: $*" > /dev/kmsg + [ "$DRACUT_QUIET" != "yes" ] && \ +- echo "dracut: $*" >&$DRACUT_STDERR ++ echo "dracut: $*" >&2 + } + + else + + warn() { +- echo "Warning: $*" >&$DRACUT_STDERR ++ echo "Warning: $*" >&2 + } + + info() { +- echo "$*" >&$DRACUT_STDOUT ++ echo "$*" + } + + fi diff --git a/0068-iscsi-integrate-with-systemd-and-improve-robustness.patch b/0068-iscsi-integrate-with-systemd-and-improve-robustness.patch new file mode 100644 index 0000000..d3cdddb --- /dev/null +++ b/0068-iscsi-integrate-with-systemd-and-improve-robustness.patch @@ -0,0 +1,295 @@ +From d94050ddaea8343d8adb8f151c8f4cad591d29d9 Mon Sep 17 00:00:00 2001 +From: Harald Hoyer +Date: Wed, 12 Aug 2015 14:33:49 +0200 +Subject: [PATCH] iscsi: integrate with systemd and improve robustness + +parse-cmdline sets up an initial initiator-name to let iscsid start. + +iscsid is started before doing any iscsistart business. + +iscsistart is done with systemd-run asynchrone to do things in +paralllel. Also restarted for every new interface which shows up. + +If rd.iscsi.waitnet (default) is set, iscsistart is done only +after all interfaces are up. + +If not all interfaces are up and rd.iscsi.testroute (default) is set, +the route to a iscsi target IP is checked and skipped, if there is none. + +If all things fail, we issue a "dummy" interface iscsiroot to retry +everything in the initqueue/timeout. +--- + modules.d/95iscsi/cleanup-iscsi.sh | 2 +- + modules.d/95iscsi/iscsiroot.sh | 116 ++++++++++++++++++++++++----------- + modules.d/95iscsi/module-setup.sh | 31 ++++++++++ + modules.d/95iscsi/parse-iscsiroot.sh | 13 +++- + 4 files changed, 125 insertions(+), 37 deletions(-) + +diff --git a/modules.d/95iscsi/cleanup-iscsi.sh b/modules.d/95iscsi/cleanup-iscsi.sh +index e97d65a..bfc8aef 100755 +--- a/modules.d/95iscsi/cleanup-iscsi.sh ++++ b/modules.d/95iscsi/cleanup-iscsi.sh +@@ -1,4 +1,4 @@ + #!/bin/sh + +-[ -e /sys/module/bnx2i ] && killproc iscsiuio ++[ -z "${DRACUT_SYSTEMD}" ] && [ -e /sys/module/bnx2i ] && killproc iscsiuio + +diff --git a/modules.d/95iscsi/iscsiroot.sh b/modules.d/95iscsi/iscsiroot.sh +index 460e438..fc62425 100755 +--- a/modules.d/95iscsi/iscsiroot.sh ++++ b/modules.d/95iscsi/iscsiroot.sh +@@ -36,7 +36,7 @@ iroot=${iroot#:} + # figured out a way how to check whether this is built-in or not + modprobe crc32c 2>/dev/null + +-if [ -e /sys/module/bnx2i ] && ! [ -e /tmp/iscsiuio-started ]; then ++if [ -z "${DRACUT_SYSTEMD}" ] && [ -e /sys/module/bnx2i ] && ! [ -e /tmp/iscsiuio-started ]; then + iscsiuio + > /tmp/iscsiuio-started + fi +@@ -105,28 +105,47 @@ handle_netroot() + + parse_iscsi_root "$1" || return 1 + ++ # Bail out early, if there is no route to the destination ++ if is_ip "$iscsi_target_ip" && [ "$netif" != "dummy" ] && ! all_ifaces_up && getargbool 1 rd.iscsi.testroute; then ++ ip route get "$iscsi_target_ip" >/dev/null 2>&1 || return 0 ++ fi ++ + # XXX is this needed? + getarg ro && iscsirw=ro + getarg rw && iscsirw=rw + fsopts=${fsopts:+$fsopts,}${iscsirw} + ++ if [ -z $iscsi_initiator ] && [ -f /sys/firmware/ibft/initiator/initiator-name ] && ! [ -f /tmp/iscsi_set_initiator ]; then ++ iscsi_initiator=$(while read line || [ -n "$line" ]; do echo $line;done < /sys/firmware/ibft/initiator/initiator-name) ++ echo "InitiatorName=$iscsi_initiator" > /run/initiatorname.iscsi ++ rm -f /etc/iscsi/initiatorname.iscsi ++ mkdir -p /etc/iscsi ++ ln -fs /run/initiatorname.iscsi /etc/iscsi/initiatorname.iscsi ++ systemctl restart iscsid ++ sleep 1 ++ > /tmp/iscsi_set_initiator ++ fi ++ + if [ -z $iscsi_initiator ]; then +- # XXX Where are these from? ++ [ -f /run/initiatorname.iscsi ] && . /run/initiatorname.iscsi + [ -f /etc/initiatorname.iscsi ] && . /etc/initiatorname.iscsi + [ -f /etc/iscsi/initiatorname.iscsi ] && . /etc/iscsi/initiatorname.iscsi + iscsi_initiator=$InitiatorName +- +- # XXX rfc3720 says 'SCSI Initiator Name: The iSCSI Initiator Name specifies +- # the worldwide unique name of the initiator.' Could we use hostname/ip +- # if missing? + fi + + if [ -z $iscsi_initiator ]; then +- if [ -f /sys/firmware/ibft/initiator/initiator-name ]; then +- iscsi_initiator=$(while read line || [ -n "$line" ]; do echo $line;done < /sys/firmware/ibft/initiator/initiator-name) +- fi ++ iscsi_initiator=$(iscsi-iname) ++ echo "InitiatorName=$iscsi_initiator" > /run/initiatorname.iscsi ++ rm -f /etc/iscsi/initiatorname.iscsi ++ mkdir -p /etc/iscsi ++ ln -fs /run/initiatorname.iscsi /etc/iscsi/initiatorname.iscsi ++ systemctl restart iscsid ++ > /tmp/iscsi_set_initiator ++ # FIXME: iscsid is not yet ready, when the service is :-/ ++ sleep 1 + fi + ++ + if [ -z $iscsi_target_port ]; then + iscsi_target_port=3260 + fi +@@ -135,23 +154,21 @@ handle_netroot() + iscsi_target_group=1 + fi + +- if [ -z $iscsi_initiator ]; then +- # XXX is this correct? +- iscsi_initiator=$(iscsi-iname) +- fi +- + if [ -z $iscsi_lun ]; then + iscsi_lun=0 + fi + +- echo "InitiatorName='$iscsi_initiator'" > /run/initiatorname.iscsi ++ echo "InitiatorName=$iscsi_initiator" > /run/initiatorname.iscsi + ln -fs /run/initiatorname.iscsi /dev/.initiatorname.iscsi +- ++ if ! [ -e /etc/iscsi/initiatorname.iscsi ]; then ++ mkdir -p /etc/iscsi ++ ln -fs /run/initiatorname.iscsi /etc/iscsi/initiatorname.iscsi ++ fi + # FIXME $iscsi_protocol?? + +- if [ "$root" = "dhcp" ]; then ++ if [ "$root" = "dhcp" ] || [ "$netroot" = "dhcp" ]; then + # if root is not specified try to mount the whole iSCSI LUN +- printf 'SYMLINK=="disk/by-path/*-iscsi-*-%s", SYMLINK+="root"\n' $iscsi_lun >> /etc/udev/rules.d/99-iscsi-root.rules ++ printf 'SYMLINK=="disk/by-path/*-iscsi-*-%s", SYMLINK+="root"\n' "$iscsi_lun" >> /etc/udev/rules.d/99-iscsi-root.rules + udevadm control --reload + write_fs_tab /dev/root + wait_for_dev -n /dev/root +@@ -161,29 +178,58 @@ handle_netroot() + echo "iscsi_lun=$iscsi_lun . /bin/mount-lun.sh " > $hookdir/mount/01-$$-iscsi.sh + fi + +- # force udevsettle to break +- > $hookdir/initqueue/work +- +- iscsistart -i $iscsi_initiator -t $iscsi_target_name \ +- -g $iscsi_target_group -a $iscsi_target_ip \ +- -p $iscsi_target_port \ +- ${iscsi_username:+-u $iscsi_username} \ +- ${iscsi_password:+-w $iscsi_password} \ +- ${iscsi_in_username:+-U $iscsi_in_username} \ +- ${iscsi_in_password:+-W $iscsi_in_password} \ +- ${iscsi_iface_name:+--param iface.iscsi_ifacename=$iscsi_iface_name} \ +- ${iscsi_netdev_name:+--param iface.net_ifacename=$iscsi_netdev_name} \ +- ${iscsi_param} \ +- || : +- ++ if [ -n "$DRACUT_SYSTEMD" ] && command -v systemd-run >/dev/null 2>&1; then ++ netroot_enc=$(systemd-escape "iscsistart_${1}") ++ status=$(systemctl is-active "$netroot_enc" 2>/dev/null) ++ is_active=$? ++ if [ $is_active -ne 0 ]; then ++ if [ "$status" != "activating" ] && ! systemctl is-failed "$netroot_enc" >/dev/null 2>&1; then ++ systemd-run --no-block --service-type=oneshot --remain-after-exit --quiet \ ++ --description="Login iSCSI Target $iscsi_target_name" \ ++ --unit="$netroot_enc" -- \ ++ $(command -v iscsistart) \ ++ -i $iscsi_initiator -t $iscsi_target_name \ ++ -g $iscsi_target_group -a $iscsi_target_ip \ ++ -p $iscsi_target_port \ ++ ${iscsi_username:+-u $iscsi_username} \ ++ ${iscsi_password:+-w $iscsi_password} \ ++ ${iscsi_in_username:+-U $iscsi_in_username} \ ++ ${iscsi_in_password:+-W $iscsi_in_password} \ ++ ${iscsi_iface_name:+--param iface.iscsi_ifacename=$iscsi_iface_name} \ ++ ${iscsi_netdev_name:+--param iface.net_ifacename=$iscsi_netdev_name} \ ++ ${iscsi_param} >/dev/null 2>&1 ++ else ++ systemctl --no-block restart "$netroot_enc" >/dev/null 2>&1 ++ fi ++ fi ++ else ++ > $hookdir/initqueue/work ++ iscsistart -i $iscsi_initiator -t $iscsi_target_name \ ++ -g $iscsi_target_group -a $iscsi_target_ip \ ++ -p $iscsi_target_port \ ++ ${iscsi_username:+-u $iscsi_username} \ ++ ${iscsi_password:+-w $iscsi_password} \ ++ ${iscsi_in_username:+-U $iscsi_in_username} \ ++ ${iscsi_in_password:+-W $iscsi_in_password} \ ++ ${iscsi_iface_name:+--param iface.iscsi_ifacename=$iscsi_iface_name} \ ++ ${iscsi_netdev_name:+--param iface.net_ifacename=$iscsi_netdev_name} \ ++ ${iscsi_param} \ ++ || : ++ fi + netroot_enc=$(str_replace "$1" '/' '\2f') + echo 'started' > "/tmp/iscsistarted-iscsi:${netroot_enc}" ++ return 0 + } + + ret=0 + ++if [ "$netif" != "dummy" ] && getargbool 1 rd.iscsi.waitnet; then ++ all_ifaces_up || exit 0 ++fi ++ + # loop over all netroot parameter +-if getarg netroot; then ++netroot=$(getarg netroot) ++if [ $? -eq 0 ] && [ "$netroot" != "dhcp" ]; then + for nroot in $(getargs netroot); do + [ "${nroot%%:*}" = "iscsi" ] || continue + nroot="${nroot##iscsi:}" +@@ -210,6 +256,6 @@ fi + + need_shutdown + +-# now we have a root filesystem somewhere in /dev/sda* ++# now we have a root filesystem somewhere in /dev/sd* + # let the normal block handler handle root= + exit $ret +diff --git a/modules.d/95iscsi/module-setup.sh b/modules.d/95iscsi/module-setup.sh +index 406a9da..3002591 100755 +--- a/modules.d/95iscsi/module-setup.sh ++++ b/modules.d/95iscsi/module-setup.sh +@@ -226,6 +226,37 @@ install() { + inst "$moddir/iscsiroot.sh" "/sbin/iscsiroot" + if ! dracut_module_included "systemd"; then + inst "$moddir/mount-lun.sh" "/bin/mount-lun.sh" ++ else ++ inst_multiple -o \ ++ $systemdsystemunitdir/iscsi.service \ ++ $systemdsystemunitdir/iscsid.service \ ++ $systemdsystemunitdir/iscsid.socket \ ++ $systemdsystemunitdir/iscsiuio.service \ ++ $systemdsystemunitdir/iscsiuio.socket \ ++ iscsiadm iscsid ++ ++ mkdir -p "${initdir}/$systemdsystemunitdir/sockets.target.wants" ++ for i in \ ++ iscsiuio.socket \ ++ ; do ++ ln_r "$systemdsystemunitdir/${i}" "$systemdsystemunitdir/sockets.target.wants/${i}" ++ done ++ ++ mkdir -p "${initdir}/$systemdsystemunitdir/basic.target.wants" ++ for i in \ ++ iscsid.service \ ++ ; do ++ ln_r "$systemdsystemunitdir/${i}" "$systemdsystemunitdir/basic.target.wants/${i}" ++ done ++ ++ # Make sure iscsid is started after dracut-cmdline and ready for the initqueue ++ mkdir -p "${initdir}/$systemdsystemunitdir/iscsid.service.d" ++ ( ++ echo "[Unit]" ++ echo "After=dracut-cmdline.service" ++ echo "Before=dracut-initqueue.service" ++ ) > "${initdir}/$systemdsystemunitdir/iscsid.service.d/dracut.conf" + fi ++ + dracut_need_initqueue + } +diff --git a/modules.d/95iscsi/parse-iscsiroot.sh b/modules.d/95iscsi/parse-iscsiroot.sh +index 52f7a97..2532ada 100755 +--- a/modules.d/95iscsi/parse-iscsiroot.sh ++++ b/modules.d/95iscsi/parse-iscsiroot.sh +@@ -62,9 +62,10 @@ if [ -n "$iscsi_firmware" ] ; then + [ -z "$netroot" ] && netroot=iscsi: + modprobe -b -q iscsi_boot_sysfs 2>/dev/null + modprobe -b -q iscsi_ibft +- initqueue --onetime --timeout /sbin/iscsiroot dummy "$netroot" "$NEWROOT" + fi + ++initqueue --onetime --timeout /sbin/iscsiroot dummy "$netroot" "$NEWROOT" ++ + # If it's not iscsi we don't continue + [ "${netroot%%:*}" = "iscsi" ] || return + +@@ -86,6 +87,16 @@ if [ -n "$netroot" ] && [ "$root" != "/dev/root" ] && [ "$root" != "dhcp" ]; the + fi + fi + ++if arg=$(getarg rd.iscsi.initiator -d iscsi_initiator=) && [ -n "$arg" ]; then ++ iscsi_initiator=$arg ++ echo "InitiatorName=$iscsi_initiator" > /run/initiatorname.iscsi ++ ln -fs /run/initiatorname.iscsi /dev/.initiatorname.iscsi ++ if ! [ -e /etc/iscsi/initiatorname.iscsi ]; then ++ mkdir -p /etc/iscsi ++ ln -fs /run/initiatorname.iscsi /etc/iscsi/initiatorname.iscsi ++ fi ++fi ++ + if [ -n "$iscsi_firmware" ] ; then + echo "[ -f '/tmp/iscsistarted-firmware' ]" > $hookdir/initqueue/finished/iscsi_started.sh + else diff --git a/0069-TEST-30-ISCSI-dhcpd.conf-set-the-LUN.patch b/0069-TEST-30-ISCSI-dhcpd.conf-set-the-LUN.patch new file mode 100644 index 0000000..1c14fb7 --- /dev/null +++ b/0069-TEST-30-ISCSI-dhcpd.conf-set-the-LUN.patch @@ -0,0 +1,23 @@ +From 52b91b66980d0de18a52c6c1c5334364b115fee2 Mon Sep 17 00:00:00 2001 +From: Harald Hoyer +Date: Wed, 12 Aug 2015 14:40:42 +0200 +Subject: [PATCH] TEST-30-ISCSI/dhcpd.conf: set the LUN + +set the LUN, so the udev rule to mount the disk matches +--- + test/TEST-30-ISCSI/dhcpd.conf | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/test/TEST-30-ISCSI/dhcpd.conf b/test/TEST-30-ISCSI/dhcpd.conf +index 6eb035b..22c1790 100644 +--- a/test/TEST-30-ISCSI/dhcpd.conf ++++ b/test/TEST-30-ISCSI/dhcpd.conf +@@ -15,7 +15,7 @@ subnet 192.168.50.0 netmask 255.255.255.0 { + # NFSv3: last octect starts at 0x00 and works up + + group { +- option root-path "iscsi:192.168.50.1::::iqn.2009-06.dracut:target0"; ++ option root-path "iscsi:192.168.50.1:::1:iqn.2009-06.dracut:target0"; + + host iscsi-1 { + hardware ethernet 52:54:00:12:34:00; diff --git a/0070-TEST-30-ISCSI-switch-to-scsi-target-utils.patch b/0070-TEST-30-ISCSI-switch-to-scsi-target-utils.patch new file mode 100644 index 0000000..8fe68e9 --- /dev/null +++ b/0070-TEST-30-ISCSI-switch-to-scsi-target-utils.patch @@ -0,0 +1,226 @@ +From c22c43f81a5f15c8759e6aa69773d0e9010c4741 Mon Sep 17 00:00:00 2001 +From: Harald Hoyer +Date: Wed, 12 Aug 2015 14:42:03 +0200 +Subject: [PATCH] TEST-30-ISCSI: switch to scsi-target-utils + +netbsd-iscsi is not available on RHEL + +Beef up the testsuite to use the two targets over different +interfaces. + +Test the new iSCSI parameters rd.iscsi.waitnet and rd.iscsi.testroute. +--- + README.testsuite | 2 +- + test/TEST-30-ISCSI/server-init.sh | 17 ++++++++++- + test/TEST-30-ISCSI/targets | 25 ---------------- + test/TEST-30-ISCSI/test.sh | 62 ++++++++++++++++++++++++++------------- + 4 files changed, 59 insertions(+), 47 deletions(-) + delete mode 100644 test/TEST-30-ISCSI/targets + +diff --git a/README.testsuite b/README.testsuite +index b539d90..f9f60d4 100644 +--- a/README.testsuite ++++ b/README.testsuite +@@ -6,9 +6,9 @@ mdadm \ + lvm2 \ + cryptsetup \ + nfs-utils \ +-netbsd-iscsi \ + nbd \ + dhcp-server \ ++scsi-target-utils \ + iscsi-initiator-utils + + +diff --git a/test/TEST-30-ISCSI/server-init.sh b/test/TEST-30-ISCSI/server-init.sh +index 0407b17..64a4755 100755 +--- a/test/TEST-30-ISCSI/server-init.sh ++++ b/test/TEST-30-ISCSI/server-init.sh +@@ -12,10 +12,25 @@ ip link set lo up + ip link set dev eth0 name ens3 + ip addr add 192.168.50.1/24 dev ens3 + ip link set ens3 up ++ip link set dev eth1 name ens4 ++ip addr add 192.168.51.1/24 dev ens4 ++ip link set ens4 up + >/var/lib/dhcpd/dhcpd.leases + chmod 777 /var/lib/dhcpd/dhcpd.leases + dhcpd -d -cf /etc/dhcpd.conf -lf /var/lib/dhcpd/dhcpd.leases & +-/usr/sbin/iscsi-target -D -t iqn.2009-06.dracut & ++ ++tgtd ++tgtadm --lld iscsi --mode target --op new --tid 1 --targetname iqn.2009-06.dracut:target0 ++tgtadm --lld iscsi --mode target --op new --tid 2 --targetname iqn.2009-06.dracut:target1 ++tgtadm --lld iscsi --mode target --op new --tid 3 --targetname iqn.2009-06.dracut:target2 ++tgtadm --lld iscsi --mode logicalunit --op new --tid 1 --lun 1 -b /dev/sdb ++tgtadm --lld iscsi --mode logicalunit --op new --tid 2 --lun 2 -b /dev/sdc ++tgtadm --lld iscsi --mode logicalunit --op new --tid 3 --lun 3 -b /dev/sdd ++tgtadm --lld iscsi --mode target --op bind --tid 1 -I 192.168.50.101 ++tgtadm --lld iscsi --mode target --op bind --tid 2 -I 192.168.51.101 ++tgtadm --lld iscsi --mode target --op bind --tid 3 -I 192.168.50.101 ++ ++ + # Wait forever for the VM to die + echo "Serving iSCSI" + while :; do +diff --git a/test/TEST-30-ISCSI/targets b/test/TEST-30-ISCSI/targets +deleted file mode 100644 +index 6a6872e..0000000 +--- a/test/TEST-30-ISCSI/targets ++++ /dev/null +@@ -1,25 +0,0 @@ +-# $NetBSD: targets,v 1.2 2006/03/04 21:53:16 agc Exp $ +-# +-# Structure of this file: +-# +-# + an extent is a straight (offset, length) pair of a file or device +-# it's the lowest common storage denominator +-# at least one is needed +-# + a device is made up of one or more extents or other devices +-# devices can be added in a hierachical manner, to enhance resilience +-# + in this example, no device definitions are necessary, as the target +-# will just use a simple extent for persistent storage +-# + a target is made up of 1 or more devices +-# The code does not support RAID1 recovery at present +- +-# Simple file showing 1 extent, mapped straight into 1 target +- +-# extents file start length +-extent0 /dev/sdb 0 20971520 +-extent1 /dev/sdc 0 20971520 +-extent2 /dev/sdd 0 20971520 +- +-# target flags storage netmask +-target0 rw extent0 192.168.50.0/24 +-target1 rw extent1 192.168.50.0/24 +-target2 rw extent2 192.168.50.0/24 +diff --git a/test/TEST-30-ISCSI/test.sh b/test/TEST-30-ISCSI/test.sh +index 59e9c5b..cc6ec4e 100755 +--- a/test/TEST-30-ISCSI/test.sh ++++ b/test/TEST-30-ISCSI/test.sh +@@ -3,8 +3,10 @@ TEST_DESCRIPTION="root filesystem over iSCSI" + + KVERSION=${KVERSION-$(uname -r)} + +-#DEBUGFAIL="rd.shell" +-#SERIAL="tcp:127.0.0.1:9999" ++#DEBUGFAIL="rd.shell rd.break rd.debug loglevel=7 " ++DEBUGFAIL="loglevel=1" ++#SERVER_DEBUG="rd.debug loglevel=7" ++SERIAL="tcp:127.0.0.1:9999" + SERIAL="null" + + run_server() { +@@ -16,12 +18,13 @@ run_server() { + -drive format=raw,index=1,media=disk,file=$TESTDIR/root.ext3 \ + -drive format=raw,index=2,media=disk,file=$TESTDIR/iscsidisk2.img \ + -drive format=raw,index=3,media=disk,file=$TESTDIR/iscsidisk3.img \ +- -m 256M -smp 2 \ ++ -m 512M -smp 2 \ + -display none \ + -serial $SERIAL \ + -net nic,macaddr=52:54:00:12:34:56,model=e1000 \ ++ -net nic,macaddr=52:54:00:12:34:57,model=e1000 \ + -net socket,listen=127.0.0.1:12330 \ +- -append "root=/dev/sda rootfstype=ext3 rw rd.debug loglevel=77 console=ttyS0,115200n81 selinux=0" \ ++ -append "root=/dev/sda rootfstype=ext3 rw console=ttyS0,115200n81 selinux=0 $SERVER_DEBUG" \ + -initrd $TESTDIR/initramfs.server \ + -pidfile $TESTDIR/server.pid -daemonize || return 1 + sudo chmod 644 $TESTDIR/server.pid || return 1 +@@ -41,10 +44,11 @@ run_client() { + + $testdir/run-qemu \ + -drive format=raw,index=0,media=disk,file=$TESTDIR/client.img \ +- -m 256M -smp 2 -nographic \ ++ -m 512M -smp 2 -nographic \ + -net nic,macaddr=52:54:00:12:34:00,model=e1000 \ ++ -net nic,macaddr=52:54:00:12:34:01,model=e1000 \ + -net socket,connect=127.0.0.1:12330 \ +- -append "$* rw quiet rd.auto rd.retry=5 rd.debug rd.info console=ttyS0,115200n81 selinux=0 $DEBUGFAIL" \ ++ -append "$* rw rd.auto rd.retry=20 console=ttyS0,115200n81 selinux=0 rd.debug=0 $DEBUGFAIL" \ + -initrd $TESTDIR/initramfs.testing + if ! grep -F -m 1 -q iscsi-OK $TESTDIR/client.img; then + echo "CLIENT TEST END: $test_name [FAILED - BAD EXIT]" +@@ -56,20 +60,39 @@ run_client() { + } + + do_test_run() { ++ run_client "root=dhcp" \ ++ "root=/dev/root netroot=dhcp ip=ens3:dhcp" \ ++ || return 1 + +-# +-# run_client "root=dhcp" \ +-# "root=dhcp" \ +-# || return 1 ++ run_client "netroot=iscsi target0"\ ++ "root=LABEL=singleroot netroot=iscsi:192.168.50.1::::iqn.2009-06.dracut:target0" \ ++ "ip=192.168.50.101::192.168.50.1:255.255.255.0:iscsi-1:ens3:off" \ ++ || return 1 + +- run_client "netroot=iscsi target0"\ +- "root=LABEL=singleroot netroot=iscsi:192.168.50.1::::iqn.2009-06.dracut:target0" \ +- "ip=192.168.50.101::192.168.50.1:255.255.255.0:iscsi-1:ens3:off" \ ++ run_client "netroot=iscsi target1 target2" \ ++ "root=LABEL=sysroot" \ ++ "ip=192.168.50.101:::255.255.255.0::ens3:off" \ ++ "ip=192.168.51.101:::255.255.255.0::ens4:off" \ ++ "netroot=iscsi:192.168.51.1::::iqn.2009-06.dracut:target1" \ ++ "netroot=iscsi:192.168.50.1::::iqn.2009-06.dracut:target2" \ ++ || return 1 ++ ++ run_client "netroot=iscsi target1 target2 rd.iscsi.waitnet=0" \ ++ "root=LABEL=sysroot" \ ++ "ip=192.168.50.101:::255.255.255.0::ens3:off" \ ++ "ip=192.168.51.101:::255.255.255.0::ens4:off" \ ++ "netroot=iscsi:192.168.51.1::::iqn.2009-06.dracut:target1" \ ++ "netroot=iscsi:192.168.50.1::::iqn.2009-06.dracut:target2" \ ++ "rd.waitnet=0" \ + || return 1 + +- run_client "netroot=iscsi target1 target2" \ +- "root=LABEL=sysroot ip=192.168.50.101::192.168.50.1:255.255.255.0:iscsi-1:ens3:off" \ +- "netroot=iscsi:192.168.50.1::::iqn.2009-06.dracut:target1 netroot=iscsi:192.168.50.1::::iqn.2009-06.dracut:target2" \ ++ run_client "netroot=iscsi target1 target2 rd.iscsi.waitnet=0 rd.iscsi.testroute=0" \ ++ "root=LABEL=sysroot" \ ++ "ip=192.168.50.101:::255.255.255.0::ens3:off" \ ++ "ip=192.168.51.101:::255.255.255.0::ens4:off" \ ++ "netroot=iscsi:192.168.51.1::::iqn.2009-06.dracut:target1" \ ++ "netroot=iscsi:192.168.50.1::::iqn.2009-06.dracut:target2" \ ++ "rd.waitnet=0 rd.iscsi.testroute=0" \ + || return 1 + return 0 + } +@@ -170,7 +193,7 @@ test_setup() { + inst_simple ./99-idesymlinks.rules /etc/udev/rules.d/99-idesymlinks.rules + ) + sudo $basedir/dracut.sh -l -i $TESTDIR/overlay / \ +- -o "dash plymouth dmraid" \ ++ -o "dash plymouth dmraid nfs" \ + -a "debug" \ + -d "af_packet piix ide-gd_mod ata_piix ext3 sd_mod" \ + --no-hostonly-cmdline -N \ +@@ -195,13 +218,12 @@ test_setup() { + dmesg mkdir cp ping \ + modprobe tcpdump setsid \ + /etc/services sleep mount chmod +- inst_multiple /usr/sbin/iscsi-target ++ inst_multiple tgtd tgtadm + for _terminfodir in /lib/terminfo /etc/terminfo /usr/share/terminfo; do + [ -f ${_terminfodir}/l/linux ] && break + done + inst_multiple -o ${_terminfodir}/l/linux + instmods iscsi_tcp crc32c ipv6 +- inst ./targets /etc/iscsi/targets + [ -f /etc/netconfig ] && inst_multiple /etc/netconfig + type -P dhcpd >/dev/null && inst_multiple dhcpd + [ -x /usr/sbin/dhcpd3 ] && inst /usr/sbin/dhcpd3 /usr/sbin/dhcpd +@@ -223,7 +245,7 @@ test_setup() { + # Make server's dracut image + $basedir/dracut.sh -l -i $TESTDIR/overlay / \ + -a "dash udev-rules base rootfs-block fs-lib debug kernel-modules" \ +- -d "af_packet piix ide-gd_mod ata_piix ext3 sd_mod e1000" \ ++ -d "af_packet piix ide-gd_mod ata_piix ext3 sd_mod e1000 drbg" \ + --no-hostonly-cmdline -N \ + -f $TESTDIR/initramfs.server $KVERSION || return 1 + diff --git a/0071-dracut.cmdline.7.asc-document-rd.iscsi.waitnet-and-r.patch b/0071-dracut.cmdline.7.asc-document-rd.iscsi.waitnet-and-r.patch new file mode 100644 index 0000000..5894db7 --- /dev/null +++ b/0071-dracut.cmdline.7.asc-document-rd.iscsi.waitnet-and-r.patch @@ -0,0 +1,27 @@ +From 69171aa8fa4bdd196709318582d73076677bd16c Mon Sep 17 00:00:00 2001 +From: Harald Hoyer +Date: Wed, 12 Aug 2015 15:11:17 +0200 +Subject: [PATCH] dracut.cmdline.7.asc: document rd.iscsi.waitnet and + rd.iscsi.testroute + +--- + dracut.cmdline.7.asc | 6 ++++++ + 1 file changed, 6 insertions(+) + +diff --git a/dracut.cmdline.7.asc b/dracut.cmdline.7.asc +index 1a54377..8c7e965 100644 +--- a/dracut.cmdline.7.asc ++++ b/dracut.cmdline.7.asc +@@ -713,6 +713,12 @@ iscsistart -b --param node.session.timeo.replacement_timeout=30 + **rd.iscsi.ibft** **rd.iscsi.ibft=1**: + Turn on iBFT autoconfiguration for the interfaces + ++**rd.iscsi.waitnet=0**: ++ Turn off waiting for all interfaces to be up before trying to login to the iSCSI targets. ++ ++**rd.iscsi.testroute=0**: ++ Turn off checking, if the route to the iSCSI target IP is possible before trying to login. ++ + FCoE + ~~~~ + **fcoe=**____:__{dcb|nodcb}__:: diff --git a/0072-iscsi-parse-iscsiroot.sh-use-iBFT-initiator-name.patch b/0072-iscsi-parse-iscsiroot.sh-use-iBFT-initiator-name.patch new file mode 100644 index 0000000..31b4aa7 --- /dev/null +++ b/0072-iscsi-parse-iscsiroot.sh-use-iBFT-initiator-name.patch @@ -0,0 +1,41 @@ +From feb8dc685dca1229c517de9ec9854367b8c49524 Mon Sep 17 00:00:00 2001 +From: Harald Hoyer +Date: Wed, 12 Aug 2015 15:14:11 +0200 +Subject: [PATCH] iscsi/parse-iscsiroot.sh: use iBFT initiator name + +--- + modules.d/95iscsi/parse-iscsiroot.sh | 14 +++++++++++++- + 1 file changed, 13 insertions(+), 1 deletion(-) + +diff --git a/modules.d/95iscsi/parse-iscsiroot.sh b/modules.d/95iscsi/parse-iscsiroot.sh +index 2532ada..a889da1 100755 +--- a/modules.d/95iscsi/parse-iscsiroot.sh ++++ b/modules.d/95iscsi/parse-iscsiroot.sh +@@ -58,7 +58,7 @@ if [ -n "$iscsiroot" ] ; then + fi + + # iscsi_firmware does not need argument checking +-if [ -n "$iscsi_firmware" ] ; then ++if [ -n "$iscsi_firmware" ] || getargbool 0 rd.iscsi.ibft -d "ip=ibft"; then + [ -z "$netroot" ] && netroot=iscsi: + modprobe -b -q iscsi_boot_sysfs 2>/dev/null + modprobe -b -q iscsi_ibft +@@ -97,6 +97,18 @@ if arg=$(getarg rd.iscsi.initiator -d iscsi_initiator=) && [ -n "$arg" ]; then + fi + fi + ++# If not given on the cmdline and initiator-name available via iBFT ++if [ -z $iscsi_initiator ] && [ -f /sys/firmware/ibft/initiator/initiator-name ] && ! [ -f /tmp/iscsi_set_initiator ]; then ++ iscsi_initiator=$(while read line || [ -n "$line" ]; do echo $line;done < /sys/firmware/ibft/initiator/initiator-name) ++ echo "InitiatorName=$iscsi_initiator" > /run/initiatorname.iscsi ++ rm -f /etc/iscsi/initiatorname.iscsi ++ mkdir -p /etc/iscsi ++ ln -fs /run/initiatorname.iscsi /etc/iscsi/initiatorname.iscsi ++ systemctl restart iscsid ++ sleep 1 ++ > /tmp/iscsi_set_initiator ++fi ++ + if [ -n "$iscsi_firmware" ] ; then + echo "[ -f '/tmp/iscsistarted-firmware' ]" > $hookdir/initqueue/finished/iscsi_started.sh + else diff --git a/0073-iscsi-iscsiroot.sh-handle-timeout-with-all-interface.patch b/0073-iscsi-iscsiroot.sh-handle-timeout-with-all-interface.patch new file mode 100644 index 0000000..9212cac --- /dev/null +++ b/0073-iscsi-iscsiroot.sh-handle-timeout-with-all-interface.patch @@ -0,0 +1,56 @@ +From 6802cf23499b05544079b26a39e339bb3476d38d Mon Sep 17 00:00:00 2001 +From: Harald Hoyer +Date: Thu, 13 Aug 2015 11:53:21 +0200 +Subject: [PATCH] iscsi/iscsiroot.sh: handle timeout with all interfaces up + +restart iscsid, because it may disbehaved +--- + modules.d/95iscsi/iscsiroot.sh | 17 +++++++++++++---- + 1 file changed, 13 insertions(+), 4 deletions(-) + +diff --git a/modules.d/95iscsi/iscsiroot.sh b/modules.d/95iscsi/iscsiroot.sh +index fc62425..ad95812 100755 +--- a/modules.d/95iscsi/iscsiroot.sh ++++ b/modules.d/95iscsi/iscsiroot.sh +@@ -197,13 +197,14 @@ handle_netroot() + ${iscsi_in_password:+-W $iscsi_in_password} \ + ${iscsi_iface_name:+--param iface.iscsi_ifacename=$iscsi_iface_name} \ + ${iscsi_netdev_name:+--param iface.net_ifacename=$iscsi_netdev_name} \ +- ${iscsi_param} >/dev/null 2>&1 ++ ${iscsi_param} >/dev/null 2>&1 \ ++ && { > $hookdir/initqueue/work ; } + else +- systemctl --no-block restart "$netroot_enc" >/dev/null 2>&1 ++ systemctl --no-block restart "$netroot_enc" >/dev/null 2>&1 \ ++ && { > $hookdir/initqueue/work ; } + fi + fi + else +- > $hookdir/initqueue/work + iscsistart -i $iscsi_initiator -t $iscsi_target_name \ + -g $iscsi_target_group -a $iscsi_target_ip \ + -p $iscsi_target_port \ +@@ -214,7 +215,7 @@ handle_netroot() + ${iscsi_iface_name:+--param iface.iscsi_ifacename=$iscsi_iface_name} \ + ${iscsi_netdev_name:+--param iface.net_ifacename=$iscsi_netdev_name} \ + ${iscsi_param} \ +- || : ++ && { > $hookdir/initqueue/work ; } + fi + netroot_enc=$(str_replace "$1" '/' '\2f') + echo 'started' > "/tmp/iscsistarted-iscsi:${netroot_enc}" +@@ -227,6 +228,14 @@ if [ "$netif" != "dummy" ] && getargbool 1 rd.iscsi.waitnet; then + all_ifaces_up || exit 0 + fi + ++if [ "$netif" = "dummy" ] && all_ifaces_up; then ++ # s.th. went wrong and the timeout script hits ++ # restart ++ systemctl restart iscsid ++ # damn iscsid is not ready after unit says it's ready ++ sleep 2 ++fi ++ + # loop over all netroot parameter + netroot=$(getarg netroot) + if [ $? -eq 0 ] && [ "$netroot" != "dhcp" ]; then diff --git a/0074-TEST-30-ISCSI-test-more-and-set-static-initiator-nam.patch b/0074-TEST-30-ISCSI-test-more-and-set-static-initiator-nam.patch new file mode 100644 index 0000000..7954d9a --- /dev/null +++ b/0074-TEST-30-ISCSI-test-more-and-set-static-initiator-nam.patch @@ -0,0 +1,91 @@ +From 0a66b74b51f7d58916504e0e8bb01b6e981b489b Mon Sep 17 00:00:00 2001 +From: Harald Hoyer +Date: Thu, 13 Aug 2015 11:54:24 +0200 +Subject: [PATCH] TEST-30-ISCSI: test more and set static initiator name + +--- + test/TEST-30-ISCSI/test.sh | 42 ++++++++++++++++++++++++++++++------------ + 1 file changed, 30 insertions(+), 12 deletions(-) + +diff --git a/test/TEST-30-ISCSI/test.sh b/test/TEST-30-ISCSI/test.sh +index cc6ec4e..be3399a 100755 +--- a/test/TEST-30-ISCSI/test.sh ++++ b/test/TEST-30-ISCSI/test.sh +@@ -48,7 +48,7 @@ run_client() { + -net nic,macaddr=52:54:00:12:34:00,model=e1000 \ + -net nic,macaddr=52:54:00:12:34:01,model=e1000 \ + -net socket,connect=127.0.0.1:12330 \ +- -append "$* rw rd.auto rd.retry=20 console=ttyS0,115200n81 selinux=0 rd.debug=0 $DEBUGFAIL" \ ++ -append "rw rd.auto rd.retry=20 console=ttyS0,115200n81 selinux=0 rd.debug=0 $DEBUGFAIL $*" \ + -initrd $TESTDIR/initramfs.testing + if ! grep -F -m 1 -q iscsi-OK $TESTDIR/client.img; then + echo "CLIENT TEST END: $test_name [FAILED - BAD EXIT]" +@@ -60,22 +60,27 @@ run_client() { + } + + do_test_run() { ++ initiator=$(iscsi-iname) ++ + run_client "root=dhcp" \ +- "root=/dev/root netroot=dhcp ip=ens3:dhcp" \ ++ "root=/dev/root netroot=dhcp ip=ens3:dhcp" \ ++ "rd.iscsi.initiator=$initiator" \ + || return 1 + + run_client "netroot=iscsi target0"\ +- "root=LABEL=singleroot netroot=iscsi:192.168.50.1::::iqn.2009-06.dracut:target0" \ +- "ip=192.168.50.101::192.168.50.1:255.255.255.0:iscsi-1:ens3:off" \ ++ "root=LABEL=singleroot netroot=iscsi:192.168.50.1::::iqn.2009-06.dracut:target0" \ ++ "ip=192.168.50.101::192.168.50.1:255.255.255.0:iscsi-1:ens3:off" \ ++ "rd.iscsi.initiator=$initiator" \ + || return 1 + + run_client "netroot=iscsi target1 target2" \ +- "root=LABEL=sysroot" \ +- "ip=192.168.50.101:::255.255.255.0::ens3:off" \ +- "ip=192.168.51.101:::255.255.255.0::ens4:off" \ +- "netroot=iscsi:192.168.51.1::::iqn.2009-06.dracut:target1" \ +- "netroot=iscsi:192.168.50.1::::iqn.2009-06.dracut:target2" \ +- || return 1 ++ "root=LABEL=sysroot" \ ++ "ip=192.168.50.101:::255.255.255.0::ens3:off" \ ++ "ip=192.168.51.101:::255.255.255.0::ens4:off" \ ++ "netroot=iscsi:192.168.51.1::::iqn.2009-06.dracut:target1" \ ++ "netroot=iscsi:192.168.50.1::::iqn.2009-06.dracut:target2" \ ++ "rd.iscsi.initiator=$initiator" \ ++ || return 1 + + run_client "netroot=iscsi target1 target2 rd.iscsi.waitnet=0" \ + "root=LABEL=sysroot" \ +@@ -83,7 +88,8 @@ do_test_run() { + "ip=192.168.51.101:::255.255.255.0::ens4:off" \ + "netroot=iscsi:192.168.51.1::::iqn.2009-06.dracut:target1" \ + "netroot=iscsi:192.168.50.1::::iqn.2009-06.dracut:target2" \ +- "rd.waitnet=0" \ ++ "rd.iscsi.initiator=$initiator" \ ++ "rd.waitnet=0 rd.retry=30" \ + || return 1 + + run_client "netroot=iscsi target1 target2 rd.iscsi.waitnet=0 rd.iscsi.testroute=0" \ +@@ -92,8 +98,20 @@ do_test_run() { + "ip=192.168.51.101:::255.255.255.0::ens4:off" \ + "netroot=iscsi:192.168.51.1::::iqn.2009-06.dracut:target1" \ + "netroot=iscsi:192.168.50.1::::iqn.2009-06.dracut:target2" \ +- "rd.waitnet=0 rd.iscsi.testroute=0" \ ++ "rd.iscsi.initiator=$initiator" \ ++ "rd.waitnet=0 rd.iscsi.testroute=0 rd.retry=30" \ + || return 1 ++ ++ run_client "netroot=iscsi target1 target2 rd.iscsi.waitnet=0 rd.iscsi.testroute=0 default GW" \ ++ "root=LABEL=sysroot" \ ++ "ip=192.168.50.101::192.168.50.1:255.255.255.0::ens3:off" \ ++ "ip=192.168.51.101::192.168.51.1:255.255.255.0::ens4:off" \ ++ "netroot=iscsi:192.168.51.1::::iqn.2009-06.dracut:target1" \ ++ "netroot=iscsi:192.168.50.1::::iqn.2009-06.dracut:target2" \ ++ "rd.iscsi.initiator=$initiator" \ ++ "rd.waitnet=0 rd.iscsi.testroute=0 rd.retry=30" \ ++ || return 1 ++ + return 0 + } + diff --git a/0075-The-default-gateway-might-need-a-static-route.patch b/0075-The-default-gateway-might-need-a-static-route.patch new file mode 100644 index 0000000..05d0c4f --- /dev/null +++ b/0075-The-default-gateway-might-need-a-static-route.patch @@ -0,0 +1,30 @@ +From 110858025aab221d135335d85dba9317f5ef15c6 Mon Sep 17 00:00:00 2001 +From: Stijn Hoop +Date: Sun, 23 Aug 2015 14:45:53 +0200 +Subject: [PATCH] The default gateway might need a static route + +Some hosting providers need a static route set in order to be +able to reach the default gateway. Be sure to retry adding +the default gateway after setting the static routes. +--- + modules.d/40network/net-lib.sh | 7 +++++++ + 1 file changed, 7 insertions(+) + +diff --git a/modules.d/40network/net-lib.sh b/modules.d/40network/net-lib.sh +index 5c65a2e..2e79619 100755 +--- a/modules.d/40network/net-lib.sh ++++ b/modules.d/40network/net-lib.sh +@@ -129,6 +129,13 @@ setup_net() { + fi + done + ++ # If a static route was necessary to reach the gateway, the ++ # first gateway setup call will have failed with ++ # RTNETLINK answers: Network is unreachable ++ # Replace the default route again after static routes to cover ++ # this scenario. ++ [ -e /tmp/net.$netif.gw ] && . /tmp/net.$netif.gw ++ + # Handle STP Timeout: arping the default gateway. + # (or the root server, if a) it's local or b) there's no gateway.) + # Note: This assumes that if no router is present the diff --git a/0076-dracut-functions.sh-remove-duplicate-declaratio-of-l.patch b/0076-dracut-functions.sh-remove-duplicate-declaratio-of-l.patch new file mode 100644 index 0000000..a3a3f5a --- /dev/null +++ b/0076-dracut-functions.sh-remove-duplicate-declaratio-of-l.patch @@ -0,0 +1,23 @@ +From 9918afd244cbee479af4380c1fa2a7a81fba6bed Mon Sep 17 00:00:00 2001 +From: Lidong Zhong +Date: Mon, 24 Aug 2015 18:02:10 +0800 +Subject: [PATCH] dracut-functions.sh: remove duplicate declaratio of local + variable + +--- + dracut-functions.sh | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/dracut-functions.sh b/dracut-functions.sh +index d559903..cb88078 100755 +--- a/dracut-functions.sh ++++ b/dracut-functions.sh +@@ -429,7 +429,7 @@ shorten_persistent_dev() { + # $ find_block_device /usr + # 8:4 + find_block_device() { +- local _majmin _dev _majmin _find_mpt ++ local _dev _majmin _find_mpt + _find_mpt="$1" + if [[ $use_fstab != yes ]]; then + [[ -d $_find_mpt/. ]] diff --git a/0077-dracut.sh-remove-duplicate-call-of-push_host_devs.patch b/0077-dracut.sh-remove-duplicate-call-of-push_host_devs.patch new file mode 100644 index 0000000..0dd4c9d --- /dev/null +++ b/0077-dracut.sh-remove-duplicate-call-of-push_host_devs.patch @@ -0,0 +1,22 @@ +From aa169b3bd37b74bdf1e15318ab423ef4b9001fd2 Mon Sep 17 00:00:00 2001 +From: Lidong Zhong +Date: Mon, 24 Aug 2015 18:27:54 +0800 +Subject: [PATCH] dracut.sh: remove duplicate call of push_host_devs + +There is no way exit between the two places that call push_host_devs +--- + dracut.sh | 1 - + 1 file changed, 1 deletion(-) + +diff --git a/dracut.sh b/dracut.sh +index f7d31a4..8ca319b 100755 +--- a/dracut.sh ++++ b/dracut.sh +@@ -1113,7 +1113,6 @@ if [[ $hostonly ]]; then + _dev=$(find_block_device "$mp") + _bdev=$(readlink -f "/dev/block/$_dev") + [[ -b $_bdev ]] && _dev=$_bdev +- push_host_devs $_dev + [[ "$mp" == "/" ]] && root_devs+=("$_dev") + push_host_devs "$_dev" + if [[ $(find_mp_fstype "$mp") == btrfs ]]; then diff --git a/0078-dracut-functions.sh-fixed-dracutbasedir-when-sourced.patch b/0078-dracut-functions.sh-fixed-dracutbasedir-when-sourced.patch new file mode 100644 index 0000000..9ffadfa --- /dev/null +++ b/0078-dracut-functions.sh-fixed-dracutbasedir-when-sourced.patch @@ -0,0 +1,23 @@ +From ea877ac6cc3df38d22728437b8a70bedee558f6a Mon Sep 17 00:00:00 2001 +From: Harald Hoyer +Date: Thu, 3 Sep 2015 12:31:34 +0200 +Subject: [PATCH] dracut-functions.sh: fixed dracutbasedir, when sourced + directly + +--- + dracut-functions.sh | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/dracut-functions.sh b/dracut-functions.sh +index d559903..3982fc8 100755 +--- a/dracut-functions.sh ++++ b/dracut-functions.sh +@@ -96,7 +96,7 @@ find_binary() { + + if ! [[ $dracutbasedir ]]; then + dracutbasedir=${BASH_SOURCE[0]%/*} +- [[ $dracutbasedir = "dracut-functions" ]] && dracutbasedir="." ++ [[ $dracutbasedir = dracut-functions* ]] && dracutbasedir="." + [[ $dracutbasedir ]] || dracutbasedir="." + dracutbasedir="$(readlink -f $dracutbasedir)" + fi diff --git a/0079-systemd-initrd-fix-typo-in-error-message.patch b/0079-systemd-initrd-fix-typo-in-error-message.patch new file mode 100644 index 0000000..5092a26 --- /dev/null +++ b/0079-systemd-initrd-fix-typo-in-error-message.patch @@ -0,0 +1,22 @@ +From 5cb1e0efea5a331a743a6abac130003ad08b50ff Mon Sep 17 00:00:00 2001 +From: yuwata +Date: Mon, 7 Sep 2015 17:58:00 +0900 +Subject: [PATCH] systemd-initrd: fix typo in error message. + +--- + modules.d/01systemd-initrd/module-setup.sh | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/modules.d/01systemd-initrd/module-setup.sh b/modules.d/01systemd-initrd/module-setup.sh +index e313967..fb6a9ea 100755 +--- a/modules.d/01systemd-initrd/module-setup.sh ++++ b/modules.d/01systemd-initrd/module-setup.sh +@@ -5,7 +5,7 @@ check() { + [[ $mount_needs ]] && return 1 + + if ! dracut_module_included "systemd"; then +- derror "dracut-systemd needs systemd in the initramfs" ++ derror "systemd-initrd needs systemd in the initramfs" + return 1 + fi + diff --git a/0080-systemd-networkd-fix-typo-in-error-message.patch b/0080-systemd-networkd-fix-typo-in-error-message.patch new file mode 100644 index 0000000..8fe5e8e --- /dev/null +++ b/0080-systemd-networkd-fix-typo-in-error-message.patch @@ -0,0 +1,22 @@ +From 0888cf51ab82659ba71bca5ae6c5b6abe9a5ef06 Mon Sep 17 00:00:00 2001 +From: yuwata +Date: Mon, 7 Sep 2015 17:58:40 +0900 +Subject: [PATCH] systemd-networkd: fix typo in error message + +--- + modules.d/02systemd-networkd/module-setup.sh | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/modules.d/02systemd-networkd/module-setup.sh b/modules.d/02systemd-networkd/module-setup.sh +index df4661f..58842c0 100755 +--- a/modules.d/02systemd-networkd/module-setup.sh ++++ b/modules.d/02systemd-networkd/module-setup.sh +@@ -5,7 +5,7 @@ check() { + [[ $mount_needs ]] && return 1 + + if ! dracut_module_included "systemd"; then +- derror "dracut-systemd needs systemd in the initramfs" ++ derror "systemd-networkd needs systemd in the initramfs" + return 1 + fi + diff --git a/0081-install-blob-fix-typos-in-usage.patch b/0081-install-blob-fix-typos-in-usage.patch new file mode 100644 index 0000000..36395d5 --- /dev/null +++ b/0081-install-blob-fix-typos-in-usage.patch @@ -0,0 +1,23 @@ +From fc212358dab07011398c002849b2ebf8a412ffc8 Mon Sep 17 00:00:00 2001 +From: yuwata +Date: Mon, 7 Sep 2015 18:00:16 +0900 +Subject: [PATCH] install blob: fix typos in usage. + +--- + install/dracut-install.c | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +diff --git a/install/dracut-install.c b/install/dracut-install.c +index 0ff5c49..a7bfdb8 100644 +--- a/install/dracut-install.c ++++ b/install/dracut-install.c +@@ -709,7 +709,8 @@ static void usage(int status) + " -L --logdir Log files, which were installed from the host to \n" + " -R --resolvelazy Only install shebang executables and libraries\n" + " for all SOURCE files\n" +- " -H --fips Also install all '.SOURCE.hmac' files\n" ++ " -H --hostonly Mark all SOURCE files as hostonly\n\n" ++ " -f --fips Also install all '.SOURCE.hmac' files\n" + " -v --verbose Show more output\n" + " --debug Show debug output\n" + " --version Show package version\n" diff --git a/0082-dracut.8.asc-mention-lsinitrd-1-in-see-also.patch b/0082-dracut.8.asc-mention-lsinitrd-1-in-see-also.patch new file mode 100644 index 0000000..493d26c --- /dev/null +++ b/0082-dracut.8.asc-mention-lsinitrd-1-in-see-also.patch @@ -0,0 +1,19 @@ +From 820f81016a31f069dc8ef9d7a6b65ffc1166daa5 Mon Sep 17 00:00:00 2001 +From: Harald Hoyer +Date: Wed, 9 Sep 2015 11:30:52 +0200 +Subject: [PATCH] dracut.8.asc: mention lsinitrd(1) in see also + +--- + dracut.8.asc | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/dracut.8.asc b/dracut.8.asc +index 7a7ef9d..1fbbda4 100644 +--- a/dracut.8.asc ++++ b/dracut.8.asc +@@ -536,4 +536,4 @@ Will Woods + + SEE ALSO + -------- +-*dracut.cmdline*(7) *dracut.conf*(5) ++*dracut.cmdline*(7) *dracut.conf*(5) *lsinitrd*(1) diff --git a/0083-dir-locals-Avoid-use-of-setq-which-triggers-Emacs-wa.patch b/0083-dir-locals-Avoid-use-of-setq-which-triggers-Emacs-wa.patch new file mode 100644 index 0000000..85a8793 --- /dev/null +++ b/0083-dir-locals-Avoid-use-of-setq-which-triggers-Emacs-wa.patch @@ -0,0 +1,23 @@ +From 10d03bbfbc30a4ff596ffc77b73acdceef5a7826 Mon Sep 17 00:00:00 2001 +From: Colin Walters +Date: Thu, 17 Sep 2015 11:33:40 -0400 +Subject: [PATCH] dir-locals: Avoid use of setq which triggers Emacs warning + +Emacs has a whitelist of "safe" variables, using `setq` overrides +that and causes it to warn when opening any file by default. + +Dropping the `setq` makes Emacs do the right thing. +--- + .dir-locals.el | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/.dir-locals.el b/.dir-locals.el +index cbbcec4..8130058 100644 +--- a/.dir-locals.el ++++ b/.dir-locals.el +@@ -1,3 +1,3 @@ +-((nil . ((setq sh-basic-offset: 4) +- (setq indent-tabs-mode nil) ++((nil . ((sh-basic-offset . 4) ++ (indent-tabs-mode . nil) + ))) diff --git a/0084-lsinitrd-Suppress-cat-write-error-Broken-pipe.patch b/0084-lsinitrd-Suppress-cat-write-error-Broken-pipe.patch new file mode 100644 index 0000000..2aee86c --- /dev/null +++ b/0084-lsinitrd-Suppress-cat-write-error-Broken-pipe.patch @@ -0,0 +1,121 @@ +From 3ce142861d88c357864d3a3bef7ec453826d737d Mon Sep 17 00:00:00 2001 +From: HATAYAMA Daisuke +Date: Wed, 4 Nov 2015 11:31:10 +0900 +Subject: [PATCH] lsinitrd: Suppress "cat: write error: Broken pipe" + +On systemd, SIGPIPE is ignored by default; see man 5 systemd.exec for +IgnoreSIGPIPE=. As a result, lsinitrd.sh under a systemd service +outputs "cat: write error: Broken pipe" in the processing of +determining a compression format of a given initramfs file using cat +command in the write part of a pipeline processing. + +For example, this is a log message of kdump.service in RHEL7.1, + + -- Logs begin at Wed 2015-11-04 09:57:33 JST, end at Wed 2015-11-04 09:58:28 JST. -- + Nov 04 09:57:33 localhost systemd[1]: Stopping Crash recovery kernel arming... + Nov 04 09:57:33 localhost kdumpctl[22545]: kexec: unloaded kdump kernel + Nov 04 09:57:33 localhost kdumpctl[22545]: Stopping kdump: [OK] + Nov 04 09:57:33 localhost systemd[1]: Starting Crash recovery kernel arming... + Nov 04 09:57:36 localhost kdumpctl[22553]: Detected change(s) in the following file(s): + Nov 04 09:57:36 localhost kdumpctl[22553]: /etc/kdump.conf + Nov 04 09:57:36 localhost kdumpctl[22553]: Rebuilding /boot/initramfs-3.10.0-229.el7.x86_64kdump.img + Nov 04 09:57:40 localhost dracut[24914]: Executing: /usr/sbin/dracut --hostonly --hostonly-cmdline -o "plymouth dash resume" -f /boot/initramfs-3.10.0-229.el7.x86_64kdump.img 3.10.0-229.el7.x86_64 + ...... + Nov 04 09:58:12 localhost dracut[24914]: *** Creating image file done *** + Nov 04 09:58:12 localhost dracut[24914]: Image: /boot/initramfs-3.10.0-229.el7.x86_64kdump.img: 18M + Nov 04 09:58:12 localhost kdumpctl[22553]: cat: write error: Broken pipe + Nov 04 09:58:12 localhost dracut[24914]: ======================================================================== + Nov 04 09:58:12 localhost dracut[24914]: Version: dracut-033-240.el7 + Nov 04 09:58:12 localhost dracut[24914]: + Nov 04 09:58:12 localhost dracut[24914]: Arguments: --hostonly --hostonly-cmdline -o 'plymouth dash resume' -f + Nov 04 09:58:13 localhost dracut[24914]: + Nov 04 09:58:13 localhost dracut[24914]: dracut modules: + Nov 04 09:58:13 localhost dracut[24914]: bash + +kdump.service builds and loads an initramfs for kdump kernel using +kdumpctl command which uses dracut command and so lsinitrd command, +too. + +Although there's no actual harm except for the error message, there +has been several inquiries from customers about this message so +far. We should suppress this message to reduce needless +communications. + +To suppress the message, this commit cleans up the processing of +reading the first 6 bytes of a given initramfs file without cat +command. +--- + lsinitrd.sh | 59 ++++++++++++++++++++++++++++------------------------------- + 1 file changed, 28 insertions(+), 31 deletions(-) + +diff --git a/lsinitrd.sh b/lsinitrd.sh +index d2ddd76..441fb92 100755 +--- a/lsinitrd.sh ++++ b/lsinitrd.sh +@@ -176,38 +176,35 @@ case $bin in + ;; + esac + +-CAT=$({ +- if [[ $SKIP ]]; then +- $SKIP "$image" ++if [[ $SKIP ]] ; then ++ bin="$($SKIP "$image" | { read -N 6 bin && echo "$bin" ; })" ++else ++ read -N 6 bin < "$image" ++fi ++case $bin in ++ $'\x1f\x8b'*) ++ CAT="zcat --" ++ ;; ++ BZh*) ++ CAT="bzcat --" ++ ;; ++ $'\x71\xc7'*|070701) ++ CAT="cat --" ++ ;; ++ $'\x02\x21'*) ++ CAT="lz4 -d -c" ++ ;; ++ $'\x89'LZO$'\0'*) ++ CAT="lzop -d -c" ++ ;; ++ *) ++ if echo "test"|xz|xzcat --single-stream >/dev/null 2>&1; then ++ CAT="xzcat --single-stream --" + else +- cat "$image" +- fi } | { +- read -N 6 bin +- case $bin in +- $'\x1f\x8b'*) +- echo "zcat --" +- ;; +- BZh*) +- echo "bzcat --" +- ;; +- $'\x71\xc7'*|070701) +- echo "cat --" +- ;; +- $'\x02\x21'*) +- echo "lz4 -d -c" +- ;; +- $'\x89'LZO$'\0'*) +- echo "lzop -d -c" +- ;; +- *) +- if echo "test"|xz|xzcat --single-stream >/dev/null 2>&1; then +- echo "xzcat --single-stream --" +- else +- echo "xzcat --" +- fi +- ;; +- esac +- }) ++ CAT="xzcat --" ++ fi ++ ;; ++esac + + skipcpio() + { diff --git a/0085-PKGFILE-update-to-latest-makepkg.patch b/0085-PKGFILE-update-to-latest-makepkg.patch new file mode 100644 index 0000000..c868f12 --- /dev/null +++ b/0085-PKGFILE-update-to-latest-makepkg.patch @@ -0,0 +1,26 @@ +From eb150a4feedf5ae3d8393ce365357bc40cced1b8 Mon Sep 17 00:00:00 2001 +From: Silvio Fricke +Date: Sun, 8 Nov 2015 12:48:26 +0100 +Subject: [PATCH] PKGFILE: update to latest makepkg + +makepkg needs now a package-section. + +Signed-off-by: Silvio Fricke +--- + PKGBUILD | 4 ++++ + 1 file changed, 4 insertions(+) + +diff --git a/PKGBUILD b/PKGBUILD +index f7c3664..a9f1b5a 100644 +--- a/PKGBUILD ++++ b/PKGBUILD +@@ -17,5 +17,9 @@ md5sums=() + build() { + cd .. + make sysconfdir=/etc || return 1 ++} ++ ++package() { ++ cd .. + make DESTDIR="${pkgdir}" sysconfdir=/etc install || return 1 + } diff --git a/0086-PKGFILE-version-is-now-completely-constructed-from-g.patch b/0086-PKGFILE-version-is-now-completely-constructed-from-g.patch new file mode 100644 index 0000000..a794ea1 --- /dev/null +++ b/0086-PKGFILE-version-is-now-completely-constructed-from-g.patch @@ -0,0 +1,42 @@ +From 4cca17eeeca4254248d58562f2ae6b56a885b91e Mon Sep 17 00:00:00 2001 +From: Silvio Fricke +Date: Sun, 8 Nov 2015 12:49:45 +0100 +Subject: [PATCH] PKGFILE: version is now completely constructed from git + +`pkgver` and `pkgrel` now hard coded to 1. The PKGFILE will getting +changed on a `makepkg`-run. + +To prevent some version crashes no commit with changes to `pkgver` and +`pkgrel` should be accepted. + +Signed-off-by: Silvio Fricke +--- + PKGBUILD | 10 ++++++++-- + 1 file changed, 8 insertions(+), 2 deletions(-) + +diff --git a/PKGBUILD b/PKGBUILD +index a9f1b5a..c625bdb 100644 +--- a/PKGBUILD ++++ b/PKGBUILD +@@ -1,6 +1,6 @@ + pkgname=dracut-git +-pkgver=$(date +%s) +-pkgrel=$(git log --pretty=format:%h |head -n 1) ++pkgver=1 ++pkgrel=1 + pkgdesc="Initramfs generation utility" + arch=('i686' 'x86_64') + url="https://dracut.wiki.kernel.org/" +@@ -14,6 +14,12 @@ backup=(etc/dracut.conf) + source=() + md5sums=() + ++pkgver() { ++ cd .. ++ desc="$(git describe)" ++ printf "%s.%s.%s" ${desc//-/ } ++} ++ + build() { + cd .. + make sysconfdir=/etc || return 1 diff --git a/0087-PKGFILE-prevent-out-of-tree-builds.patch b/0087-PKGFILE-prevent-out-of-tree-builds.patch new file mode 100644 index 0000000..e0eaabf --- /dev/null +++ b/0087-PKGFILE-prevent-out-of-tree-builds.patch @@ -0,0 +1,32 @@ +From 0d5c02d3ab7b71a09d5d7b52a771f0fe0f32e4e2 Mon Sep 17 00:00:00 2001 +From: Silvio Fricke +Date: Sun, 8 Nov 2015 12:53:36 +0100 +Subject: [PATCH] PKGFILE: prevent out of tree builds + +With makepkg is it possible to build sources away from the PKGFILE. The +previous behavior was crash on build if this was setup. With this +patch we prevent this possibility. + +Signed-off-by: Silvio Fricke +--- + PKGBUILD | 7 +++++++ + 1 file changed, 7 insertions(+) + +diff --git a/PKGBUILD b/PKGBUILD +index c625bdb..05a32b0 100644 +--- a/PKGBUILD ++++ b/PKGBUILD +@@ -14,6 +14,13 @@ backup=(etc/dracut.conf) + source=() + md5sums=() + ++# out of tree builds disallowed for this PKGFILE ++BUILDDIR="${PWD}" ++PKGDEST="${PWD}" ++SRCDEST="" ++SRCPKGDEST="" ++LOGDEST="" ++ + pkgver() { + cd .. + desc="$(git describe)" diff --git a/0088-dracut-logger-prefix-stderr-output-with-dracut.patch b/0088-dracut-logger-prefix-stderr-output-with-dracut.patch new file mode 100644 index 0000000..fc504c9 --- /dev/null +++ b/0088-dracut-logger-prefix-stderr-output-with-dracut.patch @@ -0,0 +1,25 @@ +From 8e1c4b354cdc01f32d7903fbd7564c2ea2a5a7a1 Mon Sep 17 00:00:00 2001 +From: Harald Hoyer +Date: Mon, 9 Nov 2015 15:33:27 +0100 +Subject: [PATCH] dracut-logger: prefix stderr output with "dracut: " + +dnf updates of the kernel execute dracut in %post. +For the user it is not possible to distinguish the dracut output from +other error messages. +--- + dracut-logger.sh | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/dracut-logger.sh b/dracut-logger.sh +index e5c9358..d1cee98 100755 +--- a/dracut-logger.sh ++++ b/dracut-logger.sh +@@ -324,7 +324,7 @@ _do_dlog() { + local msg="$*" + local lmsg="$lvlc: $*" + +- (( $lvl <= $stdloglvl )) && echo "$msg" >&2 ++ (( $lvl <= $stdloglvl )) && printf -- 'dracut: %s\n' "$msg" >&2 + + if (( $lvl <= $sysloglvl )); then + if [[ "$_dlogfd" ]]; then diff --git a/0089-dmsquash-live-root-Request-overflow-support-for-pers.patch b/0089-dmsquash-live-root-Request-overflow-support-for-pers.patch new file mode 100644 index 0000000..5ca76c5 --- /dev/null +++ b/0089-dmsquash-live-root-Request-overflow-support-for-pers.patch @@ -0,0 +1,23 @@ +From 97be933592a00289fba3755cf3a9aa3c5d3c4ee9 Mon Sep 17 00:00:00 2001 +From: Frederick Grose +Date: Mon, 9 Nov 2015 09:45:07 -0800 +Subject: [PATCH] dmsquash-live-root: Request overflow support for persistent + snapshot. + +--- + modules.d/90dmsquash-live/dmsquash-live-root.sh | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/modules.d/90dmsquash-live/dmsquash-live-root.sh b/modules.d/90dmsquash-live/dmsquash-live-root.sh +index 531617e..714e1dc 100755 +--- a/modules.d/90dmsquash-live/dmsquash-live-root.sh ++++ b/modules.d/90dmsquash-live/dmsquash-live-root.sh +@@ -171,7 +171,7 @@ do_live_overlay() { + # Create a snapshot of the base image + echo 0 $sz thin /dev/mapper/live-overlay-pool 0 $base | dmsetup create live-rw + else +- echo 0 $sz snapshot $base $over p 8 | dmsetup create live-rw ++ echo 0 $sz snapshot $base $over PO 8 | dmsetup create live-rw + fi + + # Create a device that always points to a ro base image diff --git a/0090-dmsquash-live-root-Use-non-persistent-metadata-snaps.patch b/0090-dmsquash-live-root-Use-non-persistent-metadata-snaps.patch new file mode 100644 index 0000000..8232b9b --- /dev/null +++ b/0090-dmsquash-live-root-Use-non-persistent-metadata-snaps.patch @@ -0,0 +1,45 @@ +From 49c9d8174ff7c25158861872bc0ea04a8cf2d242 Mon Sep 17 00:00:00 2001 +From: Frederick Grose +Date: Mon, 9 Nov 2015 10:46:27 -0800 +Subject: [PATCH] dmsquash-live-root: Use non-persistent metadata snapshots. + +Transient snapshots can take advantage of smaller, + non-persistent metadata structures. +Make the --readonly option explicit rather than inferred + for the readonly_overlay target. +Assure that the live-base target is on the BASE_LOOPDEV. +--- + modules.d/90dmsquash-live/dmsquash-live-root.sh | 6 +++--- + 1 file changed, 3 insertions(+), 3 deletions(-) + +diff --git a/modules.d/90dmsquash-live/dmsquash-live-root.sh b/modules.d/90dmsquash-live/dmsquash-live-root.sh +index 531617e..caf473b 100755 +--- a/modules.d/90dmsquash-live/dmsquash-live-root.sh ++++ b/modules.d/90dmsquash-live/dmsquash-live-root.sh +@@ -141,7 +141,7 @@ do_live_overlay() { + # set up the snapshot + sz=$(blockdev --getsz $BASE_LOOPDEV) + if [ -n "$readonly_overlay" ]; then +- echo 0 $sz snapshot $BASE_LOOPDEV $OVERLAY_LOOPDEV p 8 | dmsetup create $readonly_overlay live-ro ++ echo 0 $sz snapshot $BASE_LOOPDEV $OVERLAY_LOOPDEV N 8 | dmsetup create --readonly live-ro + base="/dev/mapper/live-ro" + over=$RO_OVERLAY_LOOPDEV + else +@@ -175,7 +175,7 @@ do_live_overlay() { + fi + + # Create a device that always points to a ro base image +- echo 0 $sz linear $base 0 | dmsetup create --readonly live-base ++ echo 0 $sz linear $BASE_LOOPDEV 0 | dmsetup create --readonly live-base + } + + # live cd helper function +@@ -259,7 +259,7 @@ fi + if [ -b "$OSMIN_LOOPDEV" ]; then + # set up the devicemapper snapshot device, which will merge + # the normal live fs image, and the delta, into a minimzied fs image +- echo "0 $( blockdev --getsz $BASE_LOOPDEV ) snapshot $BASE_LOOPDEV $OSMIN_LOOPDEV p 8" | dmsetup create --readonly live-osimg-min ++ echo "0 $( blockdev --getsz $BASE_LOOPDEV ) snapshot $BASE_LOOPDEV $OSMIN_LOOPDEV N 8" | dmsetup create --readonly live-osimg-min + fi + + ROOTFLAGS="$(getarg rootflags)" diff --git a/0091-Makefile-fix-VERSION-and-GITVERSION.patch b/0091-Makefile-fix-VERSION-and-GITVERSION.patch new file mode 100644 index 0000000..3dd447a --- /dev/null +++ b/0091-Makefile-fix-VERSION-and-GITVERSION.patch @@ -0,0 +1,23 @@ +From 8019e0eef3d36a4933ab96a8a8edfef5f3685593 Mon Sep 17 00:00:00 2001 +From: Harald Hoyer +Date: Wed, 30 Sep 2015 14:10:05 +0200 +Subject: [PATCH] Makefile: fix VERSION and GITVERSION + +--- + Makefile | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/Makefile b/Makefile +index f3a5c07..8454c63 100644 +--- a/Makefile ++++ b/Makefile +@@ -1,7 +1,7 @@ + -include dracut-version.sh + +-VERSION = $(shell [ -d .git ] && git describe --abbrev=0 --tags 2>/dev/null || echo $(DRACUT_VERSION)) +-GITVERSION = $(shell [ -d .git ] && { v=$$(git describe --tags 2>/dev/null); [ $${v\#*-} != $$v ] && echo -$${v\#*-}; } ) ++VERSION ?= $(shell [ -d .git ] && git describe --abbrev=0 --tags 2>/dev/null || echo $(DRACUT_VERSION)) ++GITVERSION ?= $(shell [ -d .git ] && { v=$$(git describe --tags 2>/dev/null); [ -n "$$v" ] && [ $${v\#*-} != $$v ] && echo -$${v\#*-}; } ) + + -include Makefile.inc + diff --git a/0092-dracut.spec-omit-pkg-config-from-dependencies.patch b/0092-dracut.spec-omit-pkg-config-from-dependencies.patch new file mode 100644 index 0000000..9e053af --- /dev/null +++ b/0092-dracut.spec-omit-pkg-config-from-dependencies.patch @@ -0,0 +1,33 @@ +From 9befacf0c51e15fe8a199242c3bfd97d1adf455c Mon Sep 17 00:00:00 2001 +From: Harald Hoyer +Date: Wed, 30 Sep 2015 14:10:20 +0200 +Subject: [PATCH] dracut.spec: omit pkg-config from dependencies + +--- + dracut.spec | 6 ++++++ + 1 file changed, 6 insertions(+) + +diff --git a/dracut.spec b/dracut.spec +index 6ef5de7..d0bb9bd 100644 +--- a/dracut.spec ++++ b/dracut.spec +@@ -1,6 +1,11 @@ + %define dracutlibdir %{_prefix}/lib/dracut + %bcond_without doc + ++# We ship a .pc file but don't want to have a dep on pkg-config. We ++# strip the automatically generated dep here and instead co-own the ++# directory. ++%global __requires_exclude pkg-config ++ + # Variables must be defined + %define with_nbd 1 + +@@ -327,6 +332,7 @@ rm -rf -- $RPM_BUILD_ROOT + %endif + %dir %{_sysconfdir}/dracut.conf.d + %dir %{dracutlibdir}/dracut.conf.d ++%dir %{_datadir}/pkgconfig + %{_datadir}/pkgconfig/dracut.pc + + %if %{with doc} diff --git a/0093-fips-add-authenc-and-authencesn-kernel-modules.patch b/0093-fips-add-authenc-and-authencesn-kernel-modules.patch new file mode 100644 index 0000000..cc3b6eb --- /dev/null +++ b/0093-fips-add-authenc-and-authencesn-kernel-modules.patch @@ -0,0 +1,23 @@ +From c97209fe69dbbacb1f87acf5ec8a0e558e553ddc Mon Sep 17 00:00:00 2001 +From: Harald Hoyer +Date: Tue, 10 Nov 2015 17:35:27 +0100 +Subject: [PATCH] fips: add authenc and authencesn kernel modules + +https://bugzilla.redhat.com/show_bug.cgi?id=1115112#c5 +--- + modules.d/01fips/module-setup.sh | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/modules.d/01fips/module-setup.sh b/modules.d/01fips/module-setup.sh +index 758bf6b..7278347 100755 +--- a/modules.d/01fips/module-setup.sh ++++ b/modules.d/01fips/module-setup.sh +@@ -13,7 +13,7 @@ depends() { + # called by dracut + installkernel() { + local _fipsmodules _mod +- _fipsmodules="aead aes_generic aes-x86_64 ansi_cprng arc4 blowfish camellia cast6 cbc ccm " ++ _fipsmodules="aead aes_generic aes-x86_64 ansi_cprng arc4 authenc authencesn blowfish camellia cast6 cbc ccm " + _fipsmodules+="chainiv crc32c crct10dif_generic cryptomgr crypto_null ctr cts deflate des des3_ede dm-crypt dm-mod drbg " + _fipsmodules+="ecb eseqiv fcrypt gcm ghash_generic hmac khazad lzo md4 md5 michael_mic rmd128 " + _fipsmodules+="rmd160 rmd256 rmd320 rot13 salsa20 seed seqiv serpent sha1 sha224 sha256 sha256_generic " diff --git a/0094-lvm-remove-all-quirk-arguments.patch b/0094-lvm-remove-all-quirk-arguments.patch new file mode 100644 index 0000000..e77084e --- /dev/null +++ b/0094-lvm-remove-all-quirk-arguments.patch @@ -0,0 +1,98 @@ +From 53a738465371db3cb7df533a3ae2b5648dfd13e4 Mon Sep 17 00:00:00 2001 +From: Harald Hoyer +Date: Tue, 10 Nov 2015 17:55:50 +0100 +Subject: [PATCH] lvm: remove all quirk arguments + +https://bugzilla.redhat.com/show_bug.cgi?id=742564 + +Once lvm2 starts using /run (bug 742554), it should be no longer +necessary to disable file-based locking in the vgchange call in +fedora-storage-init. +Removing '--sysinit' will make it safe to call LVM operations +concurrently from other units. + +The --sysinit is a compound option consisting of: + + -> --ignorelockingfailure - not needed anymore, the /run/lock/lvm is +available rw soon in boot process + + -> --ignoremonitoring - not needed since /run is available, this would +require the dm-event.service to be run before +fedora-storage-init.service (and new lvm2-activation.service when +deployed). But that's a one line change - I'll have a look whether it +plays well with other services and if yes, I'll commit the change. N.B.: +This has a consequence that all volumes activated on vgchange -ay will +be monitored at the same time they're activated (which is a plus I +think). The lvm2-monitor will just grab all the other volumes not +activated at the time of the boot's vgchange -ay call. But that's not an +issue (for already monitored volumes, calling vgchange --monitor y will +just be a NOOP). + + -> --poll n - not needed, we can run the polldaemon as the /run is +available and rw (in case there's unfinished merge or mirror sync from +previous system run, the poll-daemon will be triggered at boot now). +Actually, the polldaemon should be triggered as a service like dmeventd +is, not forked off from the LVM command itself, like from vgchange in +this case - we still need to change this - there's a bug open for this +request already (bug #814857). However, we don't have this feature ready +yet so I need to check whether this is OK with the early boot process +with the current state. +--- + modules.d/90lvm/lvm_scan.sh | 28 ++++++++++++++-------------- + 1 file changed, 14 insertions(+), 14 deletions(-) + +diff --git a/modules.d/90lvm/lvm_scan.sh b/modules.d/90lvm/lvm_scan.sh +index ead28aa..8bf0864 100755 +--- a/modules.d/90lvm/lvm_scan.sh ++++ b/modules.d/90lvm/lvm_scan.sh +@@ -69,11 +69,19 @@ min=$2 + sub=${3%% *} + sub=${sub%%\(*}; + ++lvm_ignorelockingfailure="--ignorelockingfailure" ++lvm_quirk_args="--ignorelockingfailure --ignoremonitoring" ++ + check_lvm_ver 2 2 57 $maj $min $sub && \ +- nopoll="--poll n" ++ lvm_quirk_args="$lvm_quirk_args --poll n" + + if check_lvm_ver 2 2 65 $maj $min $sub; then +- sysinit=" --sysinit $extraargs" ++ lvm_quirk_args=" --sysinit $extraargs" ++fi ++ ++if check_lvm_ver 2 2 221 $maj $min $sub; then ++ lvm_quirk_args=" $extraargs" ++ unset lvm_ignorelockingfailure + fi + + unset extraargs +@@ -104,24 +112,16 @@ fi + + if [ -n "$LVS" ] ; then + info "Scanning devices $lvmdevs for LVM logical volumes $LVS" +- lvm lvscan --ignorelockingfailure 2>&1 | vinfo ++ lvm lvscan $lvm_ignorelockingfailure 2>&1 | vinfo + for LV in $LVS; do +- if [ -z "$sysinit" ]; then +- lvm lvchange --yes -ay --ignorelockingfailure $nopoll --ignoremonitoring $LV 2>&1 | vinfo +- else +- lvm lvchange --yes -ay $sysinit $LV 2>&1 | vinfo +- fi ++ lvm lvchange --yes -ay $lvm_quirk_args $LV 2>&1 | vinfo + done + fi + + if [ -z "$LVS" -o -n "$VGS" ]; then + info "Scanning devices $lvmdevs for LVM volume groups $VGS" +- lvm vgscan --ignorelockingfailure 2>&1 | vinfo +- if [ -z "$sysinit" ]; then +- lvm vgchange -ay --ignorelockingfailure $nopoll --ignoremonitoring $VGS 2>&1 | vinfo +- else +- lvm vgchange -ay $sysinit $VGS 2>&1 | vinfo +- fi ++ lvm vgscan $lvm_ignorelockingfailure 2>&1 | vinfo ++ lvm vgchange -ay $lvm_quirk_args $VGS 2>&1 | vinfo + fi + + if [ "$lvmwritten" ]; then diff --git a/0095-dracut.sh-remove-_EARLY-from-CONFIG_MICROCODE_-check.patch b/0095-dracut.sh-remove-_EARLY-from-CONFIG_MICROCODE_-check.patch new file mode 100644 index 0000000..07bd27b --- /dev/null +++ b/0095-dracut.sh-remove-_EARLY-from-CONFIG_MICROCODE_-check.patch @@ -0,0 +1,38 @@ +From 875426f2fc1360401ddb5f97c67df031e54958d5 Mon Sep 17 00:00:00 2001 +From: Harald Hoyer +Date: Wed, 11 Nov 2015 11:38:56 +0100 +Subject: [PATCH] dracut.sh: remove "_EARLY" from CONFIG_MICROCODE_* checks + +EARLY is merged in the main driver +--- + dracut.sh | 10 +++++----- + 1 file changed, 5 insertions(+), 5 deletions(-) + +diff --git a/dracut.sh b/dracut.sh +index 2712e9e..9ba481b 100755 +--- a/dracut.sh ++++ b/dracut.sh +@@ -1016,18 +1016,18 @@ fi + if [[ $early_microcode = yes ]]; then + if [[ $hostonly ]]; then + [[ $(get_cpu_vendor) == "AMD" ]] \ +- && ! check_kernel_config CONFIG_MICROCODE_AMD_EARLY \ ++ && ! check_kernel_config CONFIG_MICROCODE_AMD \ + && unset early_microcode + [[ $(get_cpu_vendor) == "Intel" ]] \ +- && ! check_kernel_config CONFIG_MICROCODE_INTEL_EARLY \ ++ && ! check_kernel_config CONFIG_MICROCODE_INTEL \ + && unset early_microcode + else +- ! check_kernel_config CONFIG_MICROCODE_AMD_EARLY \ +- && ! check_kernel_config CONFIG_MICROCODE_INTEL_EARLY \ ++ ! check_kernel_config CONFIG_MICROCODE_AMD \ ++ && ! check_kernel_config CONFIG_MICROCODE_INTEL \ + && unset early_microcode + fi + [[ $early_microcode != yes ]] \ +- && dwarn "Disabling early microcode, because kernel does not support it. CONFIG_MICROCODE_[AMD|INTEL]_EARLY!=y" ++ && dwarn "Disabling early microcode, because kernel does not support it. CONFIG_MICROCODE_[AMD|INTEL]!=y" + fi + + # Need to be able to have non-root users read stuff (rpcbind etc) diff --git a/0096-dracut.sh-quote-outfile-on-error-removal.patch b/0096-dracut.sh-quote-outfile-on-error-removal.patch new file mode 100644 index 0000000..d68862a --- /dev/null +++ b/0096-dracut.sh-quote-outfile-on-error-removal.patch @@ -0,0 +1,25 @@ +From 2cc5e92e210d8eba1bce3068ca2be96b2427862d Mon Sep 17 00:00:00 2001 +From: Harald Hoyer +Date: Wed, 11 Nov 2015 11:49:34 +0100 +Subject: [PATCH] dracut.sh: quote $outfile on error removal + +--- + dracut.sh | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +diff --git a/dracut.sh b/dracut.sh +index 9ba481b..1169037 100755 +--- a/dracut.sh ++++ b/dracut.sh +@@ -1690,9 +1690,10 @@ if ! ( + | $compress >> "$outfile" + ); then + dfatal "dracut: creation of $outfile failed" +- rm -f $outfile ++ rm -f "$outfile" + exit 1 + fi ++ + dinfo "*** Creating initrd image file '$outfile' done ***" + + if (( maxloglvl >= 5 )); then diff --git a/0097-dracut-systemd-module-setup.sh-remove-duplicate-vcon.patch b/0097-dracut-systemd-module-setup.sh-remove-duplicate-vcon.patch new file mode 100644 index 0000000..36bf91f --- /dev/null +++ b/0097-dracut-systemd-module-setup.sh-remove-duplicate-vcon.patch @@ -0,0 +1,34 @@ +From 64c34f34593984d93d4781f1e5fa008871e11963 Mon Sep 17 00:00:00 2001 +From: Harald Hoyer +Date: Wed, 11 Nov 2015 12:16:13 +0100 +Subject: [PATCH] dracut-systemd/module-setup.sh: remove duplicate vconsole + wants + +Adding the dependency on vconsole is already done in the 00systemd +module and the rescue.service has this already in the unit file. +--- + modules.d/98dracut-systemd/module-setup.sh | 11 ----------- + 1 file changed, 11 deletions(-) + +diff --git a/modules.d/98dracut-systemd/module-setup.sh b/modules.d/98dracut-systemd/module-setup.sh +index d917557..900162c 100755 +--- a/modules.d/98dracut-systemd/module-setup.sh ++++ b/modules.d/98dracut-systemd/module-setup.sh +@@ -43,17 +43,6 @@ install() { + + inst_script "$moddir/rootfs-generator.sh" $systemdutildir/system-generators/dracut-rootfs-generator + +- for i in \ +- emergency.target \ +- rescue.service \ +- systemd-ask-password-console.service \ +- systemd-ask-password-plymouth.service \ +- ; do +- mkdir -p "${initdir}${systemdsystemunitdir}/${i}.wants" +- ln_r "${systemdsystemunitdir}/systemd-vconsole-setup.service" \ +- "${systemdsystemunitdir}/${i}.wants/systemd-vconsole-setup.service" +- done +- + mkdir -p "${initdir}/$systemdsystemunitdir/initrd.target.wants" + for i in \ + dracut-cmdline.service \ diff --git a/0098-Makefile-remove-output-file-before-creating-it.patch b/0098-Makefile-remove-output-file-before-creating-it.patch new file mode 100644 index 0000000..afafa5f --- /dev/null +++ b/0098-Makefile-remove-output-file-before-creating-it.patch @@ -0,0 +1,49 @@ +From 3e1c531b4ebfcca8850b5fa56ea7ce2eeacb2cc9 Mon Sep 17 00:00:00 2001 +From: Harald Hoyer +Date: Wed, 11 Nov 2015 12:33:07 +0100 +Subject: [PATCH] Makefile: remove output file before creating it + +--- + Makefile | 11 ++++++++--- + 1 file changed, 8 insertions(+), 3 deletions(-) + +diff --git a/Makefile b/Makefile +index 8454c63..44c58cc 100644 +--- a/Makefile ++++ b/Makefile +@@ -82,20 +82,24 @@ all: doc + endif + + %: %.xml +- xsltproc -o $@ -nonet http://docbook.sourceforge.net/release/xsl/current/manpages/docbook.xsl $< ++ @rm -f -- "$@" ++ xsltproc -o "$@" -nonet http://docbook.sourceforge.net/release/xsl/current/manpages/docbook.xsl $< + + %.xml: %.asc +- asciidoc -d manpage -b docbook -o $@ $< ++ @rm -f -- "$@" ++ asciidoc -d manpage -b docbook -o "$@" $< + + dracut.8: dracut.usage.asc dracut.8.asc + + dracut.html: dracut.asc $(manpages) dracut.css dracut.usage.asc ++ @rm -f -- dracut.xml + asciidoc -a numbered -d book -b docbook -o dracut.xml dracut.asc ++ @rm -f -- dracut.html + xsltproc -o dracut.html --xinclude -nonet \ + --stringparam custom.css.source dracut.css \ + --stringparam generate.css.header 1 \ + http://docbook.sourceforge.net/release/xsl/current/xhtml/docbook.xsl dracut.xml +- rm -f -- dracut.xml ++ @rm -f -- dracut.xml + + dracut.pc: Makefile.inc Makefile + @echo "Name: dracut" > dracut.pc +@@ -169,6 +173,7 @@ endif + install -m 0644 dracut.pc $(DESTDIR)${pkgconfigdatadir}/dracut.pc + + dracut-version.sh: ++ @rm -f dracut-version.sh + @echo "DRACUT_VERSION=$(VERSION)$(GITVERSION)" > dracut-version.sh + + clean: diff --git a/0099-TEST-30-ISCSI-add-rd.scsi.firmware.patch b/0099-TEST-30-ISCSI-add-rd.scsi.firmware.patch new file mode 100644 index 0000000..ab86800 --- /dev/null +++ b/0099-TEST-30-ISCSI-add-rd.scsi.firmware.patch @@ -0,0 +1,65 @@ +From 6251f82c6fee64461fcccf820a5d12e144f714d3 Mon Sep 17 00:00:00 2001 +From: Harald Hoyer +Date: Tue, 25 Aug 2015 11:12:59 +0200 +Subject: [PATCH] TEST-30-ISCSI: add rd.scsi.firmware + +(cherry picked from commit 310574f7eaf68412035eb19855afe4ce2973b784) +--- + test/TEST-30-ISCSI/test.sh | 8 +++++++- + 1 file changed, 7 insertions(+), 1 deletion(-) + +diff --git a/test/TEST-30-ISCSI/test.sh b/test/TEST-30-ISCSI/test.sh +index be3399a..ffdb77f 100755 +--- a/test/TEST-30-ISCSI/test.sh ++++ b/test/TEST-30-ISCSI/test.sh +@@ -3,8 +3,9 @@ TEST_DESCRIPTION="root filesystem over iSCSI" + + KVERSION=${KVERSION-$(uname -r)} + +-#DEBUGFAIL="rd.shell rd.break rd.debug loglevel=7 " + DEBUGFAIL="loglevel=1" ++#DEBUGFAIL="rd.shell rd.break rd.debug loglevel=7 " ++#DEBUGFAIL="rd.debug loglevel=7 " + #SERVER_DEBUG="rd.debug loglevel=7" + SERIAL="tcp:127.0.0.1:9999" + SERIAL="null" +@@ -70,6 +71,7 @@ do_test_run() { + run_client "netroot=iscsi target0"\ + "root=LABEL=singleroot netroot=iscsi:192.168.50.1::::iqn.2009-06.dracut:target0" \ + "ip=192.168.50.101::192.168.50.1:255.255.255.0:iscsi-1:ens3:off" \ ++ "rd.iscsi.firmware" \ + "rd.iscsi.initiator=$initiator" \ + || return 1 + +@@ -79,6 +81,7 @@ do_test_run() { + "ip=192.168.51.101:::255.255.255.0::ens4:off" \ + "netroot=iscsi:192.168.51.1::::iqn.2009-06.dracut:target1" \ + "netroot=iscsi:192.168.50.1::::iqn.2009-06.dracut:target2" \ ++ "rd.iscsi.firmware" \ + "rd.iscsi.initiator=$initiator" \ + || return 1 + +@@ -88,6 +91,7 @@ do_test_run() { + "ip=192.168.51.101:::255.255.255.0::ens4:off" \ + "netroot=iscsi:192.168.51.1::::iqn.2009-06.dracut:target1" \ + "netroot=iscsi:192.168.50.1::::iqn.2009-06.dracut:target2" \ ++ "rd.iscsi.firmware" \ + "rd.iscsi.initiator=$initiator" \ + "rd.waitnet=0 rd.retry=30" \ + || return 1 +@@ -98,6 +102,7 @@ do_test_run() { + "ip=192.168.51.101:::255.255.255.0::ens4:off" \ + "netroot=iscsi:192.168.51.1::::iqn.2009-06.dracut:target1" \ + "netroot=iscsi:192.168.50.1::::iqn.2009-06.dracut:target2" \ ++ "rd.iscsi.firmware" \ + "rd.iscsi.initiator=$initiator" \ + "rd.waitnet=0 rd.iscsi.testroute=0 rd.retry=30" \ + || return 1 +@@ -108,6 +113,7 @@ do_test_run() { + "ip=192.168.51.101::192.168.51.1:255.255.255.0::ens4:off" \ + "netroot=iscsi:192.168.51.1::::iqn.2009-06.dracut:target1" \ + "netroot=iscsi:192.168.50.1::::iqn.2009-06.dracut:target2" \ ++ "rd.iscsi.firmware" \ + "rd.iscsi.initiator=$initiator" \ + "rd.waitnet=0 rd.iscsi.testroute=0 rd.retry=30" \ + || return 1 diff --git a/0100-initqueue-add-online-queue.patch b/0100-initqueue-add-online-queue.patch new file mode 100644 index 0000000..95e8f1a --- /dev/null +++ b/0100-initqueue-add-online-queue.patch @@ -0,0 +1,32 @@ +From ab57132aa5df3f85123cd7991c402b3f9ebdce73 Mon Sep 17 00:00:00 2001 +From: Harald Hoyer +Date: Tue, 25 Aug 2015 11:13:23 +0200 +Subject: [PATCH] initqueue: add online queue + +(cherry picked from commit d3f61fb5cdaa56053ae8de0203a13722a7fe717a) +--- + modules.d/99base/initqueue.sh | 4 +++- + 1 file changed, 3 insertions(+), 1 deletion(-) + +diff --git a/modules.d/99base/initqueue.sh b/modules.d/99base/initqueue.sh +index 193cc5c..c301638 100755 +--- a/modules.d/99base/initqueue.sh ++++ b/modules.d/99base/initqueue.sh +@@ -13,6 +13,8 @@ while [ $# -gt 0 ]; do + case "$1" in + --onetime) + onetime="yes";; ++ --online) ++ qname="/online";; + --settled) + qname="/settled";; + --finished) +@@ -50,7 +52,7 @@ fi + { + [ -n "$onetime" ] && echo '[ -e "$job" ] && rm -f -- "$job"' + [ -n "$env" ] && echo "$env" +- echo "$exe $@" ++ echo "$exe" "$@" + } > "/tmp/$$-${job}.sh" + + mv -f "/tmp/$$-${job}.sh" "$hookdir/initqueue${qname}/${job}.sh" diff --git a/0101-dracut.spec-raise-systemd-requirement-to-219.patch b/0101-dracut.spec-raise-systemd-requirement-to-219.patch new file mode 100644 index 0000000..9011247 --- /dev/null +++ b/0101-dracut.spec-raise-systemd-requirement-to-219.patch @@ -0,0 +1,25 @@ +From 01430d27d4c04e06a958164e6945ec7581f7190f Mon Sep 17 00:00:00 2001 +From: Harald Hoyer +Date: Tue, 25 Aug 2015 11:13:38 +0200 +Subject: [PATCH] dracut.spec: raise systemd requirement to >= 219 + +needs systemd-escape + +(cherry picked from commit 35f40b75e444adae3b3c9bb610d635d9c17a753d) +--- + dracut.spec | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/dracut.spec b/dracut.spec +index d0bb9bd..9e19fcc 100644 +--- a/dracut.spec ++++ b/dracut.spec +@@ -114,7 +114,7 @@ Requires: kpartx + + %if 0%{?fedora} || 0%{?rhel} > 6 + Requires: util-linux >= 2.21 +-Requires: systemd >= 199 ++Requires: systemd >= 219 + Requires: procps-ng + Conflicts: grubby < 8.23 + Conflicts: initscripts < 8.63-1 diff --git a/0102-iscsi-iscsiroot.sh-handle-firmware-in-online-queue.patch b/0102-iscsi-iscsiroot.sh-handle-firmware-in-online-queue.patch new file mode 100644 index 0000000..8193520 --- /dev/null +++ b/0102-iscsi-iscsiroot.sh-handle-firmware-in-online-queue.patch @@ -0,0 +1,60 @@ +From 7391fef29ab9a4766b5eb04d05803f2ebaa95752 Mon Sep 17 00:00:00 2001 +From: Harald Hoyer +Date: Tue, 25 Aug 2015 11:14:38 +0200 +Subject: [PATCH] iscsi/iscsiroot.sh: handle firmware in online queue + +otherwise it does not get called, if no netroot is set + +(cherry picked from commit 3bd3bbec319eccd28145f77e42b83b479286ff34) +--- + modules.d/95iscsi/iscsiroot.sh | 32 +++++++++++++++----------------- + 1 file changed, 15 insertions(+), 17 deletions(-) + +diff --git a/modules.d/95iscsi/iscsiroot.sh b/modules.d/95iscsi/iscsiroot.sh +index ad95812..893f279 100755 +--- a/modules.d/95iscsi/iscsiroot.sh ++++ b/modules.d/95iscsi/iscsiroot.sh +@@ -236,28 +236,26 @@ if [ "$netif" = "dummy" ] && all_ifaces_up; then + sleep 2 + fi + +-# loop over all netroot parameter +-netroot=$(getarg netroot) +-if [ $? -eq 0 ] && [ "$netroot" != "dhcp" ]; then +- for nroot in $(getargs netroot); do +- [ "${nroot%%:*}" = "iscsi" ] || continue +- nroot="${nroot##iscsi:}" +- if [ -n "$nroot" ]; then +- handle_netroot "$nroot" +- ret=$(($ret + $?)) +- fi +- done ++if [ "$netif" = "online" ]; then + if getargbool 0 rd.iscsi.firmware -d -y iscsi_firmware ; then + handle_firmware +- ret=$(($ret + $?)) ++ ret=$? + fi + else +- if [ -n "$iroot" ]; then +- handle_netroot "$iroot" +- ret=$? ++ # loop over all netroot parameter ++ nroot=$(getarg netroot) ++ if [ $? -eq 0 ] && [ "$nroot" != "dhcp" ]; then ++ for nroot in $(getargs netroot); do ++ [ "${nroot%%:*}" = "iscsi" ] || continue ++ nroot="${nroot##iscsi:}" ++ if [ -n "$nroot" ]; then ++ handle_netroot "$nroot" ++ ret=$(($ret + $?)) ++ fi ++ done + else +- if getargbool 0 rd.iscsi.firmware -d -y iscsi_firmware ; then +- handle_firmware ++ if [ -n "$iroot" ]; then ++ handle_netroot "$iroot" + ret=$? + fi + fi diff --git a/0103-iscsi-parse-iscsiroot.sh-do-not-modify-netroot.patch b/0103-iscsi-parse-iscsiroot.sh-do-not-modify-netroot.patch new file mode 100644 index 0000000..30debf4 --- /dev/null +++ b/0103-iscsi-parse-iscsiroot.sh-do-not-modify-netroot.patch @@ -0,0 +1,46 @@ +From 6138a45dd20319417a59f0592f67ac261a380031 Mon Sep 17 00:00:00 2001 +From: Harald Hoyer +Date: Tue, 25 Aug 2015 11:15:59 +0200 +Subject: [PATCH] iscsi/parse-iscsiroot.sh: do not modify netroot + +(cherry picked from commit 197e4c90b95f2d9e57104d3b462918c335494697) +--- + modules.d/95iscsi/parse-iscsiroot.sh | 17 +++++++++++++---- + 1 file changed, 13 insertions(+), 4 deletions(-) + +diff --git a/modules.d/95iscsi/parse-iscsiroot.sh b/modules.d/95iscsi/parse-iscsiroot.sh +index a889da1..c167dad 100755 +--- a/modules.d/95iscsi/parse-iscsiroot.sh ++++ b/modules.d/95iscsi/parse-iscsiroot.sh +@@ -14,10 +14,17 @@ + # This script is sourced, so root should be set. But let's be paranoid + [ -z "$root" ] && root=$(getarg root=) + if [ -z "$netroot" ]; then +- for netroot in $(getargs netroot=); do +- [ "${netroot%%:*}" = "iscsi" ] && break ++ for nroot in $(getargs netroot=); do ++ [ "${nroot%%:*}" = "iscsi" ] && break + done +- [ "${netroot%%:*}" = "iscsi" ] || unset netroot ++ if [ "${nroot%%:*}" = "iscsi" ]; then ++ netroot="$nroot" ++ else ++ for nroot in $(getargs netroot=); do ++ [ "${nroot%%:*}" = "dhcp" ] && break ++ done ++ netroot="$nroot" ++ fi + fi + [ -z "$iscsiroot" ] && iscsiroot=$(getarg iscsiroot=) + [ -z "$iscsi_firmware" ] && getargbool 0 rd.iscsi.firmware -y iscsi_firmware && iscsi_firmware="1" +@@ -59,7 +66,9 @@ fi + + # iscsi_firmware does not need argument checking + if [ -n "$iscsi_firmware" ] || getargbool 0 rd.iscsi.ibft -d "ip=ibft"; then +- [ -z "$netroot" ] && netroot=iscsi: ++ if [ "$root" != "dhcp" ] && [ "$netroot" != "dhcp" ]; then ++ [ -z "$netroot" ] && netroot=iscsi: ++ fi + modprobe -b -q iscsi_boot_sysfs 2>/dev/null + modprobe -b -q iscsi_ibft + fi diff --git a/0104-network-add-options-to-tweak-timeouts.patch b/0104-network-add-options-to-tweak-timeouts.patch new file mode 100644 index 0000000..d2dde90 --- /dev/null +++ b/0104-network-add-options-to-tweak-timeouts.patch @@ -0,0 +1,199 @@ +From 2448fbf17b8deb28046b9721503cab15721716ca Mon Sep 17 00:00:00 2001 +From: Harald Hoyer +Date: Fri, 3 Jul 2015 13:30:40 +0200 +Subject: [PATCH] network: add options to tweak timeouts + + rd.net.dhcp.retry= + If this option is set, dracut will try to connect via dhcp + times before failing. Default is 1. + + rd.net.timeout.dhcp= + If this option is set, dhclient is called with "-timeout ". + + rd.net.timeout.iflink= + Wait until link shows up. Default is 60 seconds. + + rd.net.timeout.ifup= + Wait until link has state "UP". Default is 20 seconds. + + rd.net.timeout.route= + Wait until route shows up. Default is 20 seconds. + + rd.net.timeout.ipv6dad= + Wait until IPv6 DAD is finished. Default is 50 seconds. + + rd.net.timeout.ipv6auto= + Wait until IPv6 automatic addresses are assigned. + Default is 40 seconds. + + rd.net.timeout.carrier= + Wait until carrier is recognized. Default is 5 seconds. + +(cherry picked from commit d8ad687e1a4c0343eb076902b11aff2b2b2c4b85) +--- + dracut.cmdline.7.asc | 25 +++++++++++++++++++++++++ + modules.d/40network/ifup.sh | 26 ++++++++++++++++++++++---- + modules.d/40network/net-lib.sh | 36 ++++++++++++++++++++++++++++++------ + 3 files changed, 77 insertions(+), 10 deletions(-) + +diff --git a/dracut.cmdline.7.asc b/dracut.cmdline.7.asc +index 8c7e965..d790afd 100644 +--- a/dracut.cmdline.7.asc ++++ b/dracut.cmdline.7.asc +@@ -606,6 +606,31 @@ NFS + **rd.nfs.domain=**____:: + Set the NFSv4 domain name. Will overwrite the settings in _/etc/idmap.conf_. + ++**rd.net.dhcp.retry=**____:: ++ If this option is set, dracut will try to connect via dhcp times before failing. ++ Default is 1. ++ ++**rd.net.timeout.dhcp=**____:: ++ If this option is set, dhclient is called with "-timeout ". ++ ++**rd.net.timeout.iflink=**____:: ++ Wait until link shows up. Default is 60 seconds. ++ ++**rd.net.timeout.ifup=**____:: ++ Wait until link has state "UP". Default is 20 seconds. ++ ++**rd.net.timeout.route=**____:: ++ Wait until route shows up. Default is 20 seconds. ++ ++**rd.net.timeout.ipv6dad=**____:: ++ Wait until IPv6 DAD is finished. Default is 50 seconds. ++ ++**rd.net.timeout.ipv6auto=**____:: ++ Wait until IPv6 automatic addresses are assigned. Default is 40 seconds. ++ ++**rd.net.timeout.carrier=**____:: ++ Wait until carrier is recognized. Default is 5 seconds. ++ + CIFS + ~~~ + **root=**cifs://[____[:____]@]____:____:: +diff --git a/modules.d/40network/ifup.sh b/modules.d/40network/ifup.sh +index 0138e01..bb20afe 100755 +--- a/modules.d/40network/ifup.sh ++++ b/modules.d/40network/ifup.sh +@@ -93,15 +93,33 @@ do_dhcp() { + # event for nfsroot + # XXX add -V vendor class and option parsing per kernel + ++ local _COUNT=0 ++ local _timeout=$(getargs rd.net.timeout.dhcp=) ++ local _DHCPRETRY=$(getargs rd.net.dhcp.retry=) ++ _DHCPRETRY=${_DHCPRETRY:-1} ++ + [ -e /tmp/dhclient.$netif.pid ] && return 0 + + if ! iface_has_link $netif; then +- echo "No carrier detected" ++ warn "No carrier detected on interface $netif" + return 1 + fi +- echo "Starting dhcp for interface $netif" +- dhclient "$@" -1 -q -cf /etc/dhclient.conf -pf /tmp/dhclient.$netif.pid -lf /tmp/dhclient.$netif.lease $netif \ +- || echo "dhcp failed" ++ ++ while [ $_COUNT -lt $_DHCPRETRY ]; do ++ info "Starting dhcp for interface $netif" ++ dhclient "$@" \ ++ ${_timeout:+-timeout $_timeout} \ ++ -1 -q \ ++ -cf /etc/dhclient.conf \ ++ -pf /tmp/dhclient.$netif.pid \ ++ -lf /tmp/dhclient.$netif.lease \ ++ $netif \ ++ && return 0 ++ _COUNT=$(($_COUNT+1)) ++ [ $_COUNT -lt $_DHCPRETRY ] && sleep 1 ++ done ++ warn "dhcp for interface $netif failed" ++ return 1 + } + + load_ipv6() { +diff --git a/modules.d/40network/net-lib.sh b/modules.d/40network/net-lib.sh +index 2e79619..2f25de7 100755 +--- a/modules.d/40network/net-lib.sh ++++ b/modules.d/40network/net-lib.sh +@@ -504,7 +504,11 @@ parse_ifname_opts() { + wait_for_if_link() { + local cnt=0 + local li +- while [ $cnt -lt 600 ]; do ++ local timeout="$(getargs rd.net.timeout.iflink=)" ++ timeout=${timeout:-60} ++ timeout=$(($timeout*10)) ++ ++ while [ $cnt -lt $timeout ]; do + li=$(ip -o link show dev $1 2>/dev/null) + [ -n "$li" ] && return 0 + sleep 0.1 +@@ -516,7 +520,11 @@ wait_for_if_link() { + wait_for_if_up() { + local cnt=0 + local li +- while [ $cnt -lt 200 ]; do ++ local timeout="$(getargs rd.net.timeout.ifup=)" ++ timeout=${timeout:-20} ++ timeout=$(($timeout*10)) ++ ++ while [ $cnt -lt $timeout ]; do + li=$(ip -o link show up dev $1) + [ -n "$li" ] && [ -z "${li##*state UP*}" ] && return 0 + sleep 0.1 +@@ -527,7 +535,11 @@ wait_for_if_up() { + + wait_for_route_ok() { + local cnt=0 +- while [ $cnt -lt 200 ]; do ++ local timeout="$(getargs rd.net.timeout.route=)" ++ timeout=${timeout:-20} ++ timeout=$(($timeout*10)) ++ ++ while [ $cnt -lt $timeout ]; do + li=$(ip route show) + [ -n "$li" ] && [ -z "${li##*$1*}" ] && return 0 + sleep 0.1 +@@ -539,7 +551,11 @@ wait_for_route_ok() { + wait_for_ipv6_dad() { + local cnt=0 + local li +- while [ $cnt -lt 500 ]; do ++ local timeout="$(getargs rd.net.timeout.ipv6dad=)" ++ timeout=${timeout:-50} ++ timeout=$(($timeout*10)) ++ ++ while [ $cnt -lt $timeout ]; do + li=$(ip -6 addr show dev $1 scope link) + strstr "$li" "tentative" || return 0 + sleep 0.1 +@@ -551,7 +567,11 @@ wait_for_ipv6_dad() { + wait_for_ipv6_auto() { + local cnt=0 + local li +- while [ $cnt -lt 400 ]; do ++ local timeout="$(getargs rd.net.timeout.ipv6auto=)" ++ timeout=${timeout:-40} ++ timeout=$(($timeout*10)) ++ ++ while [ $cnt -lt $timeout ]; do + li=$(ip -6 addr show dev $1) + if ! strstr "$li" "tentative"; then + strstr "$li" "dynamic" && return 0 +@@ -579,8 +599,12 @@ iface_has_link() { + [ -n "$interface" ] || return 2 + interface="/sys/class/net/$interface" + [ -d "$interface" ] || return 2 ++ local timeout="$(getargs rd.net.timeout.carrier=)" ++ timeout=${timeout:-5} ++ timeout=$(($timeout*10)) ++ + linkup "$1" +- while [ $cnt -lt 50 ]; do ++ while [ $cnt -lt $timeout ]; do + [ "$(cat $interface/carrier)" = 1 ] && return 0 + sleep 0.1 + cnt=$(($cnt+1)) diff --git a/0105-fcoe-start-with-fcoemon-instead-of-fipvlan.patch b/0105-fcoe-start-with-fcoemon-instead-of-fipvlan.patch new file mode 100644 index 0000000..1cd844e --- /dev/null +++ b/0105-fcoe-start-with-fcoemon-instead-of-fipvlan.patch @@ -0,0 +1,127 @@ +From 4891d9a2ce693f5649b4a0e9214d00488e0b128c Mon Sep 17 00:00:00 2001 +From: Chris Leech +Date: Fri, 3 Jul 2015 13:40:12 +0200 +Subject: [PATCH] fcoe: start with fcoemon instead of fipvlan + +(cherry picked from commit d02f522089863af2a802cef9e63965349bfcc819) +--- + modules.d/95fcoe/fcoe-up.sh | 30 ++++++++++++++++++++++++++++-- + modules.d/95fcoe/module-setup.sh | 8 +++++--- + modules.d/95fcoe/parse-fcoe.sh | 5 +---- + 3 files changed, 34 insertions(+), 9 deletions(-) + +diff --git a/modules.d/95fcoe/fcoe-up.sh b/modules.d/95fcoe/fcoe-up.sh +index 950e4b6..fb3b4c4 100755 +--- a/modules.d/95fcoe/fcoe-up.sh ++++ b/modules.d/95fcoe/fcoe-up.sh +@@ -15,6 +15,7 @@ type ip_to_var >/dev/null 2>&1 || . /lib/net-lib.sh + + netif=$1 + dcb=$2 ++vlan="yes" + + iflink=$(cat /sys/class/net/$netif/iflink) + ifindex=$(cat /sys/class/net/$netif/ifindex) +@@ -29,6 +30,21 @@ linkup "$netif" + netdriver=$(readlink -f /sys/class/net/$netif/device/driver) + netdriver=${netdriver##*/} + ++write_fcoemon_cfg() { ++ echo FCOE_ENABLE=\"yes\" > /etc/fcoe/cfg-$netif ++ if [ "$dcb" = "dcb" ]; then ++ echo DCB_REQUIRED=\"yes\" >> /etc/fcoe/cfg-$netif ++ else ++ echo DCB_REQUIRED=\"no\" >> /etc/fcoe/cfg-$netif ++ fi ++ if [ "$vlan" = "yes" ]; then ++ echo AUTO_VLAN=\"yes\" >> /etc/fcoe/cfg-$netif ++ else ++ echo AUTO_VLAN=\"no\" >> /etc/fcoe/cfg-$netif ++ fi ++ echo MODE=\"fabric\" >> /etc/fcoe/cfg-$netif ++} ++ + if [ "$dcb" = "dcb" ]; then + # wait for lldpad to be ready + i=0 +@@ -47,6 +63,13 @@ if [ "$dcb" = "dcb" ]; then + done + + while [ $i -lt 60 ]; do ++ dcbtool sc "$netif" pfc e:1 a:1 w:1 && break ++ info "Retrying to turn dcb on" ++ sleep 1 ++ i=$(($i+1)) ++ done ++ ++ while [ $i -lt 60 ]; do + dcbtool sc "$netif" app:fcoe e:1 a:1 w:1 && break + info "Retrying to turn fcoe on" + sleep 1 +@@ -55,7 +78,8 @@ if [ "$dcb" = "dcb" ]; then + + sleep 1 + +- fipvlan "$netif" -c -s ++ write_fcoemon_cfg ++ fcoemon --syslog + elif [ "$netdriver" = "bnx2x" ]; then + # If driver is bnx2x, do not use /sys/module/fcoe/parameters/create but fipvlan + modprobe 8021q +@@ -64,7 +88,9 @@ elif [ "$netdriver" = "bnx2x" ]; then + sleep 3 + fipvlan "$netif" -c -s + else +- printf '%s' "$netif" > /sys/module/fcoe/parameters/create ++ vlan="no" ++ write_fcoemon_cfg ++ fcoemon --syslog + fi + + need_shutdown +diff --git a/modules.d/95fcoe/module-setup.sh b/modules.d/95fcoe/module-setup.sh +index 9c67f17..ae606aa 100755 +--- a/modules.d/95fcoe/module-setup.sh ++++ b/modules.d/95fcoe/module-setup.sh +@@ -10,8 +10,7 @@ check() { + [ -z "$fcoe_ctlr" ] && return 255 + } + +- require_binaries dcbtool fipvlan lldpad ip readlink || return 1 +- ++ require_binaries dcbtool fipvlan lldpad ip readlink fcoemon fcoeadm || return 1 + return 0 + } + +@@ -67,9 +66,12 @@ cmdline() { + + # called by dracut + install() { +- inst_multiple ip dcbtool fipvlan lldpad readlink lldptool ++ inst_multiple ip dcbtool fipvlan lldpad readlink lldptool fcoemon fcoeadm ++ inst_libdir_file 'libhbalinux.so*' ++ inst "/etc/hba.conf" "/etc/hba.conf" + + mkdir -m 0755 -p "$initdir/var/lib/lldpad" ++ mkdir -m 0755 -p "$initdir/etc/fcoe" + + if [[ $hostonly_cmdline == "yes" ]] ; then + local _fcoeconf=$(cmdline) +diff --git a/modules.d/95fcoe/parse-fcoe.sh b/modules.d/95fcoe/parse-fcoe.sh +index a214007..9f47184 100755 +--- a/modules.d/95fcoe/parse-fcoe.sh ++++ b/modules.d/95fcoe/parse-fcoe.sh +@@ -18,12 +18,9 @@ + # If it's not set we don't continue + [ -z "$fcoe" ] && return + +- +-# BRCM: Later, should check whether bnx2x is loaded first before loading bnx2fc so do not load bnx2fc when there are no Broadcom adapters +-[ -d /sys/module/fcoe ] || modprobe -b -a fcoe || die "FCoE requested but kernel/initrd does not support FCoE" ++[ -e /sys/bus/fcoe/ctlr_create ] || modprobe -b -a fcoe || die "FCoE requested but kernel/initrd does not support FCoE" + + initqueue --onetime modprobe -b -q bnx2fc +-udevadm settle --timeout=30 + + parse_fcoe_opts() { + local OLDIFS="$IFS" diff --git a/0106-fcoe-EDD-parsing-patch-for-i40e.patch b/0106-fcoe-EDD-parsing-patch-for-i40e.patch new file mode 100644 index 0000000..96f487b --- /dev/null +++ b/0106-fcoe-EDD-parsing-patch-for-i40e.patch @@ -0,0 +1,36 @@ +From 9a5bd6804a56d5c3091d26894c5302980b38252e Mon Sep 17 00:00:00 2001 +From: Chris Leech +Date: Fri, 3 Jul 2015 13:44:16 +0200 +Subject: [PATCH] fcoe: EDD parsing patch for i40e + +(cherry picked from commit 4031a2fa642c1db897c1340ad2718301bf873fb3) +--- + modules.d/95fcoe/fcoe-edd.sh | 13 +++++++++++++ + 1 file changed, 13 insertions(+) + +diff --git a/modules.d/95fcoe/fcoe-edd.sh b/modules.d/95fcoe/fcoe-edd.sh +index 9ab2d3e..fb3dcd7 100755 +--- a/modules.d/95fcoe/fcoe-edd.sh ++++ b/modules.d/95fcoe/fcoe-edd.sh +@@ -9,8 +9,21 @@ fi + + for disk in /sys/firmware/edd/int13_*; do + [ -d $disk ] || continue ++ if [ -e ${disk}/pci_dev/driver ]; then ++ driver=`readlink ${disk}/pci_dev/driver` ++ driver=${driver##*/} ++ fi ++ # i40e uses dev_port 1 for a virtual fcoe function ++ if [ "${driver}" == "i40e" ]; then ++ dev_port=1 ++ fi + for nic in ${disk}/pci_dev/net/*; do + [ -d $nic ] || continue ++ if [ -n "${dev_port}" -a -e ${nic}/dev_port ]; then ++ if [ `cat ${nic}/dev_port` -ne ${dev_port} ]; then ++ continue ++ fi ++ fi + if [ -e ${nic}/address ]; then + fcoe_interface=${nic##*/} + if ! [ -e "/tmp/.fcoe-$fcoe_interface" ]; then diff --git a/0107-fcoe-fcoe-edd.sh-cleanup-the-script.patch b/0107-fcoe-fcoe-edd.sh-cleanup-the-script.patch new file mode 100644 index 0000000..fd8017b --- /dev/null +++ b/0107-fcoe-fcoe-edd.sh-cleanup-the-script.patch @@ -0,0 +1,87 @@ +From cca313fa759997d8d2f2d1926e51c91b152e363b Mon Sep 17 00:00:00 2001 +From: Harald Hoyer +Date: Fri, 3 Jul 2015 13:52:32 +0200 +Subject: [PATCH] fcoe/fcoe-edd.sh: cleanup the script + +- check if modprobe was successful +- add a timeout for /sys/firmware/edd +- only remove the module, if it was loaded by the script + +(cherry picked from commit 34203d03c0d43aa0aed12988d2719455e80eae54) +--- + modules.d/95fcoe/fcoe-edd.sh | 46 ++++++++++++++++++++++++++++++-------------- + 1 file changed, 32 insertions(+), 14 deletions(-) + +diff --git a/modules.d/95fcoe/fcoe-edd.sh b/modules.d/95fcoe/fcoe-edd.sh +index fb3dcd7..3b07ad3 100755 +--- a/modules.d/95fcoe/fcoe-edd.sh ++++ b/modules.d/95fcoe/fcoe-edd.sh +@@ -1,36 +1,54 @@ + #!/bin/sh + +-dcb=$1 ++dcb="$1" + +-if ! [ -d /sys/firmware/edd ]; then +- modprobe edd +- while ! [ -d /sys/firmware/edd ]; do sleep 0.1; done +-fi ++_modprobe_r_edd="0" ++ ++check_edd() { ++ local cnt=0 ++ ++ [ -d /sys/firmware/edd ] && return 0 ++ ++ _modprobe_r_edd="1" ++ modprobe edd || return $? ++ ++ while [ $cnt -lt 600 ]; do ++ [ -d /sys/firmware/edd ] && return 0 ++ cnt=$(($cnt+1)) ++ sleep 0.1 ++ done ++ return 1 ++} ++ ++check_edd || exit 1 + + for disk in /sys/firmware/edd/int13_*; do +- [ -d $disk ] || continue +- if [ -e ${disk}/pci_dev/driver ]; then +- driver=`readlink ${disk}/pci_dev/driver` ++ [ -d "$disk" ] || continue ++ if [ -e "${disk}/pci_dev/driver" ]; then ++ driver=$(readlink "${disk}/pci_dev/driver") + driver=${driver##*/} + fi + # i40e uses dev_port 1 for a virtual fcoe function + if [ "${driver}" == "i40e" ]; then + dev_port=1 + fi +- for nic in ${disk}/pci_dev/net/*; do +- [ -d $nic ] || continue +- if [ -n "${dev_port}" -a -e ${nic}/dev_port ]; then +- if [ `cat ${nic}/dev_port` -ne ${dev_port} ]; then ++ for nic in "${disk}"/pci_dev/net/*; do ++ [ -d "$nic" ] || continue ++ if [ -n "${dev_port}" -a -e "${nic}/dev_port" ]; then ++ if [ "$(cat ${nic}/dev_port)" -ne "${dev_port}" ]; then + continue + fi + fi + if [ -e ${nic}/address ]; then + fcoe_interface=${nic##*/} + if ! [ -e "/tmp/.fcoe-$fcoe_interface" ]; then +- /sbin/fcoe-up $fcoe_interface $dcb ++ /sbin/fcoe-up "$fcoe_interface" "$dcb" + > "/tmp/.fcoe-$fcoe_interface" + fi + fi + done + done +-modprobe -r edd ++ ++[ "$_modprobe_r_edd" = "1" ] && modprobe -r edd ++ ++unset _modprobe_r_edd diff --git a/0108-livenet-don-t-attempt-to-download-the-image-for-ever.patch b/0108-livenet-don-t-attempt-to-download-the-image-for-ever.patch new file mode 100644 index 0000000..d1ae8cd --- /dev/null +++ b/0108-livenet-don-t-attempt-to-download-the-image-for-ever.patch @@ -0,0 +1,38 @@ +From 3913d061c4bdfad3f496f7a3d0a69e0f3ef51a47 Mon Sep 17 00:00:00 2001 +From: Harald Hoyer +Date: Fri, 3 Jul 2015 14:00:33 +0200 +Subject: [PATCH] livenet: don't attempt to download the image for every + interface + +https://bugzilla.redhat.com/show_bug.cgi?id=1152485 +(cherry picked from commit e5f4bbd804e337a7efaf3a0cb4fc3a37b7e33b47) +--- + modules.d/90livenet/livenetroot.sh | 10 +++++++++- + 1 file changed, 9 insertions(+), 1 deletion(-) + +diff --git a/modules.d/90livenet/livenetroot.sh b/modules.d/90livenet/livenetroot.sh +index 1bbee55..2e36ee9 100755 +--- a/modules.d/90livenet/livenetroot.sh ++++ b/modules.d/90livenet/livenetroot.sh +@@ -7,12 +7,20 @@ type getarg >/dev/null 2>&1 || . /lib/dracut-lib.sh + + PATH=/usr/sbin:/usr/bin:/sbin:/bin + ++[ -e /tmp/livenet.downloaded ] && exit 0 ++ + # args get passed from 40network/netroot + netroot="$2" + liveurl="${netroot#livenet:}" + info "fetching $liveurl" + imgfile=$(fetch_url "$liveurl") +-[ $? = 0 ] || die "failed to download live image: error $?" ++ ++if [ $? = 0 ]; then ++ warn "failed to download live image: error $?" ++ exit 1 ++fi ++ ++> /tmp/livenet.downloaded + + # TODO: couldn't dmsquash-live-root handle this? + if [ ${imgfile##*.} = "iso" ]; then diff --git a/0109-multipath-install-all-multipath-path-selector-kernel.patch b/0109-multipath-install-all-multipath-path-selector-kernel.patch new file mode 100644 index 0000000..e1fb0f7 --- /dev/null +++ b/0109-multipath-install-all-multipath-path-selector-kernel.patch @@ -0,0 +1,36 @@ +From 848edf22f0a2f664310026871139e1ab0f49bd52 Mon Sep 17 00:00:00 2001 +From: Harald Hoyer +Date: Fri, 3 Jul 2015 14:24:50 +0200 +Subject: [PATCH] multipath: install all multipath path selector kernel modules + +By default, dracut only builds in dm-service-time into the initramfs as +that is the default multipath.conf path selector. If the user changes +the path selector to "round robin" on the fly and runs dracut, multipath +does not find any paths on boot and the user will be dropped into a +shell. + +Apparently, in RHEL7 dracut defaults to "hostonly" mode, i.e. modules +not currently in use at the time dracut runs do not get built into +initramfs. This is definitely one case where this doesn't work. A change +to reconfigure multipath probably should not render the system +unbootable. + +https://bugzilla.redhat.com/show_bug.cgi?id=1195392 +(cherry picked from commit f11d7a81e2eec37ed5b6708ed8cd359f0a5eaa69) +--- + modules.d/90multipath/module-setup.sh | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/modules.d/90multipath/module-setup.sh b/modules.d/90multipath/module-setup.sh +index 321f13e..831c99f 100755 +--- a/modules.d/90multipath/module-setup.sh ++++ b/modules.d/90multipath/module-setup.sh +@@ -84,7 +84,7 @@ installkernel() { + } + + ( find_kernel_modules_by_path drivers/scsi; if [ "$_arch" = "s390" -o "$_arch" = "s390x" ]; then find_kernel_modules_by_path drivers/s390/scsi; fi; +- find_kernel_modules_by_path drivers/md ) | mp_mod_filter | instmods ++ find_kernel_modules_by_path drivers/md ) | mp_mod_filter | hostonly='' instmods + } + + # called by dracut diff --git a/0110-man-page-changed-grub.conf-to-grub2.cfg.patch b/0110-man-page-changed-grub.conf-to-grub2.cfg.patch new file mode 100644 index 0000000..48ea24d --- /dev/null +++ b/0110-man-page-changed-grub.conf-to-grub2.cfg.patch @@ -0,0 +1,73 @@ +From 20486a16e9f2d203a1877ff5de0b1b0bf9d74d9a Mon Sep 17 00:00:00 2001 +From: Harald Hoyer +Date: Fri, 3 Jul 2015 14:28:55 +0200 +Subject: [PATCH] man page: changed grub.conf to grub2.cfg + +(cherry picked from commit 77c0b308259d3b91c536de9a49c0b99427c5924e) +--- + dracut.usage.asc | 16 ++++++---------- + 1 file changed, 6 insertions(+), 10 deletions(-) + +diff --git a/dracut.usage.asc b/dracut.usage.asc +index b4a8663..2b25588 100644 +--- a/dracut.usage.asc ++++ b/dracut.usage.asc +@@ -99,10 +99,6 @@ raid with encryption and LVM on top), as long as you specify the correct + filesystem LABEL or UUID on the kernel command line for your root device, dracut + will find it and boot from it. + +-The kernel command line usually can be configured in _/boot/grub/grub.conf_ or +-_/boot/grub2/grub.cfg_, if grub is your bootloader and it also can be edited in +-the real boot process in the grub menu. +- + The kernel command line can also be provided by the dhcp server with the + root-path option. See <>. + +@@ -310,7 +306,7 @@ stick and mount that. Then you can store the output for later inspection. + In all cases, the following should be mentioned and attached to your bug report: + + * The exact kernel command-line used. Typically from the bootloader +-configuration file (e.g. _/etc/grub.conf_) or from _/proc/cmdline_. ++configuration file (e.g. _/boot/grub2/grub.cfg_) or from _/proc/cmdline_. + * A copy of your disk partition information from _/etc/fstab_, which might be + obtained booting an old working initramfs or a rescue medium. + * Turn on dracut debugging (see _the 'debugging dracut' section_), and attach +@@ -345,7 +341,7 @@ logging during the system boot. This section documents configuring a + serial console connection to record boot messages. + + . First, enable serial console output for both the kernel and the bootloader. +-. Open the file _/etc/grub.conf_ for editing. Below the line ''timeout=5'', add ++. Open the file _/boot/grub2/grub.cfg_ for editing. Below the line ''timeout=5'', add + the following: + + + ---- +@@ -353,14 +349,14 @@ serial --unit=0 --speed=9600 + terminal --timeout=5 serial console + ---- + + +-. Also in _/etc/grub.conf_, add the following boot arguemnts to the ''kernel'' ++. Also in _/boot/grub2/grub.cfg_, add the following boot arguemnts to the ''kernel'' + line: + + + ---- + console=tty0 console=ttyS0,9600 + ---- + + +-. When finished, the _/etc/grub.conf_ file should look similar to the example ++. When finished, the _/boot/grub2/grub.cfg_ file should look similar to the example + below. + + + ---- +@@ -395,10 +391,10 @@ dracut offers a shell for interactive debugging in the event dracut fails to + locate your root filesystem. To enable the shell: + + . Add the boot parameter ''rd.shell'' to your bootloader configuration file +-(e.g. _/etc/grub.conf_) ++(e.g. _/boot/grub2/grub.cfg_) + . Remove the boot arguments ''rhgb'' and ''quiet'' + + +-A sample _/etc/grub.conf_ bootloader configuration file is listed below. ++A sample _/boot/grub2/grub.cfg_ bootloader configuration file is listed below. + + + ---- + default=0 diff --git a/0111-crypt-install-drbg-unconditionally-in-hostonly-mode.patch b/0111-crypt-install-drbg-unconditionally-in-hostonly-mode.patch new file mode 100644 index 0000000..8b704e3 --- /dev/null +++ b/0111-crypt-install-drbg-unconditionally-in-hostonly-mode.patch @@ -0,0 +1,24 @@ +From 9af753c46896cfcb5480bbb1dd896e042043349c Mon Sep 17 00:00:00 2001 +From: Harald Hoyer +Date: Thu, 9 Jul 2015 16:14:50 +0200 +Subject: [PATCH] crypt: install drbg unconditionally in hostonly mode + +older kernels had the drbg kernel module and didn't need it + +(cherry picked from commit 89948e58fd0f80def0912c18c503912873aa9c48) +--- + modules.d/90crypt/module-setup.sh | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/modules.d/90crypt/module-setup.sh b/modules.d/90crypt/module-setup.sh +index e8c690e..4df520c 100755 +--- a/modules.d/90crypt/module-setup.sh ++++ b/modules.d/90crypt/module-setup.sh +@@ -25,6 +25,7 @@ depends() { + # called by dracut + installkernel() { + instmods dm_crypt =crypto ++ hostonly="" instmods drbg + } + + # called by dracut diff --git a/0112-iscsi-module-setup.sh-iscsid-need-var-lib-iscsi.patch b/0112-iscsi-module-setup.sh-iscsid-need-var-lib-iscsi.patch new file mode 100644 index 0000000..9ab5ed7 --- /dev/null +++ b/0112-iscsi-module-setup.sh-iscsid-need-var-lib-iscsi.patch @@ -0,0 +1,22 @@ +From f5753e1861c5eaf688d552ca50a6dd0f8e1d0f85 Mon Sep 17 00:00:00 2001 +From: Harald Hoyer +Date: Sat, 15 Aug 2015 13:22:07 +0200 +Subject: [PATCH] iscsi/module-setup.sh: iscsid need /var/lib/iscsi + +(cherry picked from commit f74b0a9f38838dddcf6f56daa9f20fc3e86087ca) +--- + modules.d/95iscsi/module-setup.sh | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/modules.d/95iscsi/module-setup.sh b/modules.d/95iscsi/module-setup.sh +index 3002591..beb80e3 100755 +--- a/modules.d/95iscsi/module-setup.sh ++++ b/modules.d/95iscsi/module-setup.sh +@@ -257,6 +257,6 @@ install() { + echo "Before=dracut-initqueue.service" + ) > "${initdir}/$systemdsystemunitdir/iscsid.service.d/dracut.conf" + fi +- ++ inst_dir /var/lib/iscsi + dracut_need_initqueue + } diff --git a/0113-TEST-30-ISCSI-fix-test-to-run-with-new-iscsi.patch b/0113-TEST-30-ISCSI-fix-test-to-run-with-new-iscsi.patch new file mode 100644 index 0000000..a79dc8e --- /dev/null +++ b/0113-TEST-30-ISCSI-fix-test-to-run-with-new-iscsi.patch @@ -0,0 +1,50 @@ +From 0a10d7fc51e181f6e9c4715f563be3861c054a56 Mon Sep 17 00:00:00 2001 +From: Harald Hoyer +Date: Sat, 15 Aug 2015 13:22:44 +0200 +Subject: [PATCH] TEST-30-ISCSI: fix test to run with new iscsi + +(cherry picked from commit 836ca3f47eb0b0a4c97ae704b0b9619a00dbfa87) +--- + test/TEST-30-ISCSI/test.sh | 8 ++++---- + 1 file changed, 4 insertions(+), 4 deletions(-) + +diff --git a/test/TEST-30-ISCSI/test.sh b/test/TEST-30-ISCSI/test.sh +index ffdb77f..fc4bdce 100755 +--- a/test/TEST-30-ISCSI/test.sh ++++ b/test/TEST-30-ISCSI/test.sh +@@ -49,7 +49,7 @@ run_client() { + -net nic,macaddr=52:54:00:12:34:00,model=e1000 \ + -net nic,macaddr=52:54:00:12:34:01,model=e1000 \ + -net socket,connect=127.0.0.1:12330 \ +- -append "rw rd.auto rd.retry=20 console=ttyS0,115200n81 selinux=0 rd.debug=0 $DEBUGFAIL $*" \ ++ -append "rw rd.auto rd.retry=50 console=ttyS0,115200n81 selinux=0 rd.debug=0 $DEBUGFAIL $*" \ + -initrd $TESTDIR/initramfs.testing + if ! grep -F -m 1 -q iscsi-OK $TESTDIR/client.img; then + echo "CLIENT TEST END: $test_name [FAILED - BAD EXIT]" +@@ -93,7 +93,7 @@ do_test_run() { + "netroot=iscsi:192.168.50.1::::iqn.2009-06.dracut:target2" \ + "rd.iscsi.firmware" \ + "rd.iscsi.initiator=$initiator" \ +- "rd.waitnet=0 rd.retry=30" \ ++ "rd.iscsi.waitnet=0" \ + || return 1 + + run_client "netroot=iscsi target1 target2 rd.iscsi.waitnet=0 rd.iscsi.testroute=0" \ +@@ -104,7 +104,7 @@ do_test_run() { + "netroot=iscsi:192.168.50.1::::iqn.2009-06.dracut:target2" \ + "rd.iscsi.firmware" \ + "rd.iscsi.initiator=$initiator" \ +- "rd.waitnet=0 rd.iscsi.testroute=0 rd.retry=30" \ ++ "rd.iscsi.waitnet=0 rd.iscsi.testroute=0" \ + || return 1 + + run_client "netroot=iscsi target1 target2 rd.iscsi.waitnet=0 rd.iscsi.testroute=0 default GW" \ +@@ -115,7 +115,7 @@ do_test_run() { + "netroot=iscsi:192.168.50.1::::iqn.2009-06.dracut:target2" \ + "rd.iscsi.firmware" \ + "rd.iscsi.initiator=$initiator" \ +- "rd.waitnet=0 rd.iscsi.testroute=0 rd.retry=30" \ ++ "rd.iscsi.waitnet=0 rd.iscsi.testroute=0" \ + || return 1 + + return 0 diff --git a/0114-iscsi-handle-timeout-case-better.patch b/0114-iscsi-handle-timeout-case-better.patch new file mode 100644 index 0000000..33fc0b5 --- /dev/null +++ b/0114-iscsi-handle-timeout-case-better.patch @@ -0,0 +1,120 @@ +From bcbcacb5d66276157274c1e35d1fea2f937c4677 Mon Sep 17 00:00:00 2001 +From: Harald Hoyer +Date: Tue, 18 Aug 2015 11:50:15 +0200 +Subject: [PATCH] iscsi: handle timeout case better + +(cherry picked from commit bfe65f913a4bc6bc5fdb7aa75234c229a2ceef8f) +--- + modules.d/95iscsi/iscsiroot.sh | 6 +++--- + modules.d/95iscsi/parse-iscsiroot.sh | 41 +++++++++++++++++++++--------------- + 2 files changed, 27 insertions(+), 20 deletions(-) + +diff --git a/modules.d/95iscsi/iscsiroot.sh b/modules.d/95iscsi/iscsiroot.sh +index 893f279..e730cb0 100755 +--- a/modules.d/95iscsi/iscsiroot.sh ++++ b/modules.d/95iscsi/iscsiroot.sh +@@ -106,7 +106,7 @@ handle_netroot() + parse_iscsi_root "$1" || return 1 + + # Bail out early, if there is no route to the destination +- if is_ip "$iscsi_target_ip" && [ "$netif" != "dummy" ] && ! all_ifaces_up && getargbool 1 rd.iscsi.testroute; then ++ if is_ip "$iscsi_target_ip" && [ "$netif" != "timeout" ] && ! all_ifaces_up && getargbool 1 rd.iscsi.testroute; then + ip route get "$iscsi_target_ip" >/dev/null 2>&1 || return 0 + fi + +@@ -224,11 +224,11 @@ handle_netroot() + + ret=0 + +-if [ "$netif" != "dummy" ] && getargbool 1 rd.iscsi.waitnet; then ++if [ "$netif" != "timeout" ] && getargbool 1 rd.iscsi.waitnet; then + all_ifaces_up || exit 0 + fi + +-if [ "$netif" = "dummy" ] && all_ifaces_up; then ++if [ "$netif" = "timeout" ] && all_ifaces_up; then + # s.th. went wrong and the timeout script hits + # restart + systemctl restart iscsid +diff --git a/modules.d/95iscsi/parse-iscsiroot.sh b/modules.d/95iscsi/parse-iscsiroot.sh +index c167dad..35628cc 100755 +--- a/modules.d/95iscsi/parse-iscsiroot.sh ++++ b/modules.d/95iscsi/parse-iscsiroot.sh +@@ -47,7 +47,11 @@ if [ "${root%%:*}" = "iscsi" ] ; then + fi + + # If it's not empty or iscsi we don't continue +-[ -z "$netroot" ] || [ "${netroot%%:*}" = "iscsi" ] || return ++for nroot in $(getargs netroot); do ++ [ "${nroot%%:*}" = "iscsi" ] || continue ++ netroot="$nroot" ++ break ++done + + if [ -n "$iscsiroot" ] ; then + [ -z "$netroot" ] && netroot=$root +@@ -71,19 +75,18 @@ if [ -n "$iscsi_firmware" ] || getargbool 0 rd.iscsi.ibft -d "ip=ibft"; then + fi + modprobe -b -q iscsi_boot_sysfs 2>/dev/null + modprobe -b -q iscsi_ibft ++ # if no ip= is given, but firmware ++ echo "[ -f '/tmp/iscsistarted-firmware' ]" > $hookdir/initqueue/finished/iscsi_started.sh ++ initqueue --unique --onetime --timeout /sbin/iscsiroot timeout "$netroot" "$NEWROOT" ++ initqueue --unique --onetime --settled /sbin/iscsiroot dummy "'$netroot'" "'$NEWROOT'" + fi + +-initqueue --onetime --timeout /sbin/iscsiroot dummy "$netroot" "$NEWROOT" + +-# If it's not iscsi we don't continue +-[ "${netroot%%:*}" = "iscsi" ] || return ++[ -z "$netroot" ] || [ "${netroot%%:*}" = "iscsi" ] || return 1 + +-initqueue --onetime modprobe --all -b -q qla4xxx cxgb3i cxgb4i bnx2i be2iscsi ++initqueue --unique --onetime --timeout /sbin/iscsiroot timeout "$netroot" "$NEWROOT" + +-if [ -z "$iscsi_firmware" ] ; then +- type parse_iscsi_root >/dev/null 2>&1 || . /lib/net-lib.sh +- parse_iscsi_root "$netroot" || return +-fi ++initqueue --onetime modprobe --all -b -q qla4xxx cxgb3i cxgb4i bnx2i be2iscsi + + # ISCSI actually supported? + if ! [ -e /sys/module/iscsi_tcp ]; then +@@ -92,7 +95,7 @@ fi + + if [ -n "$netroot" ] && [ "$root" != "/dev/root" ] && [ "$root" != "dhcp" ]; then + if ! getargbool 1 rd.neednet >/dev/null || ! getarg "ip="; then +- initqueue --onetime --settled /sbin/iscsiroot dummy "$netroot" "$NEWROOT" ++ initqueue --unique --onetime --settled /sbin/iscsiroot dummy "'$netroot'" "'$NEWROOT'" + fi + fi + +@@ -113,17 +116,21 @@ if [ -z $iscsi_initiator ] && [ -f /sys/firmware/ibft/initiator/initiator-name ] + rm -f /etc/iscsi/initiatorname.iscsi + mkdir -p /etc/iscsi + ln -fs /run/initiatorname.iscsi /etc/iscsi/initiatorname.iscsi +- systemctl restart iscsid +- sleep 1 + > /tmp/iscsi_set_initiator ++ if systemctl --quiet is-active iscsid.service; then ++ systemctl restart iscsid ++ sleep 1 ++ fi + fi + +-if [ -n "$iscsi_firmware" ] ; then +- echo "[ -f '/tmp/iscsistarted-firmware' ]" > $hookdir/initqueue/finished/iscsi_started.sh +-else +- netroot_enc=$(str_replace "$netroot" '/' '\2f') ++ ++for nroot in $(getargs netroot); do ++ [ "${nroot%%:*}" = "iscsi" ] || continue ++ type parse_iscsi_root >/dev/null 2>&1 || . /lib/net-lib.sh ++ parse_iscsi_root "$nroot" || return 1 ++ netroot_enc=$(str_replace "$nroot" '/' '\2f') + echo "[ -f '/tmp/iscsistarted-$netroot_enc' ]" > $hookdir/initqueue/finished/iscsi_started.sh +-fi ++done + + # Done, all good! + rootok=1 diff --git a/0115-systemd-dracut-cmdline.sh-print-out-cmdline-in-one-l.patch b/0115-systemd-dracut-cmdline.sh-print-out-cmdline-in-one-l.patch new file mode 100644 index 0000000..6f468c3 --- /dev/null +++ b/0115-systemd-dracut-cmdline.sh-print-out-cmdline-in-one-l.patch @@ -0,0 +1,24 @@ +From db7d7398186f025adb746fd9f70fb36249ba6f86 Mon Sep 17 00:00:00 2001 +From: Harald Hoyer +Date: Tue, 18 Aug 2015 11:52:56 +0200 +Subject: [PATCH] systemd/dracut-cmdline.sh: print out cmdline in one line + +(cherry picked from commit 93a5a3d3ca6738e3f0282c4d3fc8be3f38f150d3) +--- + modules.d/98dracut-systemd/dracut-cmdline.sh | 3 +-- + 1 file changed, 1 insertion(+), 2 deletions(-) + +diff --git a/modules.d/98dracut-systemd/dracut-cmdline.sh b/modules.d/98dracut-systemd/dracut-cmdline.sh +index 871f81b..a1dcf84 100755 +--- a/modules.d/98dracut-systemd/dracut-cmdline.sh ++++ b/modules.d/98dracut-systemd/dracut-cmdline.sh +@@ -14,8 +14,7 @@ if ! getargbool 1 'rd.hostonly'; then + [ -f /tmp/99-cmdline-ask.conf ] && mv /tmp/99-cmdline-ask.conf /etc/cmdline.d/99-cmdline-ask.conf + fi + +-info "Using kernel command line parameters:" +-getcmdline | vinfo ++info "Using kernel command line parameters:" $(getcmdline) + + getargbool 0 rd.udev.log-priority=info -d rd.udev.info -d -n -y rdudevinfo && echo 'udev_log="info"' >> /etc/udev/udev.conf + getargbool 0 rd.udev.log-priority=debug -d rd.udev.debug -d -n -y rdudevdebug && echo 'udev_log="debug"' >> /etc/udev/udev.conf diff --git a/0116-network-ifup.sh-let-dhcp-client-run-in-the-backgroun.patch b/0116-network-ifup.sh-let-dhcp-client-run-in-the-backgroun.patch new file mode 100644 index 0000000..902394c --- /dev/null +++ b/0116-network-ifup.sh-let-dhcp-client-run-in-the-backgroun.patch @@ -0,0 +1,25 @@ +From 93b9885a65e693d264e9199b42cf9a08b167b332 Mon Sep 17 00:00:00 2001 +From: Harald Hoyer +Date: Tue, 18 Aug 2015 11:53:31 +0200 +Subject: [PATCH] network/ifup.sh: let dhcp client run in the background + +we need to renew the lease + +(cherry picked from commit fb2d643a385f1b02fbac6c2782b0026029c6bde7) +--- + modules.d/40network/ifup.sh | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/modules.d/40network/ifup.sh b/modules.d/40network/ifup.sh +index bb20afe..ceb5f5c 100755 +--- a/modules.d/40network/ifup.sh ++++ b/modules.d/40network/ifup.sh +@@ -109,7 +109,7 @@ do_dhcp() { + info "Starting dhcp for interface $netif" + dhclient "$@" \ + ${_timeout:+-timeout $_timeout} \ +- -1 -q \ ++ -q \ + -cf /etc/dhclient.conf \ + -pf /tmp/dhclient.$netif.pid \ + -lf /tmp/dhclient.$netif.lease \ diff --git a/0117-network-ifup.sh-arping-for-static-IPv4-addresses.patch b/0117-network-ifup.sh-arping-for-static-IPv4-addresses.patch new file mode 100644 index 0000000..0f32b6b --- /dev/null +++ b/0117-network-ifup.sh-arping-for-static-IPv4-addresses.patch @@ -0,0 +1,25 @@ +From 9ab5ddf16ab973ae63af8cad33b58e31b53ce170 Mon Sep 17 00:00:00 2001 +From: Harald Hoyer +Date: Tue, 18 Aug 2015 12:07:41 +0200 +Subject: [PATCH] network/ifup.sh: arping for static IPv4 addresses + +(cherry picked from commit 38180271c587f3053710bf38a6cda829d3a7c00f) +--- + modules.d/40network/ifup.sh | 4 ++++ + 1 file changed, 4 insertions(+) + +diff --git a/modules.d/40network/ifup.sh b/modules.d/40network/ifup.sh +index ceb5f5c..7da9171 100755 +--- a/modules.d/40network/ifup.sh ++++ b/modules.d/40network/ifup.sh +@@ -158,6 +158,10 @@ do_static() { + ip addr add $ip/$mask ${srv:+peer $srv} dev $netif + wait_for_ipv6_dad $netif + else ++ if ! arping -f -q -D -c 2 -I $netif $ip; then ++ warn "Duplicate address detected for $ip for interface $netif." ++ return 1 ++ fi + ip addr flush dev $netif + ip addr add $ip/$mask ${srv:+peer $srv} brd + dev $netif + fi diff --git a/0118-network-parse-ip-opts.sh-bind-enx-interface-to-the-M.patch b/0118-network-parse-ip-opts.sh-bind-enx-interface-to-the-M.patch new file mode 100644 index 0000000..f134ce1 --- /dev/null +++ b/0118-network-parse-ip-opts.sh-bind-enx-interface-to-the-M.patch @@ -0,0 +1,33 @@ +From 0c004c8e646a2d93d722e65203cc33239b6757be Mon Sep 17 00:00:00 2001 +From: Harald Hoyer +Date: Tue, 18 Aug 2015 12:13:55 +0200 +Subject: [PATCH] network/parse-ip-opts.sh: bind enx* interface to the MAC + +do it automatically for the persistent naming scheme + +(cherry picked from commit 2eb3b00133d572183ca022b626d200549ce4ffa8) +--- + modules.d/40network/parse-ip-opts.sh | 10 ++++++++++ + 1 file changed, 10 insertions(+) + +diff --git a/modules.d/40network/parse-ip-opts.sh b/modules.d/40network/parse-ip-opts.sh +index 33bb068..12f4765 100755 +--- a/modules.d/40network/parse-ip-opts.sh ++++ b/modules.d/40network/parse-ip-opts.sh +@@ -111,6 +111,16 @@ for p in $(getargs ip=); do + die "Server-ip or dhcp for netboot needed, but current arguments say otherwise" + fi + ++ if str_starts "$dev" "enx" && [ ${#dev} -eq 15 ]; then ++ printf -- "ifname=%s:%s:%s:%s:%s:%s:%s\n" \ ++ "$dev" \ ++ "${dev:3:2}" \ ++ "${dev:5:2}" \ ++ "${dev:7:2}" \ ++ "${dev:9:2}" \ ++ "${dev:11:2}" \ ++ "${dev:13:2}" >> /etc/cmdline.d/80-enx.conf ++ fi + done + + # put BOOTIF in IFACES to make sure it comes up diff --git a/0119-udev-rules-install-40-redhat.rules.patch b/0119-udev-rules-install-40-redhat.rules.patch new file mode 100644 index 0000000..263cc12 --- /dev/null +++ b/0119-udev-rules-install-40-redhat.rules.patch @@ -0,0 +1,32 @@ +From dd8d161afe4a22455dd0139055215ca78fa9220d Mon Sep 17 00:00:00 2001 +From: Harald Hoyer +Date: Tue, 18 Aug 2015 12:25:53 +0200 +Subject: [PATCH] udev-rules: install 40-redhat.rules + +(cherry picked from commit 0c0abf97ccc2306a7089d53a0a1f92e80b2e733c) +--- + modules.d/95udev-rules/module-setup.sh | 4 +++- + 1 file changed, 3 insertions(+), 1 deletion(-) + +diff --git a/modules.d/95udev-rules/module-setup.sh b/modules.d/95udev-rules/module-setup.sh +index 141d29d..f4f9cf8 100755 +--- a/modules.d/95udev-rules/module-setup.sh ++++ b/modules.d/95udev-rules/module-setup.sh +@@ -27,6 +27,7 @@ install() { + fi + + inst_rules \ ++ 40-redhat.rules \ + 50-firmware.rules \ + 50-udev.rules \ + 50-udev-default.rules \ +@@ -46,7 +47,8 @@ install() { + 80-net-setup-link.rules \ + 95-late.rules \ + "$moddir/59-persistent-storage.rules" \ +- "$moddir/61-persistent-storage.rules" ++ "$moddir/61-persistent-storage.rules" \ ++ ${NULL} + + prepare_udev_rules 59-persistent-storage.rules 61-persistent-storage.rules + # debian udev rules diff --git a/0120-fcoe-cleanup-lldpad.patch b/0120-fcoe-cleanup-lldpad.patch new file mode 100644 index 0000000..9bc2d4b --- /dev/null +++ b/0120-fcoe-cleanup-lldpad.patch @@ -0,0 +1,41 @@ +From 4a88aaff1006b9c9126ecfe26e0a0eb286eea211 Mon Sep 17 00:00:00 2001 +From: Harald Hoyer +Date: Tue, 18 Aug 2015 12:27:32 +0200 +Subject: [PATCH] fcoe: cleanup lldpad + +Resolves: rhbz#1246217 +(cherry picked from commit 69c437dd1c3b877f60ced307068e01619124fef4) +--- + modules.d/95fcoe/cleanup-fcoe.sh | 10 ++++++++++ + modules.d/95fcoe/module-setup.sh | 1 + + 2 files changed, 11 insertions(+) + create mode 100644 modules.d/95fcoe/cleanup-fcoe.sh + +diff --git a/modules.d/95fcoe/cleanup-fcoe.sh b/modules.d/95fcoe/cleanup-fcoe.sh +new file mode 100644 +index 0000000..5ff4d05 +--- /dev/null ++++ b/modules.d/95fcoe/cleanup-fcoe.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 ++ ++if [ -e /var/run/lldpad.pid ]; then ++ lldpad -k ++ mkdir -m 0755 -p /run/initramfs/state/dev/shm ++ cp /dev/shm/lldpad.state /run/initramfs/state/dev/shm/ > /dev/null 2>&1 ++ echo "files /dev/shm/lldpad.state" >> /run/initramfs/rwtab ++fi +diff --git a/modules.d/95fcoe/module-setup.sh b/modules.d/95fcoe/module-setup.sh +index ae606aa..059bfde 100755 +--- a/modules.d/95fcoe/module-setup.sh ++++ b/modules.d/95fcoe/module-setup.sh +@@ -82,6 +82,7 @@ install() { + inst "$moddir/fcoe-genrules.sh" "/sbin/fcoe-genrules.sh" + inst_hook pre-trigger 03 "$moddir/lldpad.sh" + inst_hook cmdline 99 "$moddir/parse-fcoe.sh" ++ inst_hook cleanup 90 "$moddir/cleanup-fcoe.sh" + dracut_need_initqueue + } + diff --git a/0121-network-net-lib.sh-ibft-unset-gateway-or-dns-if-set-.patch b/0121-network-net-lib.sh-ibft-unset-gateway-or-dns-if-set-.patch new file mode 100644 index 0000000..817277e --- /dev/null +++ b/0121-network-net-lib.sh-ibft-unset-gateway-or-dns-if-set-.patch @@ -0,0 +1,28 @@ +From c04a321b92ba9c7a5e63fc07e58607025c588bed Mon Sep 17 00:00:00 2001 +From: Harald Hoyer +Date: Tue, 18 Aug 2015 12:40:01 +0200 +Subject: [PATCH] network/net-lib.sh:ibft unset gateway or dns, if set to + 0.0.0.0 + +(cherry picked from commit 942d60d8afad4eb8b131a33fe9618e3e8392d33f) +--- + modules.d/40network/net-lib.sh | 3 +++ + 1 file changed, 3 insertions(+) + +diff --git a/modules.d/40network/net-lib.sh b/modules.d/40network/net-lib.sh +index 2f25de7..b61a1e8 100755 +--- a/modules.d/40network/net-lib.sh ++++ b/modules.d/40network/net-lib.sh +@@ -242,9 +242,12 @@ ibft_to_cmdline() { + # skip not assigned ip adresses + [ "$ip" = "0.0.0.0" ] && continue + [ -e ${iface}/gateway ] && gw=$(read a < ${iface}/gateway; echo $a) ++ [ "$gateway" = "0.0.0.0" ] && unset $gateway + [ -e ${iface}/subnet-mask ] && mask=$(read a < ${iface}/subnet-mask; echo $a) + [ -e ${iface}/primary-dns ] && dns1=$(read a < ${iface}/primary-dns; echo $a) ++ [ "$dns1" = "0.0.0.0" ] && unset $dns1 + [ -e ${iface}/secondary-dns ] && dns2=$(read a < ${iface}/secondary-dns; echo $a) ++ [ "$dns2" = "0.0.0.0" ] && unset $dns2 + [ -e ${iface}/hostname ] && hostname=$(read a < ${iface}/hostname; echo $a) + if [ -n "$ip" ] && [ -n "$mask" ]; then + echo "ip=$ip::$gw:$mask:$hostname:$dev:none${dns1:+:$dns1}${dns2:+:$dns2}" diff --git a/0122-network-dhclient-exit-arping-immediatly-if-we-get-an.patch b/0122-network-dhclient-exit-arping-immediatly-if-we-get-an.patch new file mode 100644 index 0000000..6bfd12b --- /dev/null +++ b/0122-network-dhclient-exit-arping-immediatly-if-we-get-an.patch @@ -0,0 +1,23 @@ +From 4483fff87c0a5074f3498bfd59387179c20c7ea3 Mon Sep 17 00:00:00 2001 +From: Harald Hoyer +Date: Tue, 18 Aug 2015 12:41:12 +0200 +Subject: [PATCH] network/dhclient: exit arping immediatly, if we get an answer + +(cherry picked from commit d6bfa7052a620ebdd37f78655462120871c49ebd) +--- + modules.d/40network/dhclient-script.sh | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/modules.d/40network/dhclient-script.sh b/modules.d/40network/dhclient-script.sh +index 1d891cd..4e2090d 100755 +--- a/modules.d/40network/dhclient-script.sh ++++ b/modules.d/40network/dhclient-script.sh +@@ -117,7 +117,7 @@ case $reason in + read layer2 < /sys/class/net/$netif/device/layer2 + fi + if [ "$layer2" != "0" ]; then +- if ! arping -q -D -c 2 -I $netif $new_ip_address ; then ++ if ! arping -f -q -D -c 2 -I $netif $new_ip_address ; then + warn "Duplicate address detected for $new_ip_address while doing dhcp. retrying" + exit 1 + fi diff --git a/0123-dmraid-only-scan-once-because-of-one-device.patch b/0123-dmraid-only-scan-once-because-of-one-device.patch new file mode 100644 index 0000000..e8d3000 --- /dev/null +++ b/0123-dmraid-only-scan-once-because-of-one-device.patch @@ -0,0 +1,41 @@ +From a283636b83da0ea967bb0281a8f730750f6a2702 Mon Sep 17 00:00:00 2001 +From: Harald Hoyer +Date: Tue, 18 Aug 2015 15:04:31 +0200 +Subject: [PATCH] dmraid: only scan once because of one device + +(cherry picked from commit 80153acc0f8bbb3829575201e2a0ba3da41268a8) +--- + modules.d/90dmraid/61-dmraid-imsm.rules | 2 +- + modules.d/90dmraid/dmraid.sh | 7 +++++++ + 2 files changed, 8 insertions(+), 1 deletion(-) + +diff --git a/modules.d/90dmraid/61-dmraid-imsm.rules b/modules.d/90dmraid/61-dmraid-imsm.rules +index 33e060b..de7e97e 100644 +--- a/modules.d/90dmraid/61-dmraid-imsm.rules ++++ b/modules.d/90dmraid/61-dmraid-imsm.rules +@@ -24,6 +24,6 @@ PROGRAM=="/bin/sh -c 'for i in $sys/$devpath/holders/dm-[0-9]*; do [ -e $$i ] && + ENV{DEVTYPE}!="partition", \ + RUN+="/sbin/partx -d --nr 1-1024 $env{DEVNAME}" + +-RUN+="/sbin/initqueue --onetime --unique --settled /sbin/dmraid_scan" ++RUN+="/sbin/initqueue --onetime --unique --settled /sbin/dmraid_scan $env{DEVNAME}" + + LABEL="dm_end" +diff --git a/modules.d/90dmraid/dmraid.sh b/modules.d/90dmraid/dmraid.sh +index 3dcff38..e7a09b0 100755 +--- a/modules.d/90dmraid/dmraid.sh ++++ b/modules.d/90dmraid/dmraid.sh +@@ -2,6 +2,13 @@ + + type getarg >/dev/null 2>&1 || . /lib/dracut-lib.sh + ++dev="$1" ++devenc=$(str_replace "$1" '/' '\2f') ++ ++[ -e /tmp/dmraid.$devenc ] && exit 0 ++ ++>/tmp/dmraid.$devenc ++ + DM_RAIDS=$(getargs rd.dm.uuid -d rd_DM_UUID=) + + if [ -n "$DM_RAIDS" ] || getargbool 0 rd.auto; then diff --git a/0124-test-TEST-04-FULL-SYSTEMD-create-root.sh-modprobe-bt.patch b/0124-test-TEST-04-FULL-SYSTEMD-create-root.sh-modprobe-bt.patch new file mode 100644 index 0000000..e373d40 --- /dev/null +++ b/0124-test-TEST-04-FULL-SYSTEMD-create-root.sh-modprobe-bt.patch @@ -0,0 +1,24 @@ +From f939cffdac08fb40eac0e633a8d58965b9ee275a Mon Sep 17 00:00:00 2001 +From: Harald Hoyer +Date: Tue, 18 Aug 2015 15:05:11 +0200 +Subject: [PATCH] test/TEST-04-FULL-SYSTEMD/create-root.sh: modprobe btrfs + +why so ever... it used to load automatically + +(cherry picked from commit 65977ef1d107c8741d9f2633b8618aa3aee2a49d) +--- + test/TEST-04-FULL-SYSTEMD/create-root.sh | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/test/TEST-04-FULL-SYSTEMD/create-root.sh b/test/TEST-04-FULL-SYSTEMD/create-root.sh +index 5972bd3..0a66257 100755 +--- a/test/TEST-04-FULL-SYSTEMD/create-root.sh ++++ b/test/TEST-04-FULL-SYSTEMD/create-root.sh +@@ -4,6 +4,7 @@ for x in 64-lvm.rules 70-mdadm.rules 99-mount-rules; do + > "/etc/udev/rules.d/$x" + done + rm -f -- /etc/lvm/lvm.conf ++modprobe btrfs + udevadm control --reload + set -e + # save a partition at the beginning for future flagging purposes diff --git a/0125-TEST-15-BTRFS-load-btrfs-module.patch b/0125-TEST-15-BTRFS-load-btrfs-module.patch new file mode 100644 index 0000000..d70f5fd --- /dev/null +++ b/0125-TEST-15-BTRFS-load-btrfs-module.patch @@ -0,0 +1,22 @@ +From c606be49d7f78c688f3b4696bc2b05adaf408ec9 Mon Sep 17 00:00:00 2001 +From: Harald Hoyer +Date: Tue, 18 Aug 2015 15:26:23 +0200 +Subject: [PATCH] TEST-15-BTRFS: load btrfs module + +(cherry picked from commit d9b5a98532b6823adb35f7c68766f4df9db8a3c9) +--- + test/TEST-15-BTRFSRAID/create-root.sh | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/test/TEST-15-BTRFSRAID/create-root.sh b/test/TEST-15-BTRFSRAID/create-root.sh +index f4062f5..e95e57d 100755 +--- a/test/TEST-15-BTRFSRAID/create-root.sh ++++ b/test/TEST-15-BTRFSRAID/create-root.sh +@@ -3,6 +3,7 @@ + for x in 64-lvm.rules 70-mdadm.rules 99-mount-rules; do + > "/etc/udev/rules.d/$x" + done ++modprobe btrfs + udevadm control --reload + # save a partition at the beginning for future flagging purposes + sfdisk -X gpt /dev/sda < +Date: Wed, 19 Aug 2015 13:59:40 +0200 +Subject: [PATCH] network/ifup.sh:do_static(): error out, if interface could + not be brought up + +(cherry picked from commit 77f46adf5e5ab1f6da2e459bb55435d4b70842c5) +--- + modules.d/40network/ifup.sh | 6 +++++- + 1 file changed, 5 insertions(+), 1 deletion(-) + +diff --git a/modules.d/40network/ifup.sh b/modules.d/40network/ifup.sh +index 7da9171..69a4567 100755 +--- a/modules.d/40network/ifup.sh ++++ b/modules.d/40network/ifup.sh +@@ -150,7 +150,11 @@ do_ipv6auto() { + do_static() { + strglobin $ip '*:*:*' && load_ipv6 + +- linkup $netif ++ if ! linkup $netif; then ++ warn "Could bring interface $netif up!" ++ return 1 ++ fi ++ + [ -n "$macaddr" ] && ip link set address $macaddr dev $netif + [ -n "$mtu" ] && ip link set mtu $mtu dev $netif + if strglobin $ip '*:*:*'; then diff --git a/0127-network-ifup.sh-do_static-error-out-if-IP-is-already.patch b/0127-network-ifup.sh-do_static-error-out-if-IP-is-already.patch new file mode 100644 index 0000000..1eae822 --- /dev/null +++ b/0127-network-ifup.sh-do_static-error-out-if-IP-is-already.patch @@ -0,0 +1,31 @@ +From 27a5aecf56fbfa9a8d92d86d7e68c2781c0b4523 Mon Sep 17 00:00:00 2001 +From: Harald Hoyer +Date: Wed, 19 Aug 2015 14:00:28 +0200 +Subject: [PATCH] network/ifup.sh:do_static(): error out, if IP is already + assigned + +(cherry picked from commit 32770ca79a1f6828ca9fdf4b6841e6a6d4e4754a) +--- + modules.d/40network/ifup.sh | 9 +++++++++ + 1 file changed, 9 insertions(+) + +diff --git a/modules.d/40network/ifup.sh b/modules.d/40network/ifup.sh +index 69a4567..381ff43 100755 +--- a/modules.d/40network/ifup.sh ++++ b/modules.d/40network/ifup.sh +@@ -155,6 +155,15 @@ do_static() { + return 1 + fi + ++ ip route get "$ip" | { ++ read a rest ++ if [ "$a" = "local" ]; then ++ warn "Not assigning $ip to interface $netif, cause it is already assigned!" ++ return 1 ++ fi ++ return 0 ++ } || return 1 ++ + [ -n "$macaddr" ] && ip link set address $macaddr dev $netif + [ -n "$mtu" ] && ip link set mtu $mtu dev $netif + if strglobin $ip '*:*:*'; then diff --git a/0128-iscsi-parse-iscsiroot.sh-handle-firmware-in-online-q.patch b/0128-iscsi-parse-iscsiroot.sh-handle-firmware-in-online-q.patch new file mode 100644 index 0000000..1ec2070 --- /dev/null +++ b/0128-iscsi-parse-iscsiroot.sh-handle-firmware-in-online-q.patch @@ -0,0 +1,29 @@ +From 782e909eef9c6e2ec5ebc8c2b0bb54761a0d92ad Mon Sep 17 00:00:00 2001 +From: Harald Hoyer +Date: Tue, 25 Aug 2015 11:16:29 +0200 +Subject: [PATCH] iscsi/parse-iscsiroot.sh: handle firmware in online queue + +(cherry picked from commit 7f59cbd31817c81fa5aec9f86c33dfe1ce23ec6a) +--- + modules.d/95iscsi/parse-iscsiroot.sh | 6 +++--- + 1 file changed, 3 insertions(+), 3 deletions(-) + +diff --git a/modules.d/95iscsi/parse-iscsiroot.sh b/modules.d/95iscsi/parse-iscsiroot.sh +index 35628cc..aa17f8e 100755 +--- a/modules.d/95iscsi/parse-iscsiroot.sh ++++ b/modules.d/95iscsi/parse-iscsiroot.sh +@@ -77,11 +77,11 @@ if [ -n "$iscsi_firmware" ] || getargbool 0 rd.iscsi.ibft -d "ip=ibft"; then + modprobe -b -q iscsi_ibft + # if no ip= is given, but firmware + echo "[ -f '/tmp/iscsistarted-firmware' ]" > $hookdir/initqueue/finished/iscsi_started.sh +- initqueue --unique --onetime --timeout /sbin/iscsiroot timeout "$netroot" "$NEWROOT" +- initqueue --unique --onetime --settled /sbin/iscsiroot dummy "'$netroot'" "'$NEWROOT'" ++ initqueue --unique --online /sbin/iscsiroot online "iscsi:" "$NEWROOT" ++ initqueue --unique --onetime --timeout /sbin/iscsiroot timeout "iscsi:" "$NEWROOT" ++ initqueue --unique --onetime --settled /sbin/iscsiroot online "iscsi:" "'$NEWROOT'" + fi + +- + [ -z "$netroot" ] || [ "${netroot%%:*}" = "iscsi" ] || return 1 + + initqueue --unique --onetime --timeout /sbin/iscsiroot timeout "$netroot" "$NEWROOT" diff --git a/0129-iscsi-parse-iscsiroot.sh-restart-iscsid-with-try-res.patch b/0129-iscsi-parse-iscsiroot.sh-restart-iscsid-with-try-res.patch new file mode 100644 index 0000000..cde4d7f --- /dev/null +++ b/0129-iscsi-parse-iscsiroot.sh-restart-iscsid-with-try-res.patch @@ -0,0 +1,35 @@ +From 3632be079bd7aa1cd456dc8aff2cc42d6a449a67 Mon Sep 17 00:00:00 2001 +From: Harald Hoyer +Date: Tue, 25 Aug 2015 11:16:46 +0200 +Subject: [PATCH] iscsi/parse-iscsiroot.sh: restart iscsid with try-restart + +(cherry picked from commit a6befb52eb5eeb87c0c41303fe08e50bd2fde0d3) +--- + modules.d/95iscsi/parse-iscsiroot.sh | 7 ++----- + 1 file changed, 2 insertions(+), 5 deletions(-) + +diff --git a/modules.d/95iscsi/parse-iscsiroot.sh b/modules.d/95iscsi/parse-iscsiroot.sh +index aa17f8e..dab58db 100755 +--- a/modules.d/95iscsi/parse-iscsiroot.sh ++++ b/modules.d/95iscsi/parse-iscsiroot.sh +@@ -99,7 +99,7 @@ if [ -n "$netroot" ] && [ "$root" != "/dev/root" ] && [ "$root" != "dhcp" ]; the + fi + fi + +-if arg=$(getarg rd.iscsi.initiator -d iscsi_initiator=) && [ -n "$arg" ]; then ++if arg=$(getarg rd.iscsi.initiator -d iscsi_initiator=) && [ -n "$arg" ] && ! [ -f /run/initiatorname.iscsi ] ; then + iscsi_initiator=$arg + echo "InitiatorName=$iscsi_initiator" > /run/initiatorname.iscsi + ln -fs /run/initiatorname.iscsi /dev/.initiatorname.iscsi +@@ -117,10 +117,7 @@ if [ -z $iscsi_initiator ] && [ -f /sys/firmware/ibft/initiator/initiator-name ] + mkdir -p /etc/iscsi + ln -fs /run/initiatorname.iscsi /etc/iscsi/initiatorname.iscsi + > /tmp/iscsi_set_initiator +- if systemctl --quiet is-active iscsid.service; then +- systemctl restart iscsid +- sleep 1 +- fi ++ systemctl try-restart iscsid && sleep 1 + fi + + diff --git a/0130-network-ifup.sh-save-return-value-of-ifup.patch b/0130-network-ifup.sh-save-return-value-of-ifup.patch new file mode 100644 index 0000000..495a4e7 --- /dev/null +++ b/0130-network-ifup.sh-save-return-value-of-ifup.patch @@ -0,0 +1,31 @@ +From 744c65939be7aa791d5538c6733e05d390c8cd3a Mon Sep 17 00:00:00 2001 +From: Harald Hoyer +Date: Tue, 25 Aug 2015 11:20:30 +0200 +Subject: [PATCH] network/ifup.sh: save return value of ifup + +(cherry picked from commit b4006781e8a59dc69a0dd3836fce137f08b23001) +--- + modules.d/40network/ifup.sh | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +diff --git a/modules.d/40network/ifup.sh b/modules.d/40network/ifup.sh +index 381ff43..647c856 100755 +--- a/modules.d/40network/ifup.sh ++++ b/modules.d/40network/ifup.sh +@@ -373,6 +373,7 @@ for p in $(getargs ip=); do + do_static ;; + esac + done ++ ret=$? + + > /tmp/net.${netif}.up + +@@ -380,7 +381,7 @@ for p in $(getargs ip=); do + dhcp|on|any|dhcp6) + ;; + *) +- if [ $? -eq 0 ]; then ++ if [ $ret -eq 0 ]; then + setup_net $netif + source_hook initqueue/online $netif + if [ -z "$manualup" ]; then diff --git a/0131-network-also-mark-interfaces-up-with-their-MAC.patch b/0131-network-also-mark-interfaces-up-with-their-MAC.patch new file mode 100644 index 0000000..8639d1a --- /dev/null +++ b/0131-network-also-mark-interfaces-up-with-their-MAC.patch @@ -0,0 +1,51 @@ +From 26fbe97bbe3079d7dc63b19fb3a0728570da7628 Mon Sep 17 00:00:00 2001 +From: Harald Hoyer +Date: Tue, 25 Aug 2015 11:30:00 +0200 +Subject: [PATCH] network: also mark interfaces up with their MAC + +(cherry picked from commit 53537f4d23091457f644ab8b3edf09c2dca4351c) +--- + modules.d/40network/dhclient-script.sh | 7 +++++++ + modules.d/40network/ifup.sh | 4 ++++ + 2 files changed, 11 insertions(+) + +diff --git a/modules.d/40network/dhclient-script.sh b/modules.d/40network/dhclient-script.sh +index 4e2090d..f55611d 100755 +--- a/modules.d/40network/dhclient-script.sh ++++ b/modules.d/40network/dhclient-script.sh +@@ -139,6 +139,10 @@ case $reason in + + echo "[ -f /tmp/net.$netif.did-setup ]" > $hookdir/initqueue/finished/dhclient-$netif.sh + >/tmp/net.$netif.up ++ if [ -e /sys/class/net/${netif}/address ]; then ++ > /tmp/net.$(cat /sys/class/net/${netif}/address).up ++ fi ++ + ;; + + RENEW|REBIND) +@@ -171,6 +175,9 @@ case $reason in + + echo "[ -f /tmp/net.$netif.did-setup ]" > $hookdir/initqueue/finished/dhclient-$netif.sh + >/tmp/net.$netif.up ++ if [ -e /sys/class/net/${netif}/address ]; then ++ > /tmp/net.$(cat /sys/class/net/${netif}/address).up ++ fi + ;; + + RENEW6|REBIND6) +diff --git a/modules.d/40network/ifup.sh b/modules.d/40network/ifup.sh +index 647c856..dd47e4b 100755 +--- a/modules.d/40network/ifup.sh ++++ b/modules.d/40network/ifup.sh +@@ -377,6 +377,10 @@ for p in $(getargs ip=); do + + > /tmp/net.${netif}.up + ++ if [ -e /sys/class/net/${netif}/address ]; then ++ > /tmp/net.$(cat /sys/class/net/${netif}/address).up ++ fi ++ + case $autoconf in + dhcp|on|any|dhcp6) + ;; diff --git a/0132-network-ifup.sh-only-use-dhcp-on-unknown-interfaces-.patch b/0132-network-ifup.sh-only-use-dhcp-on-unknown-interfaces-.patch new file mode 100644 index 0000000..98c2caa --- /dev/null +++ b/0132-network-ifup.sh-only-use-dhcp-on-unknown-interfaces-.patch @@ -0,0 +1,24 @@ +From 686f9675dfb30f492723b8629e05f284054f2acb Mon Sep 17 00:00:00 2001 +From: Harald Hoyer +Date: Tue, 25 Aug 2015 11:37:16 +0200 +Subject: [PATCH] network/ifup.sh: only use dhcp on unknown interfaces for + ip=dhcp + +(cherry picked from commit 7c24815034241e490422691b5f18671c4b9812a9) +--- + modules.d/40network/ifup.sh | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/modules.d/40network/ifup.sh b/modules.d/40network/ifup.sh +index dd47e4b..b83d7e7 100755 +--- a/modules.d/40network/ifup.sh ++++ b/modules.d/40network/ifup.sh +@@ -410,7 +410,7 @@ if [ ! -e /tmp/net.${netif}.up ]; then + if getargs 'ip=dhcp6'; then + load_ipv6 + do_dhcp -6 +- else ++ elif getargs 'ip=dhcp'; then + do_dhcp -4 + fi + fi diff --git a/0133-cms-cmsifup.sh-do-not-use-ifup-m.patch b/0133-cms-cmsifup.sh-do-not-use-ifup-m.patch new file mode 100644 index 0000000..d990fb5 --- /dev/null +++ b/0133-cms-cmsifup.sh-do-not-use-ifup-m.patch @@ -0,0 +1,22 @@ +From 195b5d0725b7caf016def2ecedb915c1422e043a Mon Sep 17 00:00:00 2001 +From: Harald Hoyer +Date: Tue, 1 Sep 2015 17:21:53 +0200 +Subject: [PATCH] cms/cmsifup.sh: do not use ifup -m + +we don't want to bring the interface up several times + +(cherry picked from commit 0852c38b7a2b893e4f9e5894ba09eebc649f047f) +--- + modules.d/80cms/cmsifup.sh | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/modules.d/80cms/cmsifup.sh b/modules.d/80cms/cmsifup.sh +index b1b9616..902df8d 100755 +--- a/modules.d/80cms/cmsifup.sh ++++ b/modules.d/80cms/cmsifup.sh +@@ -35,4 +35,4 @@ fi + IFACES="$IFACES $DEVICE" + echo "$IFACES" >> /tmp/net.ifaces + +-ifup $DEVICE -m ++exec ifup "$DEVICE" diff --git a/0134-network-ifup-fix-warning-about-not-bringing-interfac.patch b/0134-network-ifup-fix-warning-about-not-bringing-interfac.patch new file mode 100644 index 0000000..dd34622 --- /dev/null +++ b/0134-network-ifup-fix-warning-about-not-bringing-interfac.patch @@ -0,0 +1,23 @@ +From b519ae7008aa20828b30f021b25c38cfd459f27c Mon Sep 17 00:00:00 2001 +From: Harald Hoyer +Date: Tue, 1 Sep 2015 17:22:37 +0200 +Subject: [PATCH] network/ifup: fix warning about not bringing interface up + +(cherry picked from commit 70f3c07846e92d11484a1f7b5cb84aacc47489b4) +--- + modules.d/40network/ifup.sh | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/modules.d/40network/ifup.sh b/modules.d/40network/ifup.sh +index b83d7e7..9246da7 100755 +--- a/modules.d/40network/ifup.sh ++++ b/modules.d/40network/ifup.sh +@@ -151,7 +151,7 @@ do_static() { + strglobin $ip '*:*:*' && load_ipv6 + + if ! linkup $netif; then +- warn "Could bring interface $netif up!" ++ warn "Could not bring interface $netif up!" + return 1 + fi + diff --git a/0135-network-net-lib.sh-fix-wait_for_if_up.patch b/0135-network-net-lib.sh-fix-wait_for_if_up.patch new file mode 100644 index 0000000..a0c9002 --- /dev/null +++ b/0135-network-net-lib.sh-fix-wait_for_if_up.patch @@ -0,0 +1,41 @@ +From 42b4fc90f2248444da3a769a3706503503df8e80 Mon Sep 17 00:00:00 2001 +From: Harald Hoyer +Date: Tue, 1 Sep 2015 17:22:56 +0200 +Subject: [PATCH] network/net-lib.sh: fix wait_for_if_up() + +wait for <*UP*> and not "state UP" + +state can be UNKNOWN + +(cherry picked from commit d8572e0bf4d49a8d2ec71726d0fd38d1c73ca3f7) +--- + modules.d/40network/net-lib.sh | 16 +++++++++++++++- + 1 file changed, 15 insertions(+), 1 deletion(-) + +diff --git a/modules.d/40network/net-lib.sh b/modules.d/40network/net-lib.sh +index b61a1e8..43528e2 100755 +--- a/modules.d/40network/net-lib.sh ++++ b/modules.d/40network/net-lib.sh +@@ -529,7 +529,21 @@ wait_for_if_up() { + + while [ $cnt -lt $timeout ]; do + li=$(ip -o link show up dev $1) +- [ -n "$li" ] && [ -z "${li##*state UP*}" ] && return 0 ++ if [ -n "$li" ]; then ++ case "$li" in ++ *\*) ++ return 0;; ++ *\<*,UP,*\>*) ++ return 0;; ++ esac ++ fi ++ if strstr "$li" "LOWER_UP" \ ++ && strstr "$li" "state UNKNOWN" \ ++ && ! strstr "$li" "DORMANT"; then ++ return 0 ++ fi + sleep 0.1 + cnt=$(($cnt+1)) + done diff --git a/0136-network-net-lib.sh-fix-IPv6-route-parsing.patch b/0136-network-net-lib.sh-fix-IPv6-route-parsing.patch new file mode 100644 index 0000000..e41c660 --- /dev/null +++ b/0136-network-net-lib.sh-fix-IPv6-route-parsing.patch @@ -0,0 +1,23 @@ +From 29b885b46e5d2a368af70031e5d52ca21b9cdd31 Mon Sep 17 00:00:00 2001 +From: Harald Hoyer +Date: Tue, 1 Sep 2015 17:25:34 +0200 +Subject: [PATCH] network/net-lib.sh: fix IPv6 route parsing + +(cherry picked from commit a4c47ce0ddc7f7b46c2395709cf83f731f90685b) +--- + modules.d/40network/net-lib.sh | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/modules.d/40network/net-lib.sh b/modules.d/40network/net-lib.sh +index 43528e2..8096481 100755 +--- a/modules.d/40network/net-lib.sh ++++ b/modules.d/40network/net-lib.sh +@@ -120,7 +120,7 @@ setup_net() { + route_to_var "$_p" || continue + [ -n "$route_dev" ] && [ "$route_dev" != "$netif" ] && continue + ip route add "$route_mask" ${route_gw:+via "$route_gw"} ${route_dev:+dev "$route_dev"} +- if strstr ":" "$route_mask"; then ++ if strstr "$route_mask" ":"; then + printf -- "%s\n" "$route_mask ${route_gw:+via $route_gw} ${route_dev:+dev $route_dev}" \ + > /tmp/net.route6."$netif" + else diff --git a/0137-network-ifup-do-DHCP-for-BOOTDEV.patch b/0137-network-ifup-do-DHCP-for-BOOTDEV.patch new file mode 100644 index 0000000..6511e3f --- /dev/null +++ b/0137-network-ifup-do-DHCP-for-BOOTDEV.patch @@ -0,0 +1,40 @@ +From 6cfdb5aa1f7aba5715f6d670e3b8b4c93d0d64a0 Mon Sep 17 00:00:00 2001 +From: Harald Hoyer +Date: Tue, 1 Sep 2015 19:05:37 +0200 +Subject: [PATCH] network/ifup: do DHCP for BOOTDEV + +(cherry picked from commit 7316d68353cfd6e08f007d10ea3e32fa4d083487) +--- + modules.d/40network/ifup.sh | 19 ++++++++++++++----- + 1 file changed, 14 insertions(+), 5 deletions(-) + +diff --git a/modules.d/40network/ifup.sh b/modules.d/40network/ifup.sh +index 9246da7..366744f 100755 +--- a/modules.d/40network/ifup.sh ++++ b/modules.d/40network/ifup.sh +@@ -407,11 +407,20 @@ fi + + # no ip option directed at our interface? + if [ ! -e /tmp/net.${netif}.up ]; then +- if getargs 'ip=dhcp6'; then +- load_ipv6 +- do_dhcp -6 +- elif getargs 'ip=dhcp'; then +- do_dhcp -4 ++ if [ -e /tmp/net.bootdev ]; then ++ BOOTDEV=$(cat /tmp/net.bootdev) ++ if [ "$netif" = "$BOOTDEV" ] || [ "$BOOTDEV" = "$(cat /sys/class/net/${netif}/address)" ]; then ++ load_ipv6 ++ do_dhcp ++ fi ++ else ++ if getargs 'ip=dhcp6'; then ++ load_ipv6 ++ do_dhcp -6 ++ fi ++ if getargs 'ip=dhcp'; then ++ do_dhcp -4 ++ fi + fi + fi + diff --git a/0138-livenet-livenetroot.sh-fixed-error-condition.patch b/0138-livenet-livenetroot.sh-fixed-error-condition.patch new file mode 100644 index 0000000..52e5611 --- /dev/null +++ b/0138-livenet-livenetroot.sh-fixed-error-condition.patch @@ -0,0 +1,25 @@ +From 7d47178e0ddccbecfbf144348da24c1a3be32da2 Mon Sep 17 00:00:00 2001 +From: Harald Hoyer +Date: Wed, 2 Sep 2015 09:47:35 +0200 +Subject: [PATCH] livenet/livenetroot.sh: fixed error condition + +copy&paste error + +(cherry picked from commit b813b1b3064d4951c5403bb0f96480de9a355d8e) +--- + modules.d/90livenet/livenetroot.sh | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/modules.d/90livenet/livenetroot.sh b/modules.d/90livenet/livenetroot.sh +index 2e36ee9..b7592bc 100755 +--- a/modules.d/90livenet/livenetroot.sh ++++ b/modules.d/90livenet/livenetroot.sh +@@ -15,7 +15,7 @@ liveurl="${netroot#livenet:}" + info "fetching $liveurl" + imgfile=$(fetch_url "$liveurl") + +-if [ $? = 0 ]; then ++if [ $? != 0 ]; then + warn "failed to download live image: error $?" + exit 1 + fi diff --git a/0139-iscsi-parse-iscsiroot.sh-only-set-initiator-name-if-.patch b/0139-iscsi-parse-iscsiroot.sh-only-set-initiator-name-if-.patch new file mode 100644 index 0000000..1764646 --- /dev/null +++ b/0139-iscsi-parse-iscsiroot.sh-only-set-initiator-name-if-.patch @@ -0,0 +1,36 @@ +From e803d076f8689a92ae42de4f5675c51e8a9c492d Mon Sep 17 00:00:00 2001 +From: Harald Hoyer +Date: Thu, 3 Sep 2015 12:41:06 +0200 +Subject: [PATCH] iscsi/parse-iscsiroot.sh: only set initiator-name, if not + empty + +(cherry picked from commit eb87dc91d078ee942ef9c8bbc8e82f4ee4ccf0c6) +--- + modules.d/95iscsi/parse-iscsiroot.sh | 14 ++++++++------ + 1 file changed, 8 insertions(+), 6 deletions(-) + +diff --git a/modules.d/95iscsi/parse-iscsiroot.sh b/modules.d/95iscsi/parse-iscsiroot.sh +index dab58db..81be6a9 100755 +--- a/modules.d/95iscsi/parse-iscsiroot.sh ++++ b/modules.d/95iscsi/parse-iscsiroot.sh +@@ -112,12 +112,14 @@ fi + # If not given on the cmdline and initiator-name available via iBFT + if [ -z $iscsi_initiator ] && [ -f /sys/firmware/ibft/initiator/initiator-name ] && ! [ -f /tmp/iscsi_set_initiator ]; then + iscsi_initiator=$(while read line || [ -n "$line" ]; do echo $line;done < /sys/firmware/ibft/initiator/initiator-name) +- echo "InitiatorName=$iscsi_initiator" > /run/initiatorname.iscsi +- rm -f /etc/iscsi/initiatorname.iscsi +- mkdir -p /etc/iscsi +- ln -fs /run/initiatorname.iscsi /etc/iscsi/initiatorname.iscsi +- > /tmp/iscsi_set_initiator +- systemctl try-restart iscsid && sleep 1 ++ if [ -n "$iscsi_initiator" ]; then ++ echo "InitiatorName=$iscsi_initiator" > /run/initiatorname.iscsi ++ rm -f /etc/iscsi/initiatorname.iscsi ++ mkdir -p /etc/iscsi ++ ln -fs /run/initiatorname.iscsi /etc/iscsi/initiatorname.iscsi ++ > /tmp/iscsi_set_initiator ++ systemctl try-restart iscsid && sleep 1 ++ fi + fi + + diff --git a/0140-network-move-ip-ibft-handling-to-network-module.patch b/0140-network-move-ip-ibft-handling-to-network-module.patch new file mode 100644 index 0000000..4c751a1 --- /dev/null +++ b/0140-network-move-ip-ibft-handling-to-network-module.patch @@ -0,0 +1,49 @@ +From 73833796b4592b06777fa1991163b74e9bb1e477 Mon Sep 17 00:00:00 2001 +From: Harald Hoyer +Date: Thu, 3 Sep 2015 12:41:44 +0200 +Subject: [PATCH] network: move "ip=ibft" handling to network module + +(cherry picked from commit b334c83e4abdc1dd87276fa7de4617cd349a5a4f) +--- + modules.d/40network/parse-ibft.sh | 2 ++ + modules.d/90kernel-network-modules/module-setup.sh | 1 + + modules.d/95iscsi/parse-iscsiroot.sh | 2 +- + 3 files changed, 4 insertions(+), 1 deletion(-) + +diff --git a/modules.d/40network/parse-ibft.sh b/modules.d/40network/parse-ibft.sh +index 144e205..8895b04 100755 +--- a/modules.d/40network/parse-ibft.sh ++++ b/modules.d/40network/parse-ibft.sh +@@ -4,5 +4,7 @@ command -v getarg >/dev/null || . /lib/dracut-lib.sh + command -v ibft_to_cmdline >/dev/null || . /lib/net-lib.sh + + if getargbool 0 rd.iscsi.ibft -d "ip=ibft"; then ++ modprobe -b -q iscsi_boot_sysfs 2>/dev/null ++ modprobe -b -q iscsi_ibft + ibft_to_cmdline + fi +diff --git a/modules.d/90kernel-network-modules/module-setup.sh b/modules.d/90kernel-network-modules/module-setup.sh +index b956ebe..18d7d96 100755 +--- a/modules.d/90kernel-network-modules/module-setup.sh ++++ b/modules.d/90kernel-network-modules/module-setup.sh +@@ -62,6 +62,7 @@ installkernel() { + =drivers/net/team \ + =drivers/net/ethernet \ + ecb arc4 bridge stp llc ipv6 bonding 8021q af_packet virtio_net ++ hostonly="" instmods iscsi_ibft crc32c iscsi_boot_sysfs + } + + # called by dracut +diff --git a/modules.d/95iscsi/parse-iscsiroot.sh b/modules.d/95iscsi/parse-iscsiroot.sh +index 81be6a9..63a822f 100755 +--- a/modules.d/95iscsi/parse-iscsiroot.sh ++++ b/modules.d/95iscsi/parse-iscsiroot.sh +@@ -69,7 +69,7 @@ if [ -n "$iscsiroot" ] ; then + fi + + # iscsi_firmware does not need argument checking +-if [ -n "$iscsi_firmware" ] || getargbool 0 rd.iscsi.ibft -d "ip=ibft"; then ++if [ -n "$iscsi_firmware" ]; then + if [ "$root" != "dhcp" ] && [ "$netroot" != "dhcp" ]; then + [ -z "$netroot" ] && netroot=iscsi: + fi diff --git a/0141-network-dhclient-script.sh-fix-RENEW.patch b/0141-network-dhclient-script.sh-fix-RENEW.patch new file mode 100644 index 0000000..dd1160f --- /dev/null +++ b/0141-network-dhclient-script.sh-fix-RENEW.patch @@ -0,0 +1,37 @@ +From e847a78bb6fb65ca9ea7e7987f378639e6d395b8 Mon Sep 17 00:00:00 2001 +From: Harald Hoyer +Date: Tue, 8 Sep 2015 11:44:13 +0200 +Subject: [PATCH] network/dhclient-script.sh: fix RENEW + +Remove check, if interface is already up. It is for RENEW. + +new_prefix is apparently new_subnet_mask + +(cherry picked from commit 52845b168d0909d72b4c2f0b6511ed18877a31e8) +--- + modules.d/40network/dhclient-script.sh | 5 +---- + 1 file changed, 1 insertion(+), 4 deletions(-) + +diff --git a/modules.d/40network/dhclient-script.sh b/modules.d/40network/dhclient-script.sh +index f55611d..9aac2b1 100755 +--- a/modules.d/40network/dhclient-script.sh ++++ b/modules.d/40network/dhclient-script.sh +@@ -8,9 +8,6 @@ type ip_to_var >/dev/null 2>&1 || . /lib/net-lib.sh + # We already need a set netif here + netif=$interface + +-# Huh? Interface configured? +-[ -f "/tmp/net.$netif.up" ] && exit 0 +- + setup_interface() { + ip=$new_ip_address + mtu=$new_interface_mtu +@@ -151,7 +148,7 @@ case $reason in + [ -n "$new_max_life" ] && lease_time=$new_max_life + preferred_lft=$lease_time + [ -n "$new_preferred_life" ] && preferred_lft=$new_preferred_life +- ip -4 addr change ${new_ip_address}/${new_prefix} broadcast ${new_broadcast_address} dev ${interface} \ ++ ip -4 addr change ${new_ip_address}/${new_subnet_mask} broadcast ${new_broadcast_address} dev ${interface} \ + ${lease_time:+valid_lft $lease_time} ${preferred_lft:+preferred_lft ${preferred_lft}} \ + >/dev/null 2>&1 + ;; diff --git a/0142-network-add-all_ifaces_setup.patch b/0142-network-add-all_ifaces_setup.patch new file mode 100644 index 0000000..aa22a85 --- /dev/null +++ b/0142-network-add-all_ifaces_setup.patch @@ -0,0 +1,34 @@ +From 5d90ba4fca3b5e3ca544ff76e6e7286eef16c438 Mon Sep 17 00:00:00 2001 +From: Harald Hoyer +Date: Thu, 10 Sep 2015 13:20:18 +0200 +Subject: [PATCH] network: add all_ifaces_setup() + +all_ifaces_up() is true, if all interfaces are up. + +all_ifaces_setup() is true, if all interfaces are up and the gateways +and nameserver are setup. + +(cherry picked from commit 63e75dc4cdb14e392e38a8973126c9a29b266411) +--- + modules.d/40network/net-lib.sh | 8 ++++++++ + 1 file changed, 8 insertions(+) + +diff --git a/modules.d/40network/net-lib.sh b/modules.d/40network/net-lib.sh +index 8096481..706a9a5 100755 +--- a/modules.d/40network/net-lib.sh ++++ b/modules.d/40network/net-lib.sh +@@ -73,6 +73,14 @@ all_ifaces_up() { + done + } + ++all_ifaces_setup() { ++ local iface="" IFACES="" ++ [ -e "/tmp/net.ifaces" ] && read IFACES < /tmp/net.ifaces ++ for iface in $IFACES; do ++ [ -e /tmp/net.$iface.did-setup ] || return 1 ++ done ++} ++ + get_netroot_ip() { + local prefix="" server="" rest="" + splitsep "$1" ":" prefix server rest diff --git a/0143-iscsi-iscsiroot.sh-use-all_ifaces_setup.patch b/0143-iscsi-iscsiroot.sh-use-all_ifaces_setup.patch new file mode 100644 index 0000000..b10b8cd --- /dev/null +++ b/0143-iscsi-iscsiroot.sh-use-all_ifaces_setup.patch @@ -0,0 +1,38 @@ +From df087c45d820f22e9bf772fa0009d68e647c0af7 Mon Sep 17 00:00:00 2001 +From: Harald Hoyer +Date: Thu, 10 Sep 2015 13:21:53 +0200 +Subject: [PATCH] iscsi/iscsiroot.sh: use all_ifaces_setup() + +we want the route and gateway setup + +(cherry picked from commit 7cddfbbadbc40a4b6d331be25a3c38ad3a52239b) +--- + modules.d/95iscsi/iscsiroot.sh | 6 +++--- + 1 file changed, 3 insertions(+), 3 deletions(-) + +diff --git a/modules.d/95iscsi/iscsiroot.sh b/modules.d/95iscsi/iscsiroot.sh +index e730cb0..b14a71b 100755 +--- a/modules.d/95iscsi/iscsiroot.sh ++++ b/modules.d/95iscsi/iscsiroot.sh +@@ -106,7 +106,7 @@ handle_netroot() + parse_iscsi_root "$1" || return 1 + + # Bail out early, if there is no route to the destination +- if is_ip "$iscsi_target_ip" && [ "$netif" != "timeout" ] && ! all_ifaces_up && getargbool 1 rd.iscsi.testroute; then ++ if is_ip "$iscsi_target_ip" && [ "$netif" != "timeout" ] && ! all_ifaces_setup && getargbool 1 rd.iscsi.testroute; then + ip route get "$iscsi_target_ip" >/dev/null 2>&1 || return 0 + fi + +@@ -225,10 +225,10 @@ handle_netroot() + ret=0 + + if [ "$netif" != "timeout" ] && getargbool 1 rd.iscsi.waitnet; then +- all_ifaces_up || exit 0 ++ all_ifaces_setup || exit 0 + fi + +-if [ "$netif" = "timeout" ] && all_ifaces_up; then ++if [ "$netif" = "timeout" ] && all_ifaces_setup; then + # s.th. went wrong and the timeout script hits + # restart + systemctl restart iscsid diff --git a/0144-network-netroot.sh-better-handling-of-netroot-and-dh.patch b/0144-network-netroot.sh-better-handling-of-netroot-and-dh.patch new file mode 100644 index 0000000..dd9e9af --- /dev/null +++ b/0144-network-netroot.sh-better-handling-of-netroot-and-dh.patch @@ -0,0 +1,61 @@ +From 19b0065cac88259026d43e48454544f7628c2963 Mon Sep 17 00:00:00 2001 +From: Harald Hoyer +Date: Thu, 10 Sep 2015 13:23:32 +0200 +Subject: [PATCH] network/netroot.sh: better handling of $netroot and dhcp + +if $netroot is emtpy, get it from cmdline + +check cmdline directly for root=dhcp(6) and netroot=dhcp(6) + +(cherry picked from commit 17cee31b115a146bca5519b6ac4b422080d764c7) +--- + modules.d/40network/netroot.sh | 17 +++++++++++------ + 1 file changed, 11 insertions(+), 6 deletions(-) + +diff --git a/modules.d/40network/netroot.sh b/modules.d/40network/netroot.sh +index 0fccaf1..c80a59f 100755 +--- a/modules.d/40network/netroot.sh ++++ b/modules.d/40network/netroot.sh +@@ -12,6 +12,11 @@ command -v setup_net >/dev/null || . /lib/net-lib.sh + # no sense in doing something if no (net)root info is available + # or root is already there + [ -d $NEWROOT/proc ] && exit 0 ++ ++if [ -z "$netroot" ]; then ++ netroot=$(getarg netroot=) ++fi ++ + [ -z "$netroot" ] && exit 1 + + # Set or override primary interface +@@ -33,7 +38,7 @@ esac + # Figure out the handler for root=dhcp by recalling all netroot cmdline + # handlers when this is not called from manually network bringing up. + if [ -z "$2" ]; then +- if [ "$netroot" = "dhcp" ] || [ "$netroot" = "dhcp6" ] ; then ++ if getarg "root=dhcp" || getarg "netroot=dhcp" || getarg "root=dhcp6" || getarg "netroot=dhcp6"; then + # Load dhcp options + [ -e /tmp/dhclient.$netif.dhcpopts ] && . /tmp/dhclient.$netif.dhcpopts + +@@ -45,6 +50,8 @@ if [ -z "$2" ]; then + exit 1 + fi + ++ rm -f -- $hookdir/initqueue/finished/dhcp.sh ++ + # Set netroot to new_root_path, so cmdline parsers don't call + netroot=$new_root_path + +@@ -74,9 +81,7 @@ source_hook netroot $netif + + # Run the handler; don't store the root, it may change from device to device + # XXX other variables to export? +-if $handler $netif $netroot $NEWROOT; then +- rm -f -- $hookdir/initqueue/finished/dhcp.sh +- # Network rootfs mount successful - save interface info for ifcfg etc. +- save_netinfo $netif +-fi ++[ -n "$handler" ] && "$handler" "$netif" "$netroot" "$NEWROOT" ++save_netinfo $netif ++ + exit 0 diff --git a/0145-iscsi-iscsiroot.sh-handle-iscsi_firmware-in-online-a.patch b/0145-iscsi-iscsiroot.sh-handle-iscsi_firmware-in-online-a.patch new file mode 100644 index 0000000..a80b998 --- /dev/null +++ b/0145-iscsi-iscsiroot.sh-handle-iscsi_firmware-in-online-a.patch @@ -0,0 +1,83 @@ +From b5363e834a5fe49d5651c12e70f664b96c841cae Mon Sep 17 00:00:00 2001 +From: Harald Hoyer +Date: Thu, 10 Sep 2015 13:25:13 +0200 +Subject: [PATCH] iscsi/iscsiroot.sh: handle iscsi_firmware in online and + timeout queue + +The return code of iscsi_firmware is broken, so set the marker +unconditionally. + +(cherry picked from commit fd3eddf06990a617a2f90b0a699947ab3faf2cc2) +--- + modules.d/95iscsi/iscsiroot.sh | 43 +++++++++++++++++++----------------------- + 1 file changed, 19 insertions(+), 24 deletions(-) + +diff --git a/modules.d/95iscsi/iscsiroot.sh b/modules.d/95iscsi/iscsiroot.sh +index b14a71b..5752cce 100755 +--- a/modules.d/95iscsi/iscsiroot.sh ++++ b/modules.d/95iscsi/iscsiroot.sh +@@ -43,29 +43,23 @@ fi + + handle_firmware() + { +- if ! [ -e /tmp/iscsistarted-firmware ]; then +- if ! iscsistart -f; then +- warn "iscistart: Could not get list of targets from firmware." +- return 1 +- fi ++ if ! iscsistart -f; then ++ warn "iscistart: Could not get list of targets from firmware." ++ return 1 ++ fi + +- for p in $(getargs rd.iscsi.param -d iscsi_param); do +- iscsi_param="$iscsi_param --param $p" +- done ++ for p in $(getargs rd.iscsi.param -d iscsi_param); do ++ iscsi_param="$iscsi_param --param $p" ++ done + +- if ! iscsistart -b $iscsi_param; then +- warn "'iscsistart -b $iscsi_param' failed" +- fi ++ if ! iscsistart -b $iscsi_param; then ++ warn "'iscsistart -b $iscsi_param' failed with return code $?" ++ fi + +- if [ -d /sys/class/iscsi_session ]; then +- echo 'started' > "/tmp/iscsistarted-iscsi:" +- echo 'started' > "/tmp/iscsistarted-firmware" +- else +- return 1 +- fi ++ echo 'started' > "/tmp/iscsistarted-iscsi:" ++ echo 'started' > "/tmp/iscsistarted-firmware" + +- need_shutdown +- fi ++ need_shutdown + return 0 + } + +@@ -236,15 +230,16 @@ if [ "$netif" = "timeout" ] && all_ifaces_setup; then + sleep 2 + fi + +-if [ "$netif" = "online" ]; then +- if getargbool 0 rd.iscsi.firmware -d -y iscsi_firmware ; then ++if getargbool 0 rd.iscsi.firmware -d -y iscsi_firmware ; then ++ if [ "$netif" = "timeout" ] || [ "$netif" = "online" ]; then + handle_firmware + ret=$? + fi +-else ++fi ++ ++if ! [ "$netif" = "online" ]; then + # loop over all netroot parameter +- nroot=$(getarg netroot) +- if [ $? -eq 0 ] && [ "$nroot" != "dhcp" ]; then ++ if nroot=$(getarg netroot) && [ "$nroot" != "dhcp" ]; then + for nroot in $(getargs netroot); do + [ "${nroot%%:*}" = "iscsi" ] || continue + nroot="${nroot##iscsi:}" diff --git a/0146-dracut.sh-add-command-line-option-for-install_i18_al.patch b/0146-dracut.sh-add-command-line-option-for-install_i18_al.patch new file mode 100644 index 0000000..56cc131 --- /dev/null +++ b/0146-dracut.sh-add-command-line-option-for-install_i18_al.patch @@ -0,0 +1,45 @@ +From b73e00aff7baf6b48e9b7af6ea1defee724b13a9 Mon Sep 17 00:00:00 2001 +From: Harald Hoyer +Date: Tue, 15 Sep 2015 16:04:09 +0200 +Subject: [PATCH] dracut.sh: add command line option for install_i18_all + +--no-hostonly-i18n -> install_i18n_all=yes +--hostonly-i18n -> install_i18n_all=no + +(cherry picked from commit 34b551a1c4d4513189807ee2a639c9214d887ddb) +--- + dracut.sh | 7 +++++++ + 1 file changed, 7 insertions(+) + +diff --git a/dracut.sh b/dracut.sh +index 1169037..9128cb0 100755 +--- a/dracut.sh ++++ b/dracut.sh +@@ -362,6 +362,8 @@ rearrange_params() + --long uefi \ + --long uefi-stub: \ + --long kernel-image: \ ++ --long no-hostonly-i18n \ ++ --long hostonly-i18n \ + -- "$@") + + if (( $? != 0 )); then +@@ -523,6 +525,10 @@ while :; do + hostonly_l="no" ;; + --hostonly-cmdline) + hostonly_cmdline_l="yes" ;; ++ --hostonly-i18n) ++ i18n_install_all_l="no" ;; ++ --no-hostonly-i18n) ++ i18n_install_all_l="yes" ;; + --no-hostonly-cmdline) + hostonly_cmdline_l="no" ;; + --persistent-policy) +@@ -716,6 +722,7 @@ stdloglvl=$((stdloglvl + verbosity_mod_l)) + [[ $hostonly_l ]] && hostonly=$hostonly_l + [[ $hostonly_cmdline_l ]] && hostonly_cmdline=$hostonly_cmdline_l + [[ "$hostonly" == "yes" ]] && ! [[ $hostonly_cmdline ]] && hostonly_cmdline="yes" ++[[ $i18n_install_all_l ]] && i18n_install_all=$i18n_install_all_l + [[ $persistent_policy_l ]] && persistent_policy=$persistent_policy_l + [[ $use_fstab_l ]] && use_fstab=$use_fstab_l + [[ $mdadmconf_l ]] && mdadmconf=$mdadmconf_l diff --git a/0147-dracut.sh-do-not-create-microcode-if-no-firmware-is-.patch b/0147-dracut.sh-do-not-create-microcode-if-no-firmware-is-.patch new file mode 100644 index 0000000..c76033c --- /dev/null +++ b/0147-dracut.sh-do-not-create-microcode-if-no-firmware-is-.patch @@ -0,0 +1,26 @@ +From 583fb23199d4c1293d38c72e0c29e74079441e46 Mon Sep 17 00:00:00 2001 +From: Harald Hoyer +Date: Tue, 15 Sep 2015 16:08:25 +0200 +Subject: [PATCH] dracut.sh: do not create microcode, if no firmware is + available + +(cherry picked from commit 13b5c1d09e0e242f1817057501292fe9d7e9ad92) +--- + dracut.sh | 4 ++++ + 1 file changed, 4 insertions(+) + +diff --git a/dracut.sh b/dracut.sh +index 9128cb0..fe735bd 100755 +--- a/dracut.sh ++++ b/dracut.sh +@@ -1617,6 +1617,10 @@ if [[ $early_microcode = yes ]]; then + break; + fi + fi ++ for i in $_fwdir/$_fw/$_src; do ++ [ -e $i ] && break ++ break 2 ++ done + cat $_fwdir/$_fw/$_src > $_dest_dir/${ucode_dest[$idx]} + create_early_cpio="yes" + fi diff --git a/0148-iscsi-parse-iscsiroot.sh-correct-handling-if-netroot.patch b/0148-iscsi-parse-iscsiroot.sh-correct-handling-if-netroot.patch new file mode 100644 index 0000000..8efe43b --- /dev/null +++ b/0148-iscsi-parse-iscsiroot.sh-correct-handling-if-netroot.patch @@ -0,0 +1,28 @@ +From 79cb273dc081598ea0dec4734ee0413491f7c45e Mon Sep 17 00:00:00 2001 +From: Harald Hoyer +Date: Thu, 17 Sep 2015 15:41:12 +0200 +Subject: [PATCH] iscsi/parse-iscsiroot.sh: correct handling if netroot isn't + set + +corrects bfe65f913a4bc6bc5fdb7aa75234c229a2ceef8f + +(cherry picked from commit 7fd112f20e63def6d274ab445b5eb82138348901) +--- + modules.d/95iscsi/parse-iscsiroot.sh | 4 +++- + 1 file changed, 3 insertions(+), 1 deletion(-) + +diff --git a/modules.d/95iscsi/parse-iscsiroot.sh b/modules.d/95iscsi/parse-iscsiroot.sh +index 63a822f..971bab2 100755 +--- a/modules.d/95iscsi/parse-iscsiroot.sh ++++ b/modules.d/95iscsi/parse-iscsiroot.sh +@@ -82,7 +82,9 @@ if [ -n "$iscsi_firmware" ]; then + initqueue --unique --onetime --settled /sbin/iscsiroot online "iscsi:" "'$NEWROOT'" + fi + +-[ -z "$netroot" ] || [ "${netroot%%:*}" = "iscsi" ] || return 1 ++if [ -z "$netroot" ] || ! [ "${netroot%%:*}" = "iscsi" ]; then ++ return 1 ++fi + + initqueue --unique --onetime --timeout /sbin/iscsiroot timeout "$netroot" "$NEWROOT" + diff --git a/0149-dracut.sh-no-microcode-if-get_ucode_file-returns-emp.patch b/0149-dracut.sh-no-microcode-if-get_ucode_file-returns-emp.patch new file mode 100644 index 0000000..7374fba --- /dev/null +++ b/0149-dracut.sh-no-microcode-if-get_ucode_file-returns-emp.patch @@ -0,0 +1,33 @@ +From efba549a2635a05f57b892851e629de94328ddbc Mon Sep 17 00:00:00 2001 +From: Harald Hoyer +Date: Thu, 17 Sep 2015 20:03:54 +0200 +Subject: [PATCH] dracut.sh: no microcode, if get_ucode_file returns empty file + +check, if get_ucode_file() returned an empty string. + +(cherry picked from commit 327d765512135721a323822a8b10ac1539bd20c6) +--- + dracut.sh | 8 ++++---- + 1 file changed, 4 insertions(+), 4 deletions(-) + +diff --git a/dracut.sh b/dracut.sh +index fe735bd..b84013a 100755 +--- a/dracut.sh ++++ b/dracut.sh +@@ -1613,12 +1613,12 @@ if [[ $early_microcode = yes ]]; then + dinfo "*** Constructing ${ucode_dest[$idx]} ****" + if [[ $hostonly ]]; then + _src=$(get_ucode_file) +- if ! [[ -r $_fwdir/$_fw/$_src ]];then +- break; +- fi ++ [[ $src ]] || break ++ [[ -r $_fwdir/$_fw/$_src ]] || break + fi ++ + for i in $_fwdir/$_fw/$_src; do +- [ -e $i ] && break ++ [ -e "$i" ] && break + break 2 + done + cat $_fwdir/$_fw/$_src > $_dest_dir/${ucode_dest[$idx]} diff --git a/0150-network-wait_for_ifup-handle-NO-CARRIER-output.patch b/0150-network-wait_for_ifup-handle-NO-CARRIER-output.patch new file mode 100644 index 0000000..8d7512b --- /dev/null +++ b/0150-network-wait_for_ifup-handle-NO-CARRIER-output.patch @@ -0,0 +1,53 @@ +From a49c1f049b1256ef17e94ef94c236f163001fee6 Mon Sep 17 00:00:00 2001 +From: Harald Hoyer +Date: Fri, 25 Sep 2015 10:14:33 -0400 +Subject: [PATCH] network:wait_for_ifup() handle "NO-CARRIER" output + +if "NO-CARRIER" is one of the flags, we surely have no link yet. + +(cherry picked from commit f059985b14f80a41f3b8103b67cb8fae0d3fc2fc) +--- + modules.d/40network/net-lib.sh | 30 ++++++++++++++++-------------- + 1 file changed, 16 insertions(+), 14 deletions(-) + +diff --git a/modules.d/40network/net-lib.sh b/modules.d/40network/net-lib.sh +index 706a9a5..135c378 100755 +--- a/modules.d/40network/net-lib.sh ++++ b/modules.d/40network/net-lib.sh +@@ -537,20 +537,22 @@ wait_for_if_up() { + + while [ $cnt -lt $timeout ]; do + li=$(ip -o link show up dev $1) +- if [ -n "$li" ]; then +- case "$li" in +- *\*) +- return 0;; +- *\<*,UP,*\>*) +- return 0;; +- esac +- fi +- if strstr "$li" "LOWER_UP" \ +- && strstr "$li" "state UNKNOWN" \ +- && ! strstr "$li" "DORMANT"; then +- return 0 ++ if ! strstr "$li" "NO-CARRIER"; then ++ if [ -n "$li" ]; then ++ case "$li" in ++ *\*) ++ return 0;; ++ *\<*,UP,*\>*) ++ return 0;; ++ esac ++ fi ++ if strstr "$li" "LOWER_UP" \ ++ && strstr "$li" "state UNKNOWN" \ ++ && ! strstr "$li" "DORMANT"; then ++ return 0 ++ fi + fi + sleep 0.1 + cnt=$(($cnt+1)) diff --git a/0151-dracut.sh-fixed-typo-in-microcode-generation.patch b/0151-dracut.sh-fixed-typo-in-microcode-generation.patch new file mode 100644 index 0000000..7078593 --- /dev/null +++ b/0151-dracut.sh-fixed-typo-in-microcode-generation.patch @@ -0,0 +1,23 @@ +From b44156c6fc445e5777b6c10bcebc90a1415df4d7 Mon Sep 17 00:00:00 2001 +From: Harald Hoyer +Date: Fri, 25 Sep 2015 14:10:20 -0400 +Subject: [PATCH] dracut.sh: fixed typo in microcode generation + +(cherry picked from commit a594b4e357bc63dd22ae04346dbca648e0d62744) +--- + dracut.sh | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/dracut.sh b/dracut.sh +index b84013a..1f75b24 100755 +--- a/dracut.sh ++++ b/dracut.sh +@@ -1613,7 +1613,7 @@ if [[ $early_microcode = yes ]]; then + dinfo "*** Constructing ${ucode_dest[$idx]} ****" + if [[ $hostonly ]]; then + _src=$(get_ucode_file) +- [[ $src ]] || break ++ [[ $_src ]] || break + [[ -r $_fwdir/$_fw/$_src ]] || break + fi + diff --git a/0152-base-dracut-lib.sh-getargs-don-t-return-1-for-empty-.patch b/0152-base-dracut-lib.sh-getargs-don-t-return-1-for-empty-.patch new file mode 100644 index 0000000..3065d8a --- /dev/null +++ b/0152-base-dracut-lib.sh-getargs-don-t-return-1-for-empty-.patch @@ -0,0 +1,27 @@ +From ecdee70c487316f396510c7cd3c4efe65003fac1 Mon Sep 17 00:00:00 2001 +From: Harald Hoyer +Date: Fri, 9 Oct 2015 11:30:03 +0200 +Subject: [PATCH] base/dracut-lib.sh:getargs() don't return 1 for empty values + +getargs() is only used with real values and not booleans. + +So, return the values only. + +(cherry picked from commit d1f7f2ac046c77913d1ca97cf8414d9226ae1286) +--- + modules.d/99base/dracut-lib.sh | 2 -- + 1 file changed, 2 deletions(-) + +diff --git a/modules.d/99base/dracut-lib.sh b/modules.d/99base/dracut-lib.sh +index 1eaf4b3..03a283c 100755 +--- a/modules.d/99base/dracut-lib.sh ++++ b/modules.d/99base/dracut-lib.sh +@@ -330,8 +330,6 @@ getargs() { + if [ -n "$_gfound" ]; then + if [ $# -gt 0 ]; then + printf '%s' "$*" +- else +- printf 1 + fi + debug_on + return 0 diff --git a/0153-network-ifup.sh-skip-empty-nameserver-values.patch b/0153-network-ifup.sh-skip-empty-nameserver-values.patch new file mode 100644 index 0000000..9ef738d --- /dev/null +++ b/0153-network-ifup.sh-skip-empty-nameserver-values.patch @@ -0,0 +1,36 @@ +From 5b43377d74967bd445fe9c0e06d928194b800dd5 Mon Sep 17 00:00:00 2001 +From: Harald Hoyer +Date: Fri, 9 Oct 2015 11:35:43 +0200 +Subject: [PATCH] network/ifup.sh: skip empty nameserver values + +(cherry picked from commit e65825117377a8e1e730912aa4c0e786122d892a) +--- + modules.d/40network/ifup.sh | 8 ++++---- + 1 file changed, 4 insertions(+), 4 deletions(-) + +diff --git a/modules.d/40network/ifup.sh b/modules.d/40network/ifup.sh +index 366744f..109fb4b 100755 +--- a/modules.d/40network/ifup.sh ++++ b/modules.d/40network/ifup.sh +@@ -313,8 +313,8 @@ fi + ip=$(getarg ip) + + if [ -z "$ip" ]; then +- namesrv=$(getargs nameserver) +- for s in $namesrv; do ++ for s in $(getargs nameserver); do ++ [ -n "$s" ] || continue + echo nameserver $s >> /tmp/net.$netif.resolv.conf + done + +@@ -350,8 +350,8 @@ for p in $(getargs ip=); do + [ "$use_vlan" != 'true' ] && continue + + # setup nameserver +- namesrv="$dns1 $dns2 $(getargs nameserver)" +- for s in $namesrv; do ++ for s in "$dns1" "$dns2" $(getargs nameserver); do ++ [ -n "$s" ] || continue + echo nameserver $s >> /tmp/net.$netif.resolv.conf + done + diff --git a/0154-dracut-systemd-rootfs-generator.sh-s-RequiresOverrid.patch b/0154-dracut-systemd-rootfs-generator.sh-s-RequiresOverrid.patch new file mode 100644 index 0000000..2886ea0 --- /dev/null +++ b/0154-dracut-systemd-rootfs-generator.sh-s-RequiresOverrid.patch @@ -0,0 +1,24 @@ +From 35a666d02a6e818b8bf9879d1cf8cf2c32d9af06 Mon Sep 17 00:00:00 2001 +From: Harald Hoyer +Date: Fri, 13 Nov 2015 10:13:08 +0100 +Subject: [PATCH] dracut-systemd/rootfs-generator.sh: + s/RequiresOverridable/Requires + +RequiresOverridable will be deprecated +--- + modules.d/98dracut-systemd/rootfs-generator.sh | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/modules.d/98dracut-systemd/rootfs-generator.sh b/modules.d/98dracut-systemd/rootfs-generator.sh +index 5e79d0b..eada3d1 100755 +--- a/modules.d/98dracut-systemd/rootfs-generator.sh ++++ b/modules.d/98dracut-systemd/rootfs-generator.sh +@@ -50,7 +50,7 @@ generator_mount_rootfs() + { + echo "[Unit]" + echo "Before=initrd-root-fs.target" +- echo "RequiresOverridable=systemd-fsck@${_name}.service" ++ echo "Requires=systemd-fsck@${_name}.service" + echo "After=systemd-fsck@${_name}.service" + echo "[Mount]" + echo "Where=/sysroot" diff --git a/0155-add-no-reproducible-to-turn-off-reproducible-mode.patch b/0155-add-no-reproducible-to-turn-off-reproducible-mode.patch new file mode 100644 index 0000000..0a2be35 --- /dev/null +++ b/0155-add-no-reproducible-to-turn-off-reproducible-mode.patch @@ -0,0 +1,62 @@ +From 10f8df1bdfd0a19a0415e7db18b1a071313f0e57 Mon Sep 17 00:00:00 2001 +From: Harald Hoyer +Date: Fri, 13 Nov 2015 11:53:36 +0100 +Subject: [PATCH] add --no-reproducible to turn off reproducible mode + +Also warn about cpio not supporting it and turn it on by default for +fedora. +--- + dracut.conf.d/fedora.conf.example | 1 + + dracut.sh | 9 ++++++++- + 2 files changed, 9 insertions(+), 1 deletion(-) + +diff --git a/dracut.conf.d/fedora.conf.example b/dracut.conf.d/fedora.conf.example +index b126b09..b32abb0 100644 +--- a/dracut.conf.d/fedora.conf.example ++++ b/dracut.conf.d/fedora.conf.example +@@ -17,3 +17,4 @@ udevdir=/usr/lib/udev + hostonly="yes" + hostonly_cmdline="no" + early_microcode="yes" ++reproducible="yes" +diff --git a/dracut.sh b/dracut.sh +index 1f75b24..fb5d400 100755 +--- a/dracut.sh ++++ b/dracut.sh +@@ -202,6 +202,7 @@ Creates initial ramdisk images for preloading modules + --sshkey [SSHKEY] Add ssh key to initramfs (use with ssh-client module) + --logfile [FILE] Logfile to use (overrides configuration setting) + --reproducible Create reproducible images ++ --no-reproducible Do not create reproducible images + --loginstall [DIR] Log all files installed from the host to [DIR] + --uefi Create an UEFI executable with the kernel cmdline and + kernel combined +@@ -358,6 +359,7 @@ rearrange_params() + --long early-microcode \ + --long no-early-microcode \ + --long reproducible \ ++ --long no-reproducible \ + --long loginstall: \ + --long uefi \ + --long uefi-stub: \ +@@ -553,6 +555,7 @@ while :; do + --regenerate-all) regenerate_all="yes";; + --noimageifnotneeded) noimageifnotneeded="yes";; + --reproducible) reproducible_l="yes";; ++ --no-reproducible) reproducible_l="no";; + --uefi) uefi="yes";; + --uefi-stub) + uefi_stub_l="$2"; PARMS_TO_STORE+=" '$2'"; shift;; +@@ -1673,7 +1676,11 @@ if [[ $DRACUT_REPRODUCIBLE ]]; then + find "$initdir" -newer "$dracutbasedir/dracut-functions.sh" -print0 \ + | xargs -r -0 touch -h -m -c -r "$dracutbasedir/dracut-functions.sh" + +- [[ "$(cpio --help)" == *--reproducible* ]] && CPIO_REPRODUCIBLE=1 ++ if [[ "$(cpio --help)" == *--reproducible* ]]; then ++ CPIO_REPRODUCIBLE=1 ++ else ++ dinfo "cpio does not support '--reproducible'. Resulting image will not be reproducible." ++ fi + fi + + [[ "$UID" != 0 ]] && cpio_owner_root="-R 0:0" diff --git a/0156-reduce-dracut-functions.sh-and-add-to-dracut-init.sh.patch b/0156-reduce-dracut-functions.sh-and-add-to-dracut-init.sh.patch new file mode 100644 index 0000000..1b80002 --- /dev/null +++ b/0156-reduce-dracut-functions.sh-and-add-to-dracut-init.sh.patch @@ -0,0 +1,2371 @@ +From 561eb42f39e26cd43f1df1484bba5883048e3178 Mon Sep 17 00:00:00 2001 +From: Harald Hoyer +Date: Fri, 13 Nov 2015 13:06:01 +0100 +Subject: [PATCH] reduce dracut-functions.sh and add to dracut-init.sh + +move all dracut specific functions to dracut-init.sh +--- + dracut-functions.sh | 1148 +-------------------------------------------------- + dracut-init.sh | 1144 +++++++++++++++++++++++++++++++++++++++++++++++++- + 2 files changed, 1146 insertions(+), 1146 deletions(-) + +diff --git a/dracut-functions.sh b/dracut-functions.sh +index 1c6d327..59747ec 100755 +--- a/dracut-functions.sh ++++ b/dracut-functions.sh +@@ -19,11 +19,12 @@ + # + export LC_MESSAGES=C + +-if [[ $DRACUT_KERNEL_LAZY ]] && ! [[ $DRACUT_KERNEL_LAZY_HASHDIR ]]; then +- if [[ -d "$initdir/.kernelmodseen" ]]; then +- DRACUT_KERNEL_LAZY_HASHDIR="$initdir/.kernelmodseen" +- fi +-fi ++# is_func ++# Check whether $1 is a function. ++is_func() { ++ [[ "$(type -t "$1")" = "function" ]] ++} ++ + + # Generic substring function. If $2 is in $1, return 0. + strstr() { [[ $1 = *"$2"* ]]; } +@@ -36,51 +37,6 @@ str_starts() { [ "${1#"$2"*}" != "$1" ]; } + # returns OK if $1 contains literal string $2 at the end, and isn't empty + str_ends() { [ "${1%*"$2"}" != "$1" ]; } + +-# helper function for check() in module-setup.sh +-# to check for required installed binaries +-# issues a standardized warning message +-require_binaries() { +- local _module_name="${moddir##*/}" +- local _ret=0 +- +- if [[ "$1" = "-m" ]]; then +- _module_name="$2" +- shift 2 +- fi +- +- for cmd in "$@"; do +- if ! find_binary "$cmd" &>/dev/null; then +- dinfo "dracut module '${_module_name#[0-9][0-9]}' will not be installed, because command '$cmd' could not be found!" +- ((_ret++)) +- fi +- done +- return $_ret +-} +- +-require_any_binary() { +- local _module_name="${moddir##*/}" +- local _ret=1 +- +- if [[ "$1" = "-m" ]]; then +- _module_name="$2" +- shift 2 +- fi +- +- for cmd in "$@"; do +- if find_binary "$cmd" &>/dev/null; then +- _ret=0 +- break +- fi +- done +- +- if (( $_ret != 0 )); then +- dinfo "$_module_name: Could not find any command of '$@'!" +- return 1 +- fi +- +- return 0 +-} +- + # find a binary. If we were not passed the full path directly, + # search in the usual places to find the binary. + find_binary() { +@@ -94,39 +50,11 @@ find_binary() { + type -P "${1##*/}" + } + +-if ! [[ $dracutbasedir ]]; then +- dracutbasedir=${BASH_SOURCE[0]%/*} +- [[ $dracutbasedir = dracut-functions* ]] && dracutbasedir="." +- [[ $dracutbasedir ]] || dracutbasedir="." +- dracutbasedir="$(readlink -f $dracutbasedir)" +-fi +- + ldconfig_paths() + { + ldconfig -pN 2>/dev/null | grep -E -v '/(lib|lib64|usr/lib|usr/lib64)/[^/]*$' | sed -n 's,.* => \(.*\)/.*,\1,p' | sort | uniq + } + +-# Detect lib paths +-if ! [[ $libdirs ]] ; then +- if [[ "$(ldd /bin/sh)" == */lib64/* ]] &>/dev/null \ +- && [[ -d /lib64 ]]; then +- libdirs+=" /lib64" +- [[ -d /usr/lib64 ]] && libdirs+=" /usr/lib64" +- else +- libdirs+=" /lib" +- [[ -d /usr/lib ]] && libdirs+=" /usr/lib" +- fi +- +- libdirs+=" $(ldconfig_paths)" +- +- export libdirs +-fi +- +-if ! [[ $kernel ]]; then +- kernel=$(uname -r) +- export kernel +-fi +- + # Version comparision function. Assumes Linux style version scheme. + # $1 = version a + # $2 = comparision op (gt, ge, eq, le, lt, ne) +@@ -154,50 +82,6 @@ vercmp() { + esac + } + +-srcmods="/lib/modules/$kernel/" +- +-[[ $drivers_dir ]] && { +- if ! command -v kmod &>/dev/null && vercmp "$(modprobe --version | cut -d' ' -f3)" lt 3.7; then +- dfatal 'To use --kmoddir option module-init-tools >= 3.7 is required.' +- exit 1 +- fi +- srcmods="$drivers_dir" +-} +-export srcmods +- +-# is_func +-# Check whether $1 is a function. +-is_func() { +- [[ "$(type -t "$1")" = "function" ]] +-} +- +-if ! is_func dinfo >/dev/null 2>&1; then +- . "$dracutbasedir/dracut-logger.sh" +- dlog_init +-fi +- +-if ! [[ $initdir ]]; then +- dfatal "initdir not set" +- exit 1 +-fi +- +-# export standard hookdirs +-[[ $hookdirs ]] || { +- hookdirs="cmdline pre-udev pre-trigger netroot " +- hookdirs+="initqueue initqueue/settled initqueue/online initqueue/finished initqueue/timeout " +- hookdirs+="pre-mount pre-pivot cleanup mount " +- hookdirs+="emergency shutdown-emergency pre-shutdown shutdown " +- export hookdirs +-} +- +-dracut_need_initqueue() { +- >"$initdir/lib/dracut/need-initqueue" +-} +- +-dracut_module_included() { +- [[ " $mods_to_load $modules_loaded " == *\ $*\ * ]] +-} +- + # Create all subdirectories for given path without creating the last element. + # $1 = path + mksubdirs() { +@@ -728,1026 +612,6 @@ fs_get_option() { + done + } + +-if ! [[ $DRACUT_INSTALL ]]; then +- DRACUT_INSTALL=$(find_binary dracut-install) +-fi +- +-if ! [[ $DRACUT_INSTALL ]] && [[ -x $dracutbasedir/dracut-install ]]; then +- DRACUT_INSTALL=$dracutbasedir/dracut-install +-elif ! [[ $DRACUT_INSTALL ]] && [[ -x $dracutbasedir/install/dracut-install ]]; then +- DRACUT_INSTALL=$dracutbasedir/install/dracut-install +-fi +- +-if ! [[ -x $DRACUT_INSTALL ]]; then +- dfatal "dracut-install not found!" +- exit 10 +-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 "$@" || : +-} +- +-inst() { +- local _hostonly_install +- if [[ "$1" == "-H" ]]; then +- _hostonly_install="-H" +- shift +- fi +- [[ -e ${initdir}/"${2:-$1}" ]] && return 0 # already there +- $DRACUT_INSTALL ${initdir:+-D "$initdir"} ${loginstall:+-L "$loginstall"} ${DRACUT_RESOLVE_DEPS:+-l} ${DRACUT_FIPS_MODE:+-f} ${_hostonly_install:+-H} "$@" +- (($? != 0)) && derror $DRACUT_INSTALL ${initdir:+-D "$initdir"} ${loginstall:+-L "$loginstall"} ${DRACUT_RESOLVE_DEPS:+-l} ${DRACUT_FIPS_MODE:+-f} ${_hostonly_install:+-H} "$@" || : +-} +- +-inst_simple() { +- local _hostonly_install +- if [[ "$1" == "-H" ]]; then +- _hostonly_install="-H" +- shift +- fi +- [[ -e ${initdir}/"${2:-$1}" ]] && return 0 # already there +- [[ -e $1 ]] || return 1 # no source +- $DRACUT_INSTALL ${initdir:+-D "$initdir"} ${loginstall:+-L "$loginstall"} ${_hostonly_install:+-H} "$@" +- (($? != 0)) && derror $DRACUT_INSTALL ${initdir:+-D "$initdir"} ${loginstall:+-L "$loginstall"} ${_hostonly_install:+-H} "$@" || : +-} +- +-inst_symlink() { +- local _hostonly_install +- if [[ "$1" == "-H" ]]; then +- _hostonly_install="-H" +- shift +- fi +- [[ -e ${initdir}/"${2:-$1}" ]] && return 0 # already there +- [[ -L $1 ]] || return 1 +- $DRACUT_INSTALL ${initdir:+-D "$initdir"} ${loginstall:+-L "$loginstall"} ${DRACUT_RESOLVE_DEPS:+-l} ${DRACUT_FIPS_MODE:+-f} ${_hostonly_install:+-H} "$@" +- (($? != 0)) && derror $DRACUT_INSTALL ${initdir:+-D "$initdir"} ${loginstall:+-L "$loginstall"} ${DRACUT_RESOLVE_DEPS:+-l} ${DRACUT_FIPS_MODE:+-f} ${_hostonly_install:+-H} "$@" || : +-} +- +-inst_multiple() { +- local _ret +- $DRACUT_INSTALL ${initdir:+-D "$initdir"} -a ${loginstall:+-L "$loginstall"} ${DRACUT_RESOLVE_DEPS:+-l} ${DRACUT_FIPS_MODE:+-f} "$@" +- _ret=$? +- (($_ret != 0)) && derror $DRACUT_INSTALL ${initdir:+-D "$initdir"} -a ${loginstall:+-L "$loginstall"} ${DRACUT_RESOLVE_DEPS:+-l} ${DRACUT_FIPS_MODE:+-f} ${_hostonly_install:+-H} "$@" || : +- return $_ret +-} +- +-dracut_install() { +- inst_multiple "$@" +-} +- +-inst_library() { +- local _hostonly_install +- if [[ "$1" == "-H" ]]; then +- _hostonly_install="-H" +- shift +- fi +- [[ -e ${initdir}/"${2:-$1}" ]] && return 0 # already there +- [[ -e $1 ]] || return 1 # no source +- $DRACUT_INSTALL ${initdir:+-D "$initdir"} ${loginstall:+-L "$loginstall"} ${DRACUT_RESOLVE_DEPS:+-l} ${DRACUT_FIPS_MODE:+-f} ${_hostonly_install:+-H} "$@" +- (($? != 0)) && derror $DRACUT_INSTALL ${initdir:+-D "$initdir"} ${loginstall:+-L "$loginstall"} ${DRACUT_RESOLVE_DEPS:+-l} ${DRACUT_FIPS_MODE:+-f} ${_hostonly_install:+-H} "$@" || : +-} +- +-inst_binary() { +- $DRACUT_INSTALL ${initdir:+-D "$initdir"} ${loginstall:+-L "$loginstall"} ${DRACUT_RESOLVE_DEPS:+-l} ${DRACUT_FIPS_MODE:+-f} "$@" +- (($? != 0)) && derror $DRACUT_INSTALL ${initdir:+-D "$initdir"} ${loginstall:+-L "$loginstall"} ${DRACUT_RESOLVE_DEPS:+-l} ${DRACUT_FIPS_MODE:+-f} "$@" || : +-} +- +-inst_script() { +- $DRACUT_INSTALL ${initdir:+-D "$initdir"} ${loginstall:+-L "$loginstall"} ${DRACUT_RESOLVE_DEPS:+-l} ${DRACUT_FIPS_MODE:+-f} "$@" +- (($? != 0)) && derror $DRACUT_INSTALL ${initdir:+-D "$initdir"} ${loginstall:+-L "$loginstall"} ${DRACUT_RESOLVE_DEPS:+-l} ${DRACUT_FIPS_MODE:+-f} "$@" || : +-} +- +-mark_hostonly() { +- for i in "$@"; do +- echo "$i" >> "$initdir/lib/dracut/hostonly-files" +- done +-} +- +-# find symlinks linked to given library file +-# $1 = library file +-# Function searches for symlinks by stripping version numbers appended to +-# library filename, checks if it points to the same target and finally +-# prints the list of symlinks to stdout. +-# +-# Example: +-# rev_lib_symlinks libfoo.so.8.1 +-# output: libfoo.so.8 libfoo.so +-# (Only if libfoo.so.8 and libfoo.so exists on host system.) +-rev_lib_symlinks() { +- [[ ! $1 ]] && return 0 +- +- local fn="$1" orig="$(readlink -f "$1")" links='' +- +- [[ ${fn} == *.so.* ]] || return 1 +- +- until [[ ${fn##*.} == so ]]; do +- fn="${fn%.*}" +- [[ -L ${fn} && $(readlink -f "${fn}") == ${orig} ]] && links+=" ${fn}" +- done +- +- echo "${links}" +-} +- +-# attempt to install any programs specified in a udev rule +-inst_rule_programs() { +- local _prog _bin +- +- if grep -qE 'PROGRAM==?"[^ "]+' "$1"; then +- for _prog in $(grep -E 'PROGRAM==?"[^ "]+' "$1" | sed -r 's/.*PROGRAM==?"([^ "]+).*/\1/'); do +- _bin="" +- if [ -x ${udevdir}/$_prog ]; then +- _bin=${udevdir}/$_prog +- elif [[ "${_prog/\$env\{/}" == "$_prog" ]]; then +- _bin=$(find_binary "$_prog") || { +- dinfo "Skipping program $_prog using in udev rule ${1##*/} as it cannot be found" +- continue; +- } +- fi +- +- [[ $_bin ]] && inst_binary "$_bin" +- done +- fi +- if grep -qE 'RUN[+=]=?"[^ "]+' "$1"; then +- for _prog in $(grep -E 'RUN[+=]=?"[^ "]+' "$1" | sed -r 's/.*RUN[+=]=?"([^ "]+).*/\1/'); do +- _bin="" +- if [ -x ${udevdir}/$_prog ]; then +- _bin=${udevdir}/$_prog +- elif [[ "${_prog/\$env\{/}" == "$_prog" ]] && [[ "${_prog}" != "/sbin/initqueue" ]]; then +- _bin=$(find_binary "$_prog") || { +- dinfo "Skipping program $_prog using in udev rule ${1##*/} as it cannot be found" +- continue; +- } +- fi +- +- [[ $_bin ]] && inst_binary "$_bin" +- done +- fi +- if grep -qE 'IMPORT\{program\}==?"[^ "]+' "$1"; then +- for _prog in $(grep -E 'IMPORT\{program\}==?"[^ "]+' "$1" | sed -r 's/.*IMPORT\{program\}==?"([^ "]+).*/\1/'); do +- _bin="" +- if [ -x ${udevdir}/$_prog ]; then +- _bin=${udevdir}/$_prog +- elif [[ "${_prog/\$env\{/}" == "$_prog" ]]; then +- _bin=$(find_binary "$_prog") || { +- dinfo "Skipping program $_prog using in udev rule ${1##*/} as it cannot be found" +- continue; +- } +- fi +- +- [[ $_bin ]] && dracut_install "$_bin" +- done +- fi +-} +- +-# attempt to install any programs specified in a udev rule +-inst_rule_group_owner() { +- local i +- +- if grep -qE 'OWNER=?"[^ "]+' "$1"; then +- for i in $(grep -E 'OWNER=?"[^ "]+' "$1" | sed -r 's/.*OWNER=?"([^ "]+).*/\1/'); do +- if ! egrep -q "^$i:" "$initdir/etc/passwd" 2>/dev/null; then +- egrep "^$i:" /etc/passwd 2>/dev/null >> "$initdir/etc/passwd" +- fi +- done +- fi +- if grep -qE 'GROUP=?"[^ "]+' "$1"; then +- for i in $(grep -E 'GROUP=?"[^ "]+' "$1" | sed -r 's/.*GROUP=?"([^ "]+).*/\1/'); do +- if ! egrep -q "^$i:" "$initdir/etc/group" 2>/dev/null; then +- egrep "^$i:" /etc/group 2>/dev/null >> "$initdir/etc/group" +- fi +- done +- fi +-} +- +-inst_rule_initqueue() { +- if grep -q -F initqueue "$1"; then +- dracut_need_initqueue +- fi +-} +- +-# udev rules always get installed in the same place, so +-# create a function to install them to make life simpler. +-inst_rules() { +- local _target=/etc/udev/rules.d _rule _found +- +- inst_dir "${udevdir}/rules.d" +- inst_dir "$_target" +- for _rule in "$@"; do +- if [ "${_rule#/}" = "$_rule" ]; then +- for r in ${udevdir}/rules.d ${hostonly:+/etc/udev/rules.d}; do +- [[ -e $r/$_rule ]] || continue +- _found="$r/$_rule" +- inst_rule_programs "$_found" +- inst_rule_group_owner "$_found" +- inst_rule_initqueue "$_found" +- inst_simple "$_found" +- done +- fi +- for r in '' $dracutbasedir/rules.d/; do +- # skip rules without an absolute path +- [[ "${r}$_rule" != /* ]] && continue +- [[ -f ${r}$_rule ]] || continue +- _found="${r}$_rule" +- inst_rule_programs "$_found" +- inst_rule_group_owner "$_found" +- inst_rule_initqueue "$_found" +- inst_simple "$_found" "$_target/${_found##*/}" +- done +- [[ $_found ]] || dinfo "Skipping udev rule: $_rule" +- done +-} +- +-inst_rules_wildcard() { +- local _target=/etc/udev/rules.d _rule _found +- +- inst_dir "${udevdir}/rules.d" +- inst_dir "$_target" +- for _rule in ${udevdir}/rules.d/$1 ${dracutbasedir}/rules.d/$1 ; do +- [[ -e $_rule ]] || continue +- inst_rule_programs "$_rule" +- inst_rule_group_owner "$_rule" +- inst_rule_initqueue "$_rule" +- inst_simple "$_rule" +- _found=$_rule +- done +- if [[ -n ${hostonly} ]] ; then +- for _rule in ${_target}/$1 ; do +- [[ -f $_rule ]] || continue +- inst_rule_programs "$_rule" +- inst_rule_group_owner "$_rule" +- inst_rule_initqueue "$_rule" +- inst_simple "$_rule" +- _found=$_rule +- done +- fi +- [[ $_found ]] || dinfo "Skipping udev rule: $_rule" +-} +- +-prepare_udev_rules() { +- [ -z "$UDEVVERSION" ] && export UDEVVERSION=$(udevadm --version) +- +- for f in "$@"; do +- f="${initdir}/etc/udev/rules.d/$f" +- [ -e "$f" ] || continue +- while read line || [ -n "$line" ]; do +- if [ "${line%%IMPORT PATH_ID}" != "$line" ]; then +- if [ $UDEVVERSION -ge 174 ]; then +- printf '%sIMPORT{builtin}="path_id"\n' "${line%%IMPORT PATH_ID}" +- else +- printf '%sIMPORT{program}="path_id %%p"\n' "${line%%IMPORT PATH_ID}" +- fi +- elif [ "${line%%IMPORT BLKID}" != "$line" ]; then +- if [ $UDEVVERSION -ge 176 ]; then +- printf '%sIMPORT{builtin}="blkid"\n' "${line%%IMPORT BLKID}" +- else +- printf '%sIMPORT{program}="/sbin/blkid -o udev -p $tempnode"\n' "${line%%IMPORT BLKID}" +- fi +- else +- echo "$line" +- fi +- done < "${f}" > "${f}.new" +- mv "${f}.new" "$f" +- done +-} +- +-# install function specialized for hooks +-# $1 = type of hook, $2 = hook priority (lower runs first), $3 = hook +-# All hooks should be POSIX/SuS compliant, they will be sourced by init. +-inst_hook() { +- if ! [[ -f $3 ]]; then +- dfatal "Cannot install a hook ($3) that does not exist." +- dfatal "Aborting initrd creation." +- exit 1 +- elif ! [[ "$hookdirs" == *$1* ]]; then +- dfatal "No such hook type $1. Aborting initrd creation." +- exit 1 +- fi +- 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 +- [[ -e $f ]] || continue +- [[ $to ]] && inst "$f" "$to" && return 0 +- inst "$f" && return 0 +- done +- +- return 1 +-} +- +- +-# inst_libdir_file [-n ] [...] +-# Install a located on a lib directory to the initramfs image +-# -n install matching files +-inst_libdir_file() { +- local _files +- if [[ "$1" == "-n" ]]; then +- local _pattern=$2 +- shift 2 +- for _dir in $libdirs; do +- for _i in "$@"; do +- for _f in "$_dir"/$_i; do +- [[ "$_f" =~ $_pattern ]] || continue +- [[ -e "$_f" ]] && _files+="$_f " +- done +- done +- done +- else +- for _dir in $libdirs; do +- for _i in "$@"; do +- for _f in "$_dir"/$_i; do +- [[ -e "$_f" ]] && _files+="$_f " +- done +- done +- done +- fi +- [[ $_files ]] && inst_multiple $_files +-} +- +- +-# install function decompressing the target and handling symlinks +-# $@ = list of compressed (gz or bz2) files or symlinks pointing to such files +-# +-# Function install targets in the same paths inside overlay but decompressed +-# and without extensions (.gz, .bz2). +-inst_decompress() { +- local _src _cmd +- +- for _src in $@ +- do +- case ${_src} in +- *.gz) _cmd='gzip -f -d' ;; +- *.bz2) _cmd='bzip2 -d' ;; +- *) return 1 ;; +- esac +- inst_simple ${_src} +- # Decompress with chosen tool. We assume that tool changes name e.g. +- # from 'name.gz' to 'name'. +- ${_cmd} "${initdir}${_src}" +- done +-} +- +-# It's similar to above, but if file is not compressed, performs standard +-# install. +-# $@ = list of files +-inst_opt_decompress() { +- local _src +- +- for _src in $@; do +- inst_decompress "${_src}" || inst "${_src}" +- done +-} +- +-# module_check +-# execute the check() function of module-setup.sh of +-# or the "check" script, if module-setup.sh is not found +-# "check $hostonly" is called +-module_check() { +- local _moddir=$(echo ${dracutbasedir}/modules.d/??${1} | { read a b; echo "$a"; }) +- local _ret +- local _forced=0 +- local _hostonly=$hostonly +- [ $# -eq 2 ] && _forced=$2 +- [[ -d $_moddir ]] || return 1 +- if [[ ! -f $_moddir/module-setup.sh ]]; then +- # if we do not have a check script, we are unconditionally included +- [[ -x $_moddir/check ]] || return 0 +- [ $_forced -ne 0 ] && unset hostonly +- $_moddir/check $hostonly +- _ret=$? +- else +- unset check depends cmdline install installkernel +- check() { true; } +- . $_moddir/module-setup.sh +- is_func check || return 0 +- [ $_forced -ne 0 ] && unset hostonly +- moddir=$_moddir check $hostonly +- _ret=$? +- unset check depends cmdline install installkernel +- fi +- hostonly=$_hostonly +- return $_ret +-} +- +-# module_check_mount +-# execute the check() function of module-setup.sh of +-# or the "check" script, if module-setup.sh is not found +-# "mount_needs=1 check 0" is called +-module_check_mount() { +- local _moddir=$(echo ${dracutbasedir}/modules.d/??${1} | { read a b; echo "$a"; }) +- local _ret +- mount_needs=1 +- [[ -d $_moddir ]] || return 1 +- if [[ ! -f $_moddir/module-setup.sh ]]; then +- # if we do not have a check script, we are unconditionally included +- [[ -x $_moddir/check ]] || return 0 +- mount_needs=1 $_moddir/check 0 +- _ret=$? +- else +- unset check depends cmdline install installkernel +- check() { false; } +- . $_moddir/module-setup.sh +- moddir=$_moddir check 0 +- _ret=$? +- unset check depends cmdline install installkernel +- fi +- unset mount_needs +- return $_ret +-} +- +-# module_depends +-# execute the depends() function of module-setup.sh of +-# or the "depends" script, if module-setup.sh is not found +-module_depends() { +- local _moddir=$(echo ${dracutbasedir}/modules.d/??${1} | { read a b; echo "$a"; }) +- local _ret +- [[ -d $_moddir ]] || return 1 +- if [[ ! -f $_moddir/module-setup.sh ]]; then +- # if we do not have a check script, we have no deps +- [[ -x $_moddir/check ]] || return 0 +- $_moddir/check -d +- return $? +- else +- unset check depends cmdline install installkernel +- depends() { true; } +- . $_moddir/module-setup.sh +- moddir=$_moddir depends +- _ret=$? +- unset check depends cmdline install installkernel +- return $_ret +- fi +-} +- +-# module_cmdline +-# execute the cmdline() function of module-setup.sh of +-# or the "cmdline" script, if module-setup.sh is not found +-module_cmdline() { +- local _moddir=$(echo ${dracutbasedir}/modules.d/??${1} | { read a b; echo "$a"; }) +- local _ret +- [[ -d $_moddir ]] || return 1 +- if [[ ! -f $_moddir/module-setup.sh ]]; then +- [[ -x $_moddir/cmdline ]] && . "$_moddir/cmdline" +- return $? +- else +- unset check depends cmdline install installkernel +- cmdline() { true; } +- . $_moddir/module-setup.sh +- moddir=$_moddir cmdline +- _ret=$? +- unset check depends cmdline install installkernel +- return $_ret +- fi +-} +- +-# module_install +-# execute the install() function of module-setup.sh of +-# or the "install" script, if module-setup.sh is not found +-module_install() { +- local _moddir=$(echo ${dracutbasedir}/modules.d/??${1} | { read a b; echo "$a"; }) +- local _ret +- [[ -d $_moddir ]] || return 1 +- if [[ ! -f $_moddir/module-setup.sh ]]; then +- [[ -x $_moddir/install ]] && . "$_moddir/install" +- return $? +- else +- unset check depends cmdline install installkernel +- install() { true; } +- . $_moddir/module-setup.sh +- moddir=$_moddir install +- _ret=$? +- unset check depends cmdline install installkernel +- return $_ret +- fi +-} +- +-# module_installkernel +-# execute the installkernel() function of module-setup.sh of +-# or the "installkernel" script, if module-setup.sh is not found +-module_installkernel() { +- local _moddir=$(echo ${dracutbasedir}/modules.d/??${1} | { read a b; echo "$a"; }) +- local _ret +- [[ -d $_moddir ]] || return 1 +- if [[ ! -f $_moddir/module-setup.sh ]]; then +- [[ -x $_moddir/installkernel ]] && . "$_moddir/installkernel" +- return $? +- else +- unset check depends cmdline install installkernel +- installkernel() { true; } +- . $_moddir/module-setup.sh +- moddir=$_moddir installkernel +- _ret=$? +- unset check depends cmdline install installkernel +- return $_ret +- fi +-} +- +-# check_mount +-# check_mount checks, if a dracut module is needed for the given +-# device and filesystem types in "${host_fs_types[@]}" +-check_mount() { +- local _mod=$1 +- local _moddir=$(echo ${dracutbasedir}/modules.d/??${1} | { read a b; echo "$a"; }) +- local _ret +- local _moddep +- +- [ "${#host_fs_types[@]}" -le 0 ] && return 1 +- +- # If we are already scheduled to be loaded, no need to check again. +- [[ " $mods_to_load " == *\ $_mod\ * ]] && return 0 +- [[ " $mods_checked_as_dep " == *\ $_mod\ * ]] && return 1 +- +- # This should never happen, but... +- [[ -d $_moddir ]] || return 1 +- +- [[ $2 ]] || mods_checked_as_dep+=" $_mod " +- +- if [[ " $omit_dracutmodules " == *\ $_mod\ * ]]; then +- return 1 +- fi +- +- if [[ " $dracutmodules $add_dracutmodules $force_add_dracutmodules" == *\ $_mod\ * ]]; then +- module_check_mount $_mod; ret=$? +- +- # explicit module, so also accept ret=255 +- [[ $ret = 0 || $ret = 255 ]] || return 1 +- else +- # module not in our list +- if [[ $dracutmodules = all ]]; then +- # check, if we can and should install this module +- module_check_mount $_mod || return 1 +- else +- # skip this module +- return 1 +- fi +- fi +- +- for _moddep in $(module_depends $_mod); do +- # handle deps as if they were manually added +- [[ " $dracutmodules " == *\ $_mod\ * ]] \ +- && [[ " $dracutmodules " != *\ $_moddep\ * ]] \ +- && dracutmodules+=" $_moddep " +- [[ " $add_dracutmodules " == *\ $_mod\ * ]] \ +- && [[ " $add_dracutmodules " != *\ $_moddep\ * ]] \ +- && add_dracutmodules+=" $_moddep " +- [[ " $force_add_dracutmodules " == *\ $_mod\ * ]] \ +- && [[ " $force_add_dracutmodules " != *\ $_moddep\ * ]] \ +- && force_add_dracutmodules+=" $_moddep " +- # if a module we depend on fail, fail also +- if ! check_module $_moddep; then +- derror "dracut module '$_mod' depends on '$_moddep', which can't be installed" +- return 1 +- fi +- done +- +- [[ " $mods_to_load " == *\ $_mod\ * ]] || \ +- mods_to_load+=" $_mod " +- +- return 0 +-} +- +-# check_module [] +-# check if a dracut module is to be used in the initramfs process +-# if is set, then the process also keeps track +-# that the modules were checked for the dependency tracking process +-check_module() { +- local _mod=$1 +- local _moddir=$(echo ${dracutbasedir}/modules.d/??${1} | { read a b; echo "$a"; }) +- local _ret +- local _moddep +- # If we are already scheduled to be loaded, no need to check again. +- [[ " $mods_to_load " == *\ $_mod\ * ]] && return 0 +- [[ " $mods_checked_as_dep " == *\ $_mod\ * ]] && return 1 +- +- # This should never happen, but... +- [[ -d $_moddir ]] || return 1 +- +- [[ $2 ]] || mods_checked_as_dep+=" $_mod " +- +- if [[ " $omit_dracutmodules " == *\ $_mod\ * ]]; then +- dinfo "dracut module '$_mod' will not be installed, because it's in the list to be omitted!" +- return 1 +- fi +- +- if [[ " $dracutmodules $add_dracutmodules $force_add_dracutmodules" == *\ $_mod\ * ]]; then +- if [[ " $dracutmodules $force_add_dracutmodules " == *\ $_mod\ * ]]; then +- module_check $_mod 1; ret=$? +- else +- module_check $_mod 0; ret=$? +- fi +- # explicit module, so also accept ret=255 +- [[ $ret = 0 || $ret = 255 ]] || return 1 +- else +- # module not in our list +- if [[ $dracutmodules = all ]]; then +- # check, if we can and should install this module +- module_check $_mod; ret=$? +- if [[ $ret != 0 ]]; then +- [[ $2 ]] && return 1 +- [[ $ret != 255 ]] && return 1 +- fi +- else +- # skip this module +- return 1 +- fi +- fi +- +- for _moddep in $(module_depends $_mod); do +- # handle deps as if they were manually added +- [[ " $dracutmodules " == *\ $_mod\ * ]] \ +- && [[ " $dracutmodules " != *\ $_moddep\ * ]] \ +- && dracutmodules+=" $_moddep " +- [[ " $add_dracutmodules " == *\ $_mod\ * ]] \ +- && [[ " $add_dracutmodules " != *\ $_moddep\ * ]] \ +- && add_dracutmodules+=" $_moddep " +- [[ " $force_add_dracutmodules " == *\ $_mod\ * ]] \ +- && [[ " $force_add_dracutmodules " != *\ $_moddep\ * ]] \ +- && force_add_dracutmodules+=" $_moddep " +- # if a module we depend on fail, fail also +- if ! check_module $_moddep; then +- derror "dracut module '$_mod' depends on '$_moddep', which can't be installed" +- return 1 +- fi +- done +- +- [[ " $mods_to_load " == *\ $_mod\ * ]] || \ +- mods_to_load+=" $_mod " +- +- return 0 +-} +- +-# for_each_module_dir +-# execute " 1" +-for_each_module_dir() { +- local _modcheck +- local _mod +- local _moddir +- local _func +- _func=$1 +- for _moddir in "$dracutbasedir/modules.d"/[0-9][0-9]*; do +- [[ -d $_moddir ]] || continue; +- [[ -e $_moddir/install || -e $_moddir/installkernel || \ +- -e $_moddir/module-setup.sh ]] || continue +- _mod=${_moddir##*/}; _mod=${_mod#[0-9][0-9]} +- $_func $_mod 1 +- done +- +- # Report any missing dracut modules, the user has specified +- _modcheck="$add_dracutmodules $force_add_dracutmodules" +- [[ $dracutmodules != all ]] && _modcheck="$_modcheck $dracutmodules" +- for _mod in $_modcheck; do +- [[ " $mods_to_load " == *\ $_mod\ * ]] && continue +- +- [[ " $force_add_dracutmodules " != *\ $_mod\ * ]] \ +- && [[ " $dracutmodules " != *\ $_mod\ * ]] \ +- && [[ " $omit_dracutmodules " == *\ $_mod\ * ]] \ +- && continue +- +- derror "dracut module '$_mod' cannot be found or installed." +- [[ " $force_add_dracutmodules " == *\ $_mod\ * ]] && exit 1 +- [[ " $dracutmodules " == *\ $_mod\ * ]] && exit 1 +- [[ " $add_dracutmodules " == *\ $_mod\ * ]] && exit 1 +- done +-} +- +-# Install a single kernel module along with any firmware it may require. +-# $1 = full path to kernel module to install +-install_kmod_with_fw() { +- # no need to go further if the module is already installed +- +- [[ -e "${initdir}/lib/modules/$kernel/${1##*/lib/modules/$kernel/}" ]] \ +- && return 0 +- +- if [[ $DRACUT_KERNEL_LAZY_HASHDIR ]] && [[ -e "$DRACUT_KERNEL_LAZY_HASHDIR/${1##*/}" ]]; then +- read ret < "$DRACUT_KERNEL_LAZY_HASHDIR/${1##*/}" +- return $ret +- fi +- +- if [[ $omit_drivers ]]; then +- local _kmod=${1##*/} +- _kmod=${_kmod%.ko*} +- _kmod=${_kmod/-/_} +- if [[ "$_kmod" =~ $omit_drivers ]]; then +- dinfo "Omitting driver $_kmod" +- return 0 +- fi +- if [[ "${1##*/lib/modules/$kernel/}" =~ $omit_drivers ]]; then +- dinfo "Omitting driver $_kmod" +- return 0 +- fi +- fi +- +- if [[ $silent_omit_drivers ]]; then +- local _kmod=${1##*/} +- _kmod=${_kmod%.ko*} +- _kmod=${_kmod/-/_} +- [[ "$_kmod" =~ $silent_omit_drivers ]] && return 0 +- [[ "${1##*/lib/modules/$kernel/}" =~ $silent_omit_drivers ]] && return 0 +- fi +- +- inst_simple "$1" "/lib/modules/$kernel/${1##*/lib/modules/$kernel/}" +- ret=$? +- [[ $DRACUT_KERNEL_LAZY_HASHDIR ]] && \ +- [[ -d "$DRACUT_KERNEL_LAZY_HASHDIR" ]] && \ +- echo $ret > "$DRACUT_KERNEL_LAZY_HASHDIR/${1##*/}" +- (($ret != 0)) && return $ret +- +- 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 +- [[ -d $_fwdir && -f $_fwdir/$_fw ]] || continue +- inst_simple "$_fwdir/$_fw" "/lib/firmware/$_fw" +- _found=yes +- done +- if [[ $_found != yes ]]; then +- if ! [[ -d $(echo /sys/module/${_modname//-/_}|{ read a b; echo $a; }) ]]; then +- dinfo "Possible missing firmware \"${_fw}\" for kernel module" \ +- "\"${_modname}.ko\"" +- else +- dwarn "Possible missing firmware \"${_fw}\" for kernel module" \ +- "\"${_modname}.ko\"" +- fi +- fi +- done +- return 0 +-} +- +-# Do something with all the dependencies of a kernel module. +-# Note that kernel modules depend on themselves using the technique we use +-# $1 = function to call for each dependency we find +-# 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 +- shift 2 +- modprobe "$@" --ignore-install --show-depends $_kmod 2>&${_fderr} | ( +- while read _cmd _modpath _options || [ -n "$_cmd" ]; do +- [[ $_cmd = insmod ]] || continue +- $_func ${_modpath} || exit $? +- done +- ) +-} +- +-dracut_kernel_post() { +- local _moddirname=${srcmods%%/lib/modules/*} +- local _pid +- +- if [[ $DRACUT_KERNEL_LAZY_HASHDIR ]] && [[ -f "$DRACUT_KERNEL_LAZY_HASHDIR/lazylist" ]]; then +- xargs -r modprobe -a ${_moddirname:+-d ${_moddirname}/} \ +- --ignore-install --show-depends --set-version $kernel \ +- < "$DRACUT_KERNEL_LAZY_HASHDIR/lazylist" 2>/dev/null \ +- | sort -u \ +- | while read _cmd _modpath _options || [ -n "$_cmd" ]; do +- [[ $_cmd = insmod ]] || continue +- echo "$_modpath" +- done > "$DRACUT_KERNEL_LAZY_HASHDIR/lazylist.dep" +- +- ( +- if [[ $DRACUT_INSTALL ]] && [[ -z $_moddirname ]]; then +- xargs -r $DRACUT_INSTALL ${initdir:+-D "$initdir"} ${loginstall:+-L "$loginstall"} -a < "$DRACUT_KERNEL_LAZY_HASHDIR/lazylist.dep" +- else +- while read _modpath || [ -n "$_modpath" ]; do +- local _destpath=$_modpath +- [[ $_moddirname ]] && _destpath=${_destpath##$_moddirname/} +- _destpath=${_destpath##*/lib/modules/$kernel/} +- inst_simple "$_modpath" "/lib/modules/$kernel/${_destpath}" || exit $? +- done < "$DRACUT_KERNEL_LAZY_HASHDIR/lazylist.dep" +- fi +- ) & +- _pid=$(jobs -p | while read a || [ -n "$a" ]; do printf ":$a";done) +- _pid=${_pid##*:} +- +- if [[ $DRACUT_INSTALL ]]; then +- xargs -r modinfo -k $kernel -F firmware < "$DRACUT_KERNEL_LAZY_HASHDIR/lazylist.dep" \ +- | while read line || [ -n "$line" ]; do +- for _fwdir in $fw_dir; do +- echo $_fwdir/$line; +- done; +- done | xargs -r $DRACUT_INSTALL ${initdir:+-D "$initdir"} ${loginstall:+-L "$loginstall"} -a -o +- else +- for _fw in $(xargs -r modinfo -k $kernel -F firmware < "$DRACUT_KERNEL_LAZY_HASHDIR/lazylist.dep"); do +- for _fwdir in $fw_dir; do +- [[ -d $_fwdir && -f $_fwdir/$_fw ]] || continue +- inst_simple "$_fwdir/$_fw" "/lib/firmware/$_fw" +- break +- done +- done +- fi +- +- wait $_pid +- fi +- +- for _f in modules.builtin.bin modules.builtin modules.order; do +- [[ $srcmods/$_f ]] && inst_simple "$srcmods/$_f" "/lib/modules/$kernel/$_f" +- done +- +- # generate module dependencies for the initrd +- if [[ -d $initdir/lib/modules/$kernel ]] && \ +- ! depmod -a -b "$initdir" $kernel; then +- dfatal "\"depmod -a $kernel\" failed." +- exit 1 +- fi +- +- [[ $DRACUT_KERNEL_LAZY_HASHDIR ]] && rm -fr -- "$DRACUT_KERNEL_LAZY_HASHDIR" +-} +- +-[[ "$kernel_current" ]] || export kernel_current=$(uname -r) +- +-module_is_host_only() { +- local _mod=$1 +- local _modenc a i _k _s _v _aliases +- _mod=${_mod##*/} +- _mod=${_mod%.ko*} +- _modenc=${_mod//-/_} +- +- [[ " $add_drivers " == *\ ${_mod}\ * ]] && return 0 +- +- # check if module is loaded +- [[ ${host_modules["$_modenc"]} ]] && return 0 +- +- [[ "$kernel_current" ]] || export kernel_current=$(uname -r) +- +- if [[ "$kernel_current" != "$kernel" ]]; then +- # check if module is loadable on the current kernel +- # this covers the case, where a new module is introduced +- # or a module was renamed +- # or a module changed from builtin to a module +- +- if [[ -d /lib/modules/$kernel_current ]]; then +- # if the modinfo can be parsed, but the module +- # is not loaded, then we can safely return 1 +- modinfo -F filename "$_mod" &>/dev/null && return 1 +- fi +- +- _aliases=$(modinfo -k $kernel -F alias $_mod 2>/dev/null) +- +- # if the module has no aliases, install it +- [[ $_aliases ]] || return 0 +- +- # finally check all modalias +- for a in $_aliases; do +- for i in "${!host_modalias[@]}"; do +- [[ $i == $a ]] && return 0 +- done +- done +- +- fi +- +- return 1 +-} +- +-find_kernel_modules_by_path () { +- local _OLDIFS +- +- [[ -f "$srcmods/modules.dep" ]] || return 0 +- +- _OLDIFS=$IFS +- IFS=: +- while read a rest || [ -n "$a" ]; do +- [[ $a = */$1/* ]] || [[ $a = updates/* ]] || continue +- printf "%s\n" "$srcmods/$a" +- done < "$srcmods/modules.dep" +- IFS=$_OLDIFS +- return 0 +-} +- +-find_kernel_modules () { +- find_kernel_modules_by_path drivers +-} +- +-# instmods [-c [-s]] [ ... ] +-# instmods [-c [-s]] +-# install kernel modules along with all their dependencies. +-# can be e.g. "=block" or "=drivers/usb/storage" +-instmods() { +- [[ $no_kernel = yes ]] && return +- # called [sub]functions inherit _fderr +- local _fderr=9 +- local _check=no +- local _silent=no +- if [[ $1 = '-c' ]]; then +- _check=yes +- shift +- fi +- +- if [[ $1 = '-s' ]]; then +- _silent=yes +- shift +- fi +- +- function inst1mod() { +- local _ret=0 _mod="$1" +- case $_mod in +- =*) +- ( [[ "$_mpargs" ]] && echo $_mpargs +- find_kernel_modules_by_path "${_mod#=}" ) \ +- | instmods +- ((_ret+=$?)) +- ;; +- --*) _mpargs+=" $_mod" ;; +- *) +- _mod=${_mod##*/} +- # Check for aliased modules +- _modalias=$(modinfo -k $kernel -F filename $_mod 2> /dev/null) +- _modalias=${_modalias%.ko*} +- if [[ $_modalias ]] && [ "${_modalias##*/}" != "${_mod%.ko*}" ] ; then +- _mod=${_modalias##*/} +- fi +- +- # if we are already installed, skip this module and go on +- # to the next one. +- if [[ $DRACUT_KERNEL_LAZY_HASHDIR ]] && \ +- [[ -f "$DRACUT_KERNEL_LAZY_HASHDIR/${_mod%.ko*}" ]]; then +- read _ret <"$DRACUT_KERNEL_LAZY_HASHDIR/${_mod%.ko*}" +- return $_ret +- fi +- +- _mod=${_mod/-/_} +- if [[ $omit_drivers ]] && [[ "$_mod" =~ $omit_drivers ]]; then +- dinfo "Omitting driver ${_mod##$srcmods}" +- return 0 +- fi +- +- # If we are building a host-specific initramfs and this +- # module is not already loaded, move on to the next one. +- [[ $hostonly ]] \ +- && ! module_is_host_only "$_mod" \ +- && return 0 +- +- if [[ "$_check" = "yes" ]] || ! [[ $DRACUT_KERNEL_LAZY_HASHDIR ]]; then +- # 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. +- local _moddirname=${srcmods%%/lib/modules/*} +- [[ -n ${_moddirname} ]] && _moddirname="-d ${_moddirname}/" +- +- # 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} $_mpargs +- ((_ret+=$?)) +- else +- [[ $DRACUT_KERNEL_LAZY_HASHDIR ]] && \ +- echo ${_mod%.ko*} >> "$DRACUT_KERNEL_LAZY_HASHDIR/lazylist" +- fi +- ;; +- esac +- return $_ret +- } +- +- function instmods_1() { +- local _mod _mpargs +- if (($# == 0)); then # filenames from stdin +- while read _mod || [ -n "$_mod" ]; do +- inst1mod "${_mod%.ko*}" || { +- if [[ "$_check" == "yes" ]] && [[ "$_silent" == "no" ]]; then +- dfatal "Failed to install module $_mod" +- fi +- } +- done +- fi +- while (($# > 0)); do # filenames as arguments +- inst1mod ${1%.ko*} || { +- if [[ "$_check" == "yes" ]] && [[ "$_silent" == "no" ]]; then +- dfatal "Failed to install module $1" +- fi +- } +- shift +- done +- return 0 +- } +- +- local _ret _filter_not_found='FATAL: Module .* not found.' +- # 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" \ +- | while read line || [ -n "$line" ]; do [[ "$line" =~ $_filter_not_found ]] || echo $line;done | derror +- _ret=$? +- return $_ret +-} +- + check_kernel_config() + { + local _config_opt="$1" +diff --git a/dracut-init.sh b/dracut-init.sh +index 469e42a..d254e76 100644 +--- a/dracut-init.sh ++++ b/dracut-init.sh +@@ -1,6 +1,6 @@ + #!/bin/bash + # +-# functions used by dracut and other tools. ++# functions used only by dracut and dracut modules + # + # Copyright 2005-2009 Red Hat, Inc. All rights reserved. + # +@@ -19,6 +19,33 @@ + # + export LC_MESSAGES=C + ++# is_func ++# Check whether $1 is a function. ++is_func() { ++ [[ "$(type -t "$1")" = "function" ]] ++} ++ ++if ! [[ $dracutbasedir ]]; then ++ dracutbasedir=${BASH_SOURCE[0]%/*} ++ [[ $dracutbasedir = dracut-functions* ]] && dracutbasedir="." ++ [[ $dracutbasedir ]] || dracutbasedir="." ++ dracutbasedir="$(readlink -f $dracutbasedir)" ++fi ++ ++if ! is_func dinfo >/dev/null 2>&1; then ++ . "$dracutbasedir/dracut-logger.sh" ++ dlog_init ++fi ++ ++if ! [[ $initdir ]]; then ++ dfatal "initdir not set" ++ exit 1 ++fi ++ ++if ! [[ -d $initdir ]]; then ++ mkdir -p "$initdir" ++fi ++ + if [[ $DRACUT_KERNEL_LAZY ]] && ! [[ $DRACUT_KERNEL_LAZY_HASHDIR ]]; then + if ! [[ -d "$initdir/.kernelmodseen" ]]; then + mkdir -p "$initdir/.kernelmodseen" +@@ -26,9 +53,1118 @@ if [[ $DRACUT_KERNEL_LAZY ]] && ! [[ $DRACUT_KERNEL_LAZY_HASHDIR ]]; then + DRACUT_KERNEL_LAZY_HASHDIR="$initdir/.kernelmodseen" + fi + +-if [[ $initdir ]] && ! [[ -d $initdir ]]; then +- mkdir -p "$initdir" ++if ! [[ $kernel ]]; then ++ kernel=$(uname -r) ++ export kernel ++fi ++ ++srcmods="/lib/modules/$kernel/" ++ ++[[ $drivers_dir ]] && { ++ if ! command -v kmod &>/dev/null && vercmp "$(modprobe --version | cut -d' ' -f3)" lt 3.7; then ++ dfatal 'To use --kmoddir option module-init-tools >= 3.7 is required.' ++ exit 1 ++ fi ++ srcmods="$drivers_dir" ++} ++export srcmods ++ ++# export standard hookdirs ++[[ $hookdirs ]] || { ++ hookdirs="cmdline pre-udev pre-trigger netroot " ++ hookdirs+="initqueue initqueue/settled initqueue/online initqueue/finished initqueue/timeout " ++ hookdirs+="pre-mount pre-pivot cleanup mount " ++ hookdirs+="emergency shutdown-emergency pre-shutdown shutdown " ++ export hookdirs ++} ++ ++# Detect lib paths ++if ! [[ $libdirs ]] ; then ++ if [[ "$(ldd /bin/sh)" == */lib64/* ]] &>/dev/null \ ++ && [[ -d /lib64 ]]; then ++ libdirs+=" /lib64" ++ [[ -d /usr/lib64 ]] && libdirs+=" /usr/lib64" ++ else ++ libdirs+=" /lib" ++ [[ -d /usr/lib ]] && libdirs+=" /usr/lib" ++ fi ++ ++ libdirs+=" $(ldconfig_paths)" ++ ++ export libdirs + fi + +-[[ $dracutbasedir ]] || export dracutbasedir=${BASH_SOURCE%/*} + . $dracutbasedir/dracut-functions.sh ++ ++# helper function for check() in module-setup.sh ++# to check for required installed binaries ++# issues a standardized warning message ++require_binaries() { ++ local _module_name="${moddir##*/}" ++ local _ret=0 ++ ++ if [[ "$1" = "-m" ]]; then ++ _module_name="$2" ++ shift 2 ++ fi ++ ++ for cmd in "$@"; do ++ if ! find_binary "$cmd" &>/dev/null; then ++ dinfo "dracut module '${_module_name#[0-9][0-9]}' will not be installed, because command '$cmd' could not be found!" ++ ((_ret++)) ++ fi ++ done ++ return $_ret ++} ++ ++require_any_binary() { ++ local _module_name="${moddir##*/}" ++ local _ret=1 ++ ++ if [[ "$1" = "-m" ]]; then ++ _module_name="$2" ++ shift 2 ++ fi ++ ++ for cmd in "$@"; do ++ if find_binary "$cmd" &>/dev/null; then ++ _ret=0 ++ break ++ fi ++ done ++ ++ if (( $_ret != 0 )); then ++ dinfo "$_module_name: Could not find any command of '$@'!" ++ return 1 ++ fi ++ ++ return 0 ++} ++ ++dracut_need_initqueue() { ++ >"$initdir/lib/dracut/need-initqueue" ++} ++ ++dracut_module_included() { ++ [[ " $mods_to_load $modules_loaded " == *\ $*\ * ]] ++} ++ ++if ! [[ $DRACUT_INSTALL ]]; then ++ DRACUT_INSTALL=$(find_binary dracut-install) ++fi ++ ++if ! [[ $DRACUT_INSTALL ]] && [[ -x $dracutbasedir/dracut-install ]]; then ++ DRACUT_INSTALL=$dracutbasedir/dracut-install ++elif ! [[ $DRACUT_INSTALL ]] && [[ -x $dracutbasedir/install/dracut-install ]]; then ++ DRACUT_INSTALL=$dracutbasedir/install/dracut-install ++fi ++ ++if ! [[ -x $DRACUT_INSTALL ]]; then ++ dfatal "dracut-install not found!" ++ exit 10 ++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 "$@" || : ++} ++ ++inst() { ++ local _hostonly_install ++ if [[ "$1" == "-H" ]]; then ++ _hostonly_install="-H" ++ shift ++ fi ++ [[ -e ${initdir}/"${2:-$1}" ]] && return 0 # already there ++ $DRACUT_INSTALL ${initdir:+-D "$initdir"} ${loginstall:+-L "$loginstall"} ${DRACUT_RESOLVE_DEPS:+-l} ${DRACUT_FIPS_MODE:+-f} ${_hostonly_install:+-H} "$@" ++ (($? != 0)) && derror $DRACUT_INSTALL ${initdir:+-D "$initdir"} ${loginstall:+-L "$loginstall"} ${DRACUT_RESOLVE_DEPS:+-l} ${DRACUT_FIPS_MODE:+-f} ${_hostonly_install:+-H} "$@" || : ++} ++ ++inst_simple() { ++ local _hostonly_install ++ if [[ "$1" == "-H" ]]; then ++ _hostonly_install="-H" ++ shift ++ fi ++ [[ -e ${initdir}/"${2:-$1}" ]] && return 0 # already there ++ [[ -e $1 ]] || return 1 # no source ++ $DRACUT_INSTALL ${initdir:+-D "$initdir"} ${loginstall:+-L "$loginstall"} ${_hostonly_install:+-H} "$@" ++ (($? != 0)) && derror $DRACUT_INSTALL ${initdir:+-D "$initdir"} ${loginstall:+-L "$loginstall"} ${_hostonly_install:+-H} "$@" || : ++} ++ ++inst_symlink() { ++ local _hostonly_install ++ if [[ "$1" == "-H" ]]; then ++ _hostonly_install="-H" ++ shift ++ fi ++ [[ -e ${initdir}/"${2:-$1}" ]] && return 0 # already there ++ [[ -L $1 ]] || return 1 ++ $DRACUT_INSTALL ${initdir:+-D "$initdir"} ${loginstall:+-L "$loginstall"} ${DRACUT_RESOLVE_DEPS:+-l} ${DRACUT_FIPS_MODE:+-f} ${_hostonly_install:+-H} "$@" ++ (($? != 0)) && derror $DRACUT_INSTALL ${initdir:+-D "$initdir"} ${loginstall:+-L "$loginstall"} ${DRACUT_RESOLVE_DEPS:+-l} ${DRACUT_FIPS_MODE:+-f} ${_hostonly_install:+-H} "$@" || : ++} ++ ++inst_multiple() { ++ local _ret ++ $DRACUT_INSTALL ${initdir:+-D "$initdir"} -a ${loginstall:+-L "$loginstall"} ${DRACUT_RESOLVE_DEPS:+-l} ${DRACUT_FIPS_MODE:+-f} "$@" ++ _ret=$? ++ (($_ret != 0)) && derror $DRACUT_INSTALL ${initdir:+-D "$initdir"} -a ${loginstall:+-L "$loginstall"} ${DRACUT_RESOLVE_DEPS:+-l} ${DRACUT_FIPS_MODE:+-f} ${_hostonly_install:+-H} "$@" || : ++ return $_ret ++} ++ ++dracut_install() { ++ inst_multiple "$@" ++} ++ ++inst_library() { ++ local _hostonly_install ++ if [[ "$1" == "-H" ]]; then ++ _hostonly_install="-H" ++ shift ++ fi ++ [[ -e ${initdir}/"${2:-$1}" ]] && return 0 # already there ++ [[ -e $1 ]] || return 1 # no source ++ $DRACUT_INSTALL ${initdir:+-D "$initdir"} ${loginstall:+-L "$loginstall"} ${DRACUT_RESOLVE_DEPS:+-l} ${DRACUT_FIPS_MODE:+-f} ${_hostonly_install:+-H} "$@" ++ (($? != 0)) && derror $DRACUT_INSTALL ${initdir:+-D "$initdir"} ${loginstall:+-L "$loginstall"} ${DRACUT_RESOLVE_DEPS:+-l} ${DRACUT_FIPS_MODE:+-f} ${_hostonly_install:+-H} "$@" || : ++} ++ ++inst_binary() { ++ $DRACUT_INSTALL ${initdir:+-D "$initdir"} ${loginstall:+-L "$loginstall"} ${DRACUT_RESOLVE_DEPS:+-l} ${DRACUT_FIPS_MODE:+-f} "$@" ++ (($? != 0)) && derror $DRACUT_INSTALL ${initdir:+-D "$initdir"} ${loginstall:+-L "$loginstall"} ${DRACUT_RESOLVE_DEPS:+-l} ${DRACUT_FIPS_MODE:+-f} "$@" || : ++} ++ ++inst_script() { ++ $DRACUT_INSTALL ${initdir:+-D "$initdir"} ${loginstall:+-L "$loginstall"} ${DRACUT_RESOLVE_DEPS:+-l} ${DRACUT_FIPS_MODE:+-f} "$@" ++ (($? != 0)) && derror $DRACUT_INSTALL ${initdir:+-D "$initdir"} ${loginstall:+-L "$loginstall"} ${DRACUT_RESOLVE_DEPS:+-l} ${DRACUT_FIPS_MODE:+-f} "$@" || : ++} ++ ++mark_hostonly() { ++ for i in "$@"; do ++ echo "$i" >> "$initdir/lib/dracut/hostonly-files" ++ done ++} ++ ++# find symlinks linked to given library file ++# $1 = library file ++# Function searches for symlinks by stripping version numbers appended to ++# library filename, checks if it points to the same target and finally ++# prints the list of symlinks to stdout. ++# ++# Example: ++# rev_lib_symlinks libfoo.so.8.1 ++# output: libfoo.so.8 libfoo.so ++# (Only if libfoo.so.8 and libfoo.so exists on host system.) ++rev_lib_symlinks() { ++ [[ ! $1 ]] && return 0 ++ ++ local fn="$1" orig="$(readlink -f "$1")" links='' ++ ++ [[ ${fn} == *.so.* ]] || return 1 ++ ++ until [[ ${fn##*.} == so ]]; do ++ fn="${fn%.*}" ++ [[ -L ${fn} && $(readlink -f "${fn}") == ${orig} ]] && links+=" ${fn}" ++ done ++ ++ echo "${links}" ++} ++ ++# attempt to install any programs specified in a udev rule ++inst_rule_programs() { ++ local _prog _bin ++ ++ if grep -qE 'PROGRAM==?"[^ "]+' "$1"; then ++ for _prog in $(grep -E 'PROGRAM==?"[^ "]+' "$1" | sed -r 's/.*PROGRAM==?"([^ "]+).*/\1/'); do ++ _bin="" ++ if [ -x ${udevdir}/$_prog ]; then ++ _bin=${udevdir}/$_prog ++ elif [[ "${_prog/\$env\{/}" == "$_prog" ]]; then ++ _bin=$(find_binary "$_prog") || { ++ dinfo "Skipping program $_prog using in udev rule ${1##*/} as it cannot be found" ++ continue; ++ } ++ fi ++ ++ [[ $_bin ]] && inst_binary "$_bin" ++ done ++ fi ++ if grep -qE 'RUN[+=]=?"[^ "]+' "$1"; then ++ for _prog in $(grep -E 'RUN[+=]=?"[^ "]+' "$1" | sed -r 's/.*RUN[+=]=?"([^ "]+).*/\1/'); do ++ _bin="" ++ if [ -x ${udevdir}/$_prog ]; then ++ _bin=${udevdir}/$_prog ++ elif [[ "${_prog/\$env\{/}" == "$_prog" ]] && [[ "${_prog}" != "/sbin/initqueue" ]]; then ++ _bin=$(find_binary "$_prog") || { ++ dinfo "Skipping program $_prog using in udev rule ${1##*/} as it cannot be found" ++ continue; ++ } ++ fi ++ ++ [[ $_bin ]] && inst_binary "$_bin" ++ done ++ fi ++ if grep -qE 'IMPORT\{program\}==?"[^ "]+' "$1"; then ++ for _prog in $(grep -E 'IMPORT\{program\}==?"[^ "]+' "$1" | sed -r 's/.*IMPORT\{program\}==?"([^ "]+).*/\1/'); do ++ _bin="" ++ if [ -x ${udevdir}/$_prog ]; then ++ _bin=${udevdir}/$_prog ++ elif [[ "${_prog/\$env\{/}" == "$_prog" ]]; then ++ _bin=$(find_binary "$_prog") || { ++ dinfo "Skipping program $_prog using in udev rule ${1##*/} as it cannot be found" ++ continue; ++ } ++ fi ++ ++ [[ $_bin ]] && dracut_install "$_bin" ++ done ++ fi ++} ++ ++# attempt to install any programs specified in a udev rule ++inst_rule_group_owner() { ++ local i ++ ++ if grep -qE 'OWNER=?"[^ "]+' "$1"; then ++ for i in $(grep -E 'OWNER=?"[^ "]+' "$1" | sed -r 's/.*OWNER=?"([^ "]+).*/\1/'); do ++ if ! egrep -q "^$i:" "$initdir/etc/passwd" 2>/dev/null; then ++ egrep "^$i:" /etc/passwd 2>/dev/null >> "$initdir/etc/passwd" ++ fi ++ done ++ fi ++ if grep -qE 'GROUP=?"[^ "]+' "$1"; then ++ for i in $(grep -E 'GROUP=?"[^ "]+' "$1" | sed -r 's/.*GROUP=?"([^ "]+).*/\1/'); do ++ if ! egrep -q "^$i:" "$initdir/etc/group" 2>/dev/null; then ++ egrep "^$i:" /etc/group 2>/dev/null >> "$initdir/etc/group" ++ fi ++ done ++ fi ++} ++ ++inst_rule_initqueue() { ++ if grep -q -F initqueue "$1"; then ++ dracut_need_initqueue ++ fi ++} ++ ++# udev rules always get installed in the same place, so ++# create a function to install them to make life simpler. ++inst_rules() { ++ local _target=/etc/udev/rules.d _rule _found ++ ++ inst_dir "${udevdir}/rules.d" ++ inst_dir "$_target" ++ for _rule in "$@"; do ++ if [ "${_rule#/}" = "$_rule" ]; then ++ for r in ${udevdir}/rules.d ${hostonly:+/etc/udev/rules.d}; do ++ [[ -e $r/$_rule ]] || continue ++ _found="$r/$_rule" ++ inst_rule_programs "$_found" ++ inst_rule_group_owner "$_found" ++ inst_rule_initqueue "$_found" ++ inst_simple "$_found" ++ done ++ fi ++ for r in '' $dracutbasedir/rules.d/; do ++ # skip rules without an absolute path ++ [[ "${r}$_rule" != /* ]] && continue ++ [[ -f ${r}$_rule ]] || continue ++ _found="${r}$_rule" ++ inst_rule_programs "$_found" ++ inst_rule_group_owner "$_found" ++ inst_rule_initqueue "$_found" ++ inst_simple "$_found" "$_target/${_found##*/}" ++ done ++ [[ $_found ]] || dinfo "Skipping udev rule: $_rule" ++ done ++} ++ ++inst_rules_wildcard() { ++ local _target=/etc/udev/rules.d _rule _found ++ ++ inst_dir "${udevdir}/rules.d" ++ inst_dir "$_target" ++ for _rule in ${udevdir}/rules.d/$1 ${dracutbasedir}/rules.d/$1 ; do ++ [[ -e $_rule ]] || continue ++ inst_rule_programs "$_rule" ++ inst_rule_group_owner "$_rule" ++ inst_rule_initqueue "$_rule" ++ inst_simple "$_rule" ++ _found=$_rule ++ done ++ if [[ -n ${hostonly} ]] ; then ++ for _rule in ${_target}/$1 ; do ++ [[ -f $_rule ]] || continue ++ inst_rule_programs "$_rule" ++ inst_rule_group_owner "$_rule" ++ inst_rule_initqueue "$_rule" ++ inst_simple "$_rule" ++ _found=$_rule ++ done ++ fi ++ [[ $_found ]] || dinfo "Skipping udev rule: $_rule" ++} ++ ++prepare_udev_rules() { ++ [ -z "$UDEVVERSION" ] && export UDEVVERSION=$(udevadm --version) ++ ++ for f in "$@"; do ++ f="${initdir}/etc/udev/rules.d/$f" ++ [ -e "$f" ] || continue ++ while read line || [ -n "$line" ]; do ++ if [ "${line%%IMPORT PATH_ID}" != "$line" ]; then ++ if [ $UDEVVERSION -ge 174 ]; then ++ printf '%sIMPORT{builtin}="path_id"\n' "${line%%IMPORT PATH_ID}" ++ else ++ printf '%sIMPORT{program}="path_id %%p"\n' "${line%%IMPORT PATH_ID}" ++ fi ++ elif [ "${line%%IMPORT BLKID}" != "$line" ]; then ++ if [ $UDEVVERSION -ge 176 ]; then ++ printf '%sIMPORT{builtin}="blkid"\n' "${line%%IMPORT BLKID}" ++ else ++ printf '%sIMPORT{program}="/sbin/blkid -o udev -p $tempnode"\n' "${line%%IMPORT BLKID}" ++ fi ++ else ++ echo "$line" ++ fi ++ done < "${f}" > "${f}.new" ++ mv "${f}.new" "$f" ++ done ++} ++ ++# install function specialized for hooks ++# $1 = type of hook, $2 = hook priority (lower runs first), $3 = hook ++# All hooks should be POSIX/SuS compliant, they will be sourced by init. ++inst_hook() { ++ if ! [[ -f $3 ]]; then ++ dfatal "Cannot install a hook ($3) that does not exist." ++ dfatal "Aborting initrd creation." ++ exit 1 ++ elif ! [[ "$hookdirs" == *$1* ]]; then ++ dfatal "No such hook type $1. Aborting initrd creation." ++ exit 1 ++ fi ++ 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 ++ [[ -e $f ]] || continue ++ [[ $to ]] && inst "$f" "$to" && return 0 ++ inst "$f" && return 0 ++ done ++ ++ return 1 ++} ++ ++ ++# inst_libdir_file [-n ] [...] ++# Install a located on a lib directory to the initramfs image ++# -n install matching files ++inst_libdir_file() { ++ local _files ++ if [[ "$1" == "-n" ]]; then ++ local _pattern=$2 ++ shift 2 ++ for _dir in $libdirs; do ++ for _i in "$@"; do ++ for _f in "$_dir"/$_i; do ++ [[ "$_f" =~ $_pattern ]] || continue ++ [[ -e "$_f" ]] && _files+="$_f " ++ done ++ done ++ done ++ else ++ for _dir in $libdirs; do ++ for _i in "$@"; do ++ for _f in "$_dir"/$_i; do ++ [[ -e "$_f" ]] && _files+="$_f " ++ done ++ done ++ done ++ fi ++ [[ $_files ]] && inst_multiple $_files ++} ++ ++ ++# install function decompressing the target and handling symlinks ++# $@ = list of compressed (gz or bz2) files or symlinks pointing to such files ++# ++# Function install targets in the same paths inside overlay but decompressed ++# and without extensions (.gz, .bz2). ++inst_decompress() { ++ local _src _cmd ++ ++ for _src in $@ ++ do ++ case ${_src} in ++ *.gz) _cmd='gzip -f -d' ;; ++ *.bz2) _cmd='bzip2 -d' ;; ++ *) return 1 ;; ++ esac ++ inst_simple ${_src} ++ # Decompress with chosen tool. We assume that tool changes name e.g. ++ # from 'name.gz' to 'name'. ++ ${_cmd} "${initdir}${_src}" ++ done ++} ++ ++# It's similar to above, but if file is not compressed, performs standard ++# install. ++# $@ = list of files ++inst_opt_decompress() { ++ local _src ++ ++ for _src in $@; do ++ inst_decompress "${_src}" || inst "${_src}" ++ done ++} ++ ++# module_check ++# execute the check() function of module-setup.sh of ++# or the "check" script, if module-setup.sh is not found ++# "check $hostonly" is called ++module_check() { ++ local _moddir=$(echo ${dracutbasedir}/modules.d/??${1} | { read a b; echo "$a"; }) ++ local _ret ++ local _forced=0 ++ local _hostonly=$hostonly ++ [ $# -eq 2 ] && _forced=$2 ++ [[ -d $_moddir ]] || return 1 ++ if [[ ! -f $_moddir/module-setup.sh ]]; then ++ # if we do not have a check script, we are unconditionally included ++ [[ -x $_moddir/check ]] || return 0 ++ [ $_forced -ne 0 ] && unset hostonly ++ $_moddir/check $hostonly ++ _ret=$? ++ else ++ unset check depends cmdline install installkernel ++ check() { true; } ++ . $_moddir/module-setup.sh ++ is_func check || return 0 ++ [ $_forced -ne 0 ] && unset hostonly ++ moddir=$_moddir check $hostonly ++ _ret=$? ++ unset check depends cmdline install installkernel ++ fi ++ hostonly=$_hostonly ++ return $_ret ++} ++ ++# module_check_mount ++# execute the check() function of module-setup.sh of ++# or the "check" script, if module-setup.sh is not found ++# "mount_needs=1 check 0" is called ++module_check_mount() { ++ local _moddir=$(echo ${dracutbasedir}/modules.d/??${1} | { read a b; echo "$a"; }) ++ local _ret ++ mount_needs=1 ++ [[ -d $_moddir ]] || return 1 ++ if [[ ! -f $_moddir/module-setup.sh ]]; then ++ # if we do not have a check script, we are unconditionally included ++ [[ -x $_moddir/check ]] || return 0 ++ mount_needs=1 $_moddir/check 0 ++ _ret=$? ++ else ++ unset check depends cmdline install installkernel ++ check() { false; } ++ . $_moddir/module-setup.sh ++ moddir=$_moddir check 0 ++ _ret=$? ++ unset check depends cmdline install installkernel ++ fi ++ unset mount_needs ++ return $_ret ++} ++ ++# module_depends ++# execute the depends() function of module-setup.sh of ++# or the "depends" script, if module-setup.sh is not found ++module_depends() { ++ local _moddir=$(echo ${dracutbasedir}/modules.d/??${1} | { read a b; echo "$a"; }) ++ local _ret ++ [[ -d $_moddir ]] || return 1 ++ if [[ ! -f $_moddir/module-setup.sh ]]; then ++ # if we do not have a check script, we have no deps ++ [[ -x $_moddir/check ]] || return 0 ++ $_moddir/check -d ++ return $? ++ else ++ unset check depends cmdline install installkernel ++ depends() { true; } ++ . $_moddir/module-setup.sh ++ moddir=$_moddir depends ++ _ret=$? ++ unset check depends cmdline install installkernel ++ return $_ret ++ fi ++} ++ ++# module_cmdline ++# execute the cmdline() function of module-setup.sh of ++# or the "cmdline" script, if module-setup.sh is not found ++module_cmdline() { ++ local _moddir=$(echo ${dracutbasedir}/modules.d/??${1} | { read a b; echo "$a"; }) ++ local _ret ++ [[ -d $_moddir ]] || return 1 ++ if [[ ! -f $_moddir/module-setup.sh ]]; then ++ [[ -x $_moddir/cmdline ]] && . "$_moddir/cmdline" ++ return $? ++ else ++ unset check depends cmdline install installkernel ++ cmdline() { true; } ++ . $_moddir/module-setup.sh ++ moddir=$_moddir cmdline ++ _ret=$? ++ unset check depends cmdline install installkernel ++ return $_ret ++ fi ++} ++ ++# module_install ++# execute the install() function of module-setup.sh of ++# or the "install" script, if module-setup.sh is not found ++module_install() { ++ local _moddir=$(echo ${dracutbasedir}/modules.d/??${1} | { read a b; echo "$a"; }) ++ local _ret ++ [[ -d $_moddir ]] || return 1 ++ if [[ ! -f $_moddir/module-setup.sh ]]; then ++ [[ -x $_moddir/install ]] && . "$_moddir/install" ++ return $? ++ else ++ unset check depends cmdline install installkernel ++ install() { true; } ++ . $_moddir/module-setup.sh ++ moddir=$_moddir install ++ _ret=$? ++ unset check depends cmdline install installkernel ++ return $_ret ++ fi ++} ++ ++# module_installkernel ++# execute the installkernel() function of module-setup.sh of ++# or the "installkernel" script, if module-setup.sh is not found ++module_installkernel() { ++ local _moddir=$(echo ${dracutbasedir}/modules.d/??${1} | { read a b; echo "$a"; }) ++ local _ret ++ [[ -d $_moddir ]] || return 1 ++ if [[ ! -f $_moddir/module-setup.sh ]]; then ++ [[ -x $_moddir/installkernel ]] && . "$_moddir/installkernel" ++ return $? ++ else ++ unset check depends cmdline install installkernel ++ installkernel() { true; } ++ . $_moddir/module-setup.sh ++ moddir=$_moddir installkernel ++ _ret=$? ++ unset check depends cmdline install installkernel ++ return $_ret ++ fi ++} ++ ++# check_mount ++# check_mount checks, if a dracut module is needed for the given ++# device and filesystem types in "${host_fs_types[@]}" ++check_mount() { ++ local _mod=$1 ++ local _moddir=$(echo ${dracutbasedir}/modules.d/??${1} | { read a b; echo "$a"; }) ++ local _ret ++ local _moddep ++ ++ [ "${#host_fs_types[@]}" -le 0 ] && return 1 ++ ++ # If we are already scheduled to be loaded, no need to check again. ++ [[ " $mods_to_load " == *\ $_mod\ * ]] && return 0 ++ [[ " $mods_checked_as_dep " == *\ $_mod\ * ]] && return 1 ++ ++ # This should never happen, but... ++ [[ -d $_moddir ]] || return 1 ++ ++ [[ $2 ]] || mods_checked_as_dep+=" $_mod " ++ ++ if [[ " $omit_dracutmodules " == *\ $_mod\ * ]]; then ++ return 1 ++ fi ++ ++ if [[ " $dracutmodules $add_dracutmodules $force_add_dracutmodules" == *\ $_mod\ * ]]; then ++ module_check_mount $_mod; ret=$? ++ ++ # explicit module, so also accept ret=255 ++ [[ $ret = 0 || $ret = 255 ]] || return 1 ++ else ++ # module not in our list ++ if [[ $dracutmodules = all ]]; then ++ # check, if we can and should install this module ++ module_check_mount $_mod || return 1 ++ else ++ # skip this module ++ return 1 ++ fi ++ fi ++ ++ for _moddep in $(module_depends $_mod); do ++ # handle deps as if they were manually added ++ [[ " $dracutmodules " == *\ $_mod\ * ]] \ ++ && [[ " $dracutmodules " != *\ $_moddep\ * ]] \ ++ && dracutmodules+=" $_moddep " ++ [[ " $add_dracutmodules " == *\ $_mod\ * ]] \ ++ && [[ " $add_dracutmodules " != *\ $_moddep\ * ]] \ ++ && add_dracutmodules+=" $_moddep " ++ [[ " $force_add_dracutmodules " == *\ $_mod\ * ]] \ ++ && [[ " $force_add_dracutmodules " != *\ $_moddep\ * ]] \ ++ && force_add_dracutmodules+=" $_moddep " ++ # if a module we depend on fail, fail also ++ if ! check_module $_moddep; then ++ derror "dracut module '$_mod' depends on '$_moddep', which can't be installed" ++ return 1 ++ fi ++ done ++ ++ [[ " $mods_to_load " == *\ $_mod\ * ]] || \ ++ mods_to_load+=" $_mod " ++ ++ return 0 ++} ++ ++# check_module [] ++# check if a dracut module is to be used in the initramfs process ++# if is set, then the process also keeps track ++# that the modules were checked for the dependency tracking process ++check_module() { ++ local _mod=$1 ++ local _moddir=$(echo ${dracutbasedir}/modules.d/??${1} | { read a b; echo "$a"; }) ++ local _ret ++ local _moddep ++ # If we are already scheduled to be loaded, no need to check again. ++ [[ " $mods_to_load " == *\ $_mod\ * ]] && return 0 ++ [[ " $mods_checked_as_dep " == *\ $_mod\ * ]] && return 1 ++ ++ # This should never happen, but... ++ [[ -d $_moddir ]] || return 1 ++ ++ [[ $2 ]] || mods_checked_as_dep+=" $_mod " ++ ++ if [[ " $omit_dracutmodules " == *\ $_mod\ * ]]; then ++ dinfo "dracut module '$_mod' will not be installed, because it's in the list to be omitted!" ++ return 1 ++ fi ++ ++ if [[ " $dracutmodules $add_dracutmodules $force_add_dracutmodules" == *\ $_mod\ * ]]; then ++ if [[ " $dracutmodules $force_add_dracutmodules " == *\ $_mod\ * ]]; then ++ module_check $_mod 1; ret=$? ++ else ++ module_check $_mod 0; ret=$? ++ fi ++ # explicit module, so also accept ret=255 ++ [[ $ret = 0 || $ret = 255 ]] || return 1 ++ else ++ # module not in our list ++ if [[ $dracutmodules = all ]]; then ++ # check, if we can and should install this module ++ module_check $_mod; ret=$? ++ if [[ $ret != 0 ]]; then ++ [[ $2 ]] && return 1 ++ [[ $ret != 255 ]] && return 1 ++ fi ++ else ++ # skip this module ++ return 1 ++ fi ++ fi ++ ++ for _moddep in $(module_depends $_mod); do ++ # handle deps as if they were manually added ++ [[ " $dracutmodules " == *\ $_mod\ * ]] \ ++ && [[ " $dracutmodules " != *\ $_moddep\ * ]] \ ++ && dracutmodules+=" $_moddep " ++ [[ " $add_dracutmodules " == *\ $_mod\ * ]] \ ++ && [[ " $add_dracutmodules " != *\ $_moddep\ * ]] \ ++ && add_dracutmodules+=" $_moddep " ++ [[ " $force_add_dracutmodules " == *\ $_mod\ * ]] \ ++ && [[ " $force_add_dracutmodules " != *\ $_moddep\ * ]] \ ++ && force_add_dracutmodules+=" $_moddep " ++ # if a module we depend on fail, fail also ++ if ! check_module $_moddep; then ++ derror "dracut module '$_mod' depends on '$_moddep', which can't be installed" ++ return 1 ++ fi ++ done ++ ++ [[ " $mods_to_load " == *\ $_mod\ * ]] || \ ++ mods_to_load+=" $_mod " ++ ++ return 0 ++} ++ ++# for_each_module_dir ++# execute " 1" ++for_each_module_dir() { ++ local _modcheck ++ local _mod ++ local _moddir ++ local _func ++ _func=$1 ++ for _moddir in "$dracutbasedir/modules.d"/[0-9][0-9]*; do ++ [[ -d $_moddir ]] || continue; ++ [[ -e $_moddir/install || -e $_moddir/installkernel || \ ++ -e $_moddir/module-setup.sh ]] || continue ++ _mod=${_moddir##*/}; _mod=${_mod#[0-9][0-9]} ++ $_func $_mod 1 ++ done ++ ++ # Report any missing dracut modules, the user has specified ++ _modcheck="$add_dracutmodules $force_add_dracutmodules" ++ [[ $dracutmodules != all ]] && _modcheck="$_modcheck $dracutmodules" ++ for _mod in $_modcheck; do ++ [[ " $mods_to_load " == *\ $_mod\ * ]] && continue ++ ++ [[ " $force_add_dracutmodules " != *\ $_mod\ * ]] \ ++ && [[ " $dracutmodules " != *\ $_mod\ * ]] \ ++ && [[ " $omit_dracutmodules " == *\ $_mod\ * ]] \ ++ && continue ++ ++ derror "dracut module '$_mod' cannot be found or installed." ++ [[ " $force_add_dracutmodules " == *\ $_mod\ * ]] && exit 1 ++ [[ " $dracutmodules " == *\ $_mod\ * ]] && exit 1 ++ [[ " $add_dracutmodules " == *\ $_mod\ * ]] && exit 1 ++ done ++} ++ ++# Install a single kernel module along with any firmware it may require. ++# $1 = full path to kernel module to install ++install_kmod_with_fw() { ++ # no need to go further if the module is already installed ++ ++ [[ -e "${initdir}/lib/modules/$kernel/${1##*/lib/modules/$kernel/}" ]] \ ++ && return 0 ++ ++ if [[ $DRACUT_KERNEL_LAZY_HASHDIR ]] && [[ -e "$DRACUT_KERNEL_LAZY_HASHDIR/${1##*/}" ]]; then ++ read ret < "$DRACUT_KERNEL_LAZY_HASHDIR/${1##*/}" ++ return $ret ++ fi ++ ++ if [[ $omit_drivers ]]; then ++ local _kmod=${1##*/} ++ _kmod=${_kmod%.ko*} ++ _kmod=${_kmod/-/_} ++ if [[ "$_kmod" =~ $omit_drivers ]]; then ++ dinfo "Omitting driver $_kmod" ++ return 0 ++ fi ++ if [[ "${1##*/lib/modules/$kernel/}" =~ $omit_drivers ]]; then ++ dinfo "Omitting driver $_kmod" ++ return 0 ++ fi ++ fi ++ ++ if [[ $silent_omit_drivers ]]; then ++ local _kmod=${1##*/} ++ _kmod=${_kmod%.ko*} ++ _kmod=${_kmod/-/_} ++ [[ "$_kmod" =~ $silent_omit_drivers ]] && return 0 ++ [[ "${1##*/lib/modules/$kernel/}" =~ $silent_omit_drivers ]] && return 0 ++ fi ++ ++ inst_simple "$1" "/lib/modules/$kernel/${1##*/lib/modules/$kernel/}" ++ ret=$? ++ [[ $DRACUT_KERNEL_LAZY_HASHDIR ]] && \ ++ [[ -d "$DRACUT_KERNEL_LAZY_HASHDIR" ]] && \ ++ echo $ret > "$DRACUT_KERNEL_LAZY_HASHDIR/${1##*/}" ++ (($ret != 0)) && return $ret ++ ++ 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 ++ [[ -d $_fwdir && -f $_fwdir/$_fw ]] || continue ++ inst_simple "$_fwdir/$_fw" "/lib/firmware/$_fw" ++ _found=yes ++ done ++ if [[ $_found != yes ]]; then ++ if ! [[ -d $(echo /sys/module/${_modname//-/_}|{ read a b; echo $a; }) ]]; then ++ dinfo "Possible missing firmware \"${_fw}\" for kernel module" \ ++ "\"${_modname}.ko\"" ++ else ++ dwarn "Possible missing firmware \"${_fw}\" for kernel module" \ ++ "\"${_modname}.ko\"" ++ fi ++ fi ++ done ++ return 0 ++} ++ ++# Do something with all the dependencies of a kernel module. ++# Note that kernel modules depend on themselves using the technique we use ++# $1 = function to call for each dependency we find ++# 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 ++ shift 2 ++ modprobe "$@" --ignore-install --show-depends $_kmod 2>&${_fderr} | ( ++ while read _cmd _modpath _options || [ -n "$_cmd" ]; do ++ [[ $_cmd = insmod ]] || continue ++ $_func ${_modpath} || exit $? ++ done ++ ) ++} ++ ++dracut_kernel_post() { ++ local _moddirname=${srcmods%%/lib/modules/*} ++ local _pid ++ ++ if [[ $DRACUT_KERNEL_LAZY_HASHDIR ]] && [[ -f "$DRACUT_KERNEL_LAZY_HASHDIR/lazylist" ]]; then ++ xargs -r modprobe -a ${_moddirname:+-d ${_moddirname}/} \ ++ --ignore-install --show-depends --set-version $kernel \ ++ < "$DRACUT_KERNEL_LAZY_HASHDIR/lazylist" 2>/dev/null \ ++ | sort -u \ ++ | while read _cmd _modpath _options || [ -n "$_cmd" ]; do ++ [[ $_cmd = insmod ]] || continue ++ echo "$_modpath" ++ done > "$DRACUT_KERNEL_LAZY_HASHDIR/lazylist.dep" ++ ++ ( ++ if [[ $DRACUT_INSTALL ]] && [[ -z $_moddirname ]]; then ++ xargs -r $DRACUT_INSTALL ${initdir:+-D "$initdir"} ${loginstall:+-L "$loginstall"} -a < "$DRACUT_KERNEL_LAZY_HASHDIR/lazylist.dep" ++ else ++ while read _modpath || [ -n "$_modpath" ]; do ++ local _destpath=$_modpath ++ [[ $_moddirname ]] && _destpath=${_destpath##$_moddirname/} ++ _destpath=${_destpath##*/lib/modules/$kernel/} ++ inst_simple "$_modpath" "/lib/modules/$kernel/${_destpath}" || exit $? ++ done < "$DRACUT_KERNEL_LAZY_HASHDIR/lazylist.dep" ++ fi ++ ) & ++ _pid=$(jobs -p | while read a || [ -n "$a" ]; do printf ":$a";done) ++ _pid=${_pid##*:} ++ ++ if [[ $DRACUT_INSTALL ]]; then ++ xargs -r modinfo -k $kernel -F firmware < "$DRACUT_KERNEL_LAZY_HASHDIR/lazylist.dep" \ ++ | while read line || [ -n "$line" ]; do ++ for _fwdir in $fw_dir; do ++ echo $_fwdir/$line; ++ done; ++ done | xargs -r $DRACUT_INSTALL ${initdir:+-D "$initdir"} ${loginstall:+-L "$loginstall"} -a -o ++ else ++ for _fw in $(xargs -r modinfo -k $kernel -F firmware < "$DRACUT_KERNEL_LAZY_HASHDIR/lazylist.dep"); do ++ for _fwdir in $fw_dir; do ++ [[ -d $_fwdir && -f $_fwdir/$_fw ]] || continue ++ inst_simple "$_fwdir/$_fw" "/lib/firmware/$_fw" ++ break ++ done ++ done ++ fi ++ ++ wait $_pid ++ fi ++ ++ for _f in modules.builtin.bin modules.builtin modules.order; do ++ [[ $srcmods/$_f ]] && inst_simple "$srcmods/$_f" "/lib/modules/$kernel/$_f" ++ done ++ ++ # generate module dependencies for the initrd ++ if [[ -d $initdir/lib/modules/$kernel ]] && \ ++ ! depmod -a -b "$initdir" $kernel; then ++ dfatal "\"depmod -a $kernel\" failed." ++ exit 1 ++ fi ++ ++ [[ $DRACUT_KERNEL_LAZY_HASHDIR ]] && rm -fr -- "$DRACUT_KERNEL_LAZY_HASHDIR" ++} ++ ++[[ "$kernel_current" ]] || export kernel_current=$(uname -r) ++ ++module_is_host_only() { ++ local _mod=$1 ++ local _modenc a i _k _s _v _aliases ++ _mod=${_mod##*/} ++ _mod=${_mod%.ko*} ++ _modenc=${_mod//-/_} ++ ++ [[ " $add_drivers " == *\ ${_mod}\ * ]] && return 0 ++ ++ # check if module is loaded ++ [[ ${host_modules["$_modenc"]} ]] && return 0 ++ ++ [[ "$kernel_current" ]] || export kernel_current=$(uname -r) ++ ++ if [[ "$kernel_current" != "$kernel" ]]; then ++ # check if module is loadable on the current kernel ++ # this covers the case, where a new module is introduced ++ # or a module was renamed ++ # or a module changed from builtin to a module ++ ++ if [[ -d /lib/modules/$kernel_current ]]; then ++ # if the modinfo can be parsed, but the module ++ # is not loaded, then we can safely return 1 ++ modinfo -F filename "$_mod" &>/dev/null && return 1 ++ fi ++ ++ _aliases=$(modinfo -k $kernel -F alias $_mod 2>/dev/null) ++ ++ # if the module has no aliases, install it ++ [[ $_aliases ]] || return 0 ++ ++ # finally check all modalias ++ for a in $_aliases; do ++ for i in "${!host_modalias[@]}"; do ++ [[ $i == $a ]] && return 0 ++ done ++ done ++ ++ fi ++ ++ return 1 ++} ++ ++find_kernel_modules_by_path () { ++ local _OLDIFS ++ ++ [[ -f "$srcmods/modules.dep" ]] || return 0 ++ ++ _OLDIFS=$IFS ++ IFS=: ++ while read a rest || [ -n "$a" ]; do ++ [[ $a = */$1/* ]] || [[ $a = updates/* ]] || continue ++ printf "%s\n" "$srcmods/$a" ++ done < "$srcmods/modules.dep" ++ IFS=$_OLDIFS ++ return 0 ++} ++ ++find_kernel_modules () { ++ find_kernel_modules_by_path drivers ++} ++ ++# instmods [-c [-s]] [ ... ] ++# instmods [-c [-s]] ++# install kernel modules along with all their dependencies. ++# can be e.g. "=block" or "=drivers/usb/storage" ++instmods() { ++ [[ $no_kernel = yes ]] && return ++ # called [sub]functions inherit _fderr ++ local _fderr=9 ++ local _check=no ++ local _silent=no ++ if [[ $1 = '-c' ]]; then ++ _check=yes ++ shift ++ fi ++ ++ if [[ $1 = '-s' ]]; then ++ _silent=yes ++ shift ++ fi ++ ++ function inst1mod() { ++ local _ret=0 _mod="$1" ++ case $_mod in ++ =*) ++ ( [[ "$_mpargs" ]] && echo $_mpargs ++ find_kernel_modules_by_path "${_mod#=}" ) \ ++ | instmods ++ ((_ret+=$?)) ++ ;; ++ --*) _mpargs+=" $_mod" ;; ++ *) ++ _mod=${_mod##*/} ++ # Check for aliased modules ++ _modalias=$(modinfo -k $kernel -F filename $_mod 2> /dev/null) ++ _modalias=${_modalias%.ko*} ++ if [[ $_modalias ]] && [ "${_modalias##*/}" != "${_mod%.ko*}" ] ; then ++ _mod=${_modalias##*/} ++ fi ++ ++ # if we are already installed, skip this module and go on ++ # to the next one. ++ if [[ $DRACUT_KERNEL_LAZY_HASHDIR ]] && \ ++ [[ -f "$DRACUT_KERNEL_LAZY_HASHDIR/${_mod%.ko*}" ]]; then ++ read _ret <"$DRACUT_KERNEL_LAZY_HASHDIR/${_mod%.ko*}" ++ return $_ret ++ fi ++ ++ _mod=${_mod/-/_} ++ if [[ $omit_drivers ]] && [[ "$_mod" =~ $omit_drivers ]]; then ++ dinfo "Omitting driver ${_mod##$srcmods}" ++ return 0 ++ fi ++ ++ # If we are building a host-specific initramfs and this ++ # module is not already loaded, move on to the next one. ++ [[ $hostonly ]] \ ++ && ! module_is_host_only "$_mod" \ ++ && return 0 ++ ++ if [[ "$_check" = "yes" ]] || ! [[ $DRACUT_KERNEL_LAZY_HASHDIR ]]; then ++ # 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. ++ local _moddirname=${srcmods%%/lib/modules/*} ++ [[ -n ${_moddirname} ]] && _moddirname="-d ${_moddirname}/" ++ ++ # 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} $_mpargs ++ ((_ret+=$?)) ++ else ++ [[ $DRACUT_KERNEL_LAZY_HASHDIR ]] && \ ++ echo ${_mod%.ko*} >> "$DRACUT_KERNEL_LAZY_HASHDIR/lazylist" ++ fi ++ ;; ++ esac ++ return $_ret ++ } ++ ++ function instmods_1() { ++ local _mod _mpargs ++ if (($# == 0)); then # filenames from stdin ++ while read _mod || [ -n "$_mod" ]; do ++ inst1mod "${_mod%.ko*}" || { ++ if [[ "$_check" == "yes" ]] && [[ "$_silent" == "no" ]]; then ++ dfatal "Failed to install module $_mod" ++ fi ++ } ++ done ++ fi ++ while (($# > 0)); do # filenames as arguments ++ inst1mod ${1%.ko*} || { ++ if [[ "$_check" == "yes" ]] && [[ "$_silent" == "no" ]]; then ++ dfatal "Failed to install module $1" ++ fi ++ } ++ shift ++ done ++ return 0 ++ } ++ ++ local _ret _filter_not_found='FATAL: Module .* not found.' ++ # 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" \ ++ | while read line || [ -n "$line" ]; do [[ "$line" =~ $_filter_not_found ]] || echo $line;done | derror ++ _ret=$? ++ return $_ret ++} diff --git a/0157-repro-squash.patch b/0157-repro-squash.patch new file mode 100644 index 0000000..7595e1d --- /dev/null +++ b/0157-repro-squash.patch @@ -0,0 +1,23 @@ +From 4a6c14f9875da2373f21cafadfe32c7c9acb39d6 Mon Sep 17 00:00:00 2001 +From: Harald Hoyer +Date: Fri, 13 Nov 2015 13:14:05 +0100 +Subject: [PATCH] repro squash + +--- + dracut.8.asc | 3 +++ + 1 file changed, 3 insertions(+) + +diff --git a/dracut.8.asc b/dracut.8.asc +index 1fbbda4..5f45ed9 100644 +--- a/dracut.8.asc ++++ b/dracut.8.asc +@@ -428,6 +428,9 @@ will not be able to boot. + **--reproducible**:: + Create reproducible images. + ++**--no-reproducible**:: ++ Do not create reproducible images. ++ + **--list-modules**:: + List all available dracut modules. + diff --git a/0158-iscsi-iscsiroot.sh-put-variables-in-quotes.patch b/0158-iscsi-iscsiroot.sh-put-variables-in-quotes.patch new file mode 100644 index 0000000..e3b87b1 --- /dev/null +++ b/0158-iscsi-iscsiroot.sh-put-variables-in-quotes.patch @@ -0,0 +1,109 @@ +From 98e9db275596577b649caa73f8580429f3abb8f4 Mon Sep 17 00:00:00 2001 +From: Harald Hoyer +Date: Fri, 13 Nov 2015 13:15:05 +0100 +Subject: [PATCH] iscsi/iscsiroot.sh: put variables in quotes + +best practice +--- + modules.d/95iscsi/iscsiroot.sh | 48 +++++++++++++++++++++--------------------- + 1 file changed, 24 insertions(+), 24 deletions(-) + +diff --git a/modules.d/95iscsi/iscsiroot.sh b/modules.d/95iscsi/iscsiroot.sh +index 5752cce..8a98881 100755 +--- a/modules.d/95iscsi/iscsiroot.sh ++++ b/modules.d/95iscsi/iscsiroot.sh +@@ -109,7 +109,7 @@ handle_netroot() + getarg rw && iscsirw=rw + fsopts=${fsopts:+$fsopts,}${iscsirw} + +- if [ -z $iscsi_initiator ] && [ -f /sys/firmware/ibft/initiator/initiator-name ] && ! [ -f /tmp/iscsi_set_initiator ]; then ++ if [ -z "$iscsi_initiator" ] && [ -f /sys/firmware/ibft/initiator/initiator-name ] && ! [ -f /tmp/iscsi_set_initiator ]; then + iscsi_initiator=$(while read line || [ -n "$line" ]; do echo $line;done < /sys/firmware/ibft/initiator/initiator-name) + echo "InitiatorName=$iscsi_initiator" > /run/initiatorname.iscsi + rm -f /etc/iscsi/initiatorname.iscsi +@@ -120,14 +120,14 @@ handle_netroot() + > /tmp/iscsi_set_initiator + fi + +- if [ -z $iscsi_initiator ]; then ++ if [ -z "$iscsi_initiator" ]; then + [ -f /run/initiatorname.iscsi ] && . /run/initiatorname.iscsi + [ -f /etc/initiatorname.iscsi ] && . /etc/initiatorname.iscsi + [ -f /etc/iscsi/initiatorname.iscsi ] && . /etc/iscsi/initiatorname.iscsi + iscsi_initiator=$InitiatorName + fi + +- if [ -z $iscsi_initiator ]; then ++ if [ -z "$iscsi_initiator" ]; then + iscsi_initiator=$(iscsi-iname) + echo "InitiatorName=$iscsi_initiator" > /run/initiatorname.iscsi + rm -f /etc/iscsi/initiatorname.iscsi +@@ -140,15 +140,15 @@ handle_netroot() + fi + + +- if [ -z $iscsi_target_port ]; then ++ if [ -z "$iscsi_target_port" ]; then + iscsi_target_port=3260 + fi + +- if [ -z $iscsi_target_group ]; then ++ if [ -z "$iscsi_target_group" ]; then + iscsi_target_group=1 + fi + +- if [ -z $iscsi_lun ]; then ++ if [ -z "$iscsi_lun" ]; then + iscsi_lun=0 + fi + +@@ -182,15 +182,15 @@ handle_netroot() + --description="Login iSCSI Target $iscsi_target_name" \ + --unit="$netroot_enc" -- \ + $(command -v iscsistart) \ +- -i $iscsi_initiator -t $iscsi_target_name \ +- -g $iscsi_target_group -a $iscsi_target_ip \ +- -p $iscsi_target_port \ +- ${iscsi_username:+-u $iscsi_username} \ +- ${iscsi_password:+-w $iscsi_password} \ +- ${iscsi_in_username:+-U $iscsi_in_username} \ +- ${iscsi_in_password:+-W $iscsi_in_password} \ +- ${iscsi_iface_name:+--param iface.iscsi_ifacename=$iscsi_iface_name} \ +- ${iscsi_netdev_name:+--param iface.net_ifacename=$iscsi_netdev_name} \ ++ -i "$iscsi_initiator" -t "$iscsi_target_name" \ ++ -g "$iscsi_target_group" -a "$iscsi_target_ip" \ ++ -p "$iscsi_target_port" \ ++ ${iscsi_username:+-u "$iscsi_username"} \ ++ ${iscsi_password:+-w "$iscsi_password"} \ ++ ${iscsi_in_username:+-U "$iscsi_in_username"} \ ++ ${iscsi_in_password:+-W "$iscsi_in_password"} \ ++ ${iscsi_iface_name:+--param "iface.iscsi_ifacename=$iscsi_iface_name"} \ ++ ${iscsi_netdev_name:+--param "iface.net_ifacename=$iscsi_netdev_name"} \ + ${iscsi_param} >/dev/null 2>&1 \ + && { > $hookdir/initqueue/work ; } + else +@@ -199,15 +199,15 @@ handle_netroot() + fi + fi + else +- iscsistart -i $iscsi_initiator -t $iscsi_target_name \ +- -g $iscsi_target_group -a $iscsi_target_ip \ +- -p $iscsi_target_port \ +- ${iscsi_username:+-u $iscsi_username} \ +- ${iscsi_password:+-w $iscsi_password} \ +- ${iscsi_in_username:+-U $iscsi_in_username} \ +- ${iscsi_in_password:+-W $iscsi_in_password} \ +- ${iscsi_iface_name:+--param iface.iscsi_ifacename=$iscsi_iface_name} \ +- ${iscsi_netdev_name:+--param iface.net_ifacename=$iscsi_netdev_name} \ ++ iscsistart -i "$iscsi_initiator" -t "$iscsi_target_name" \ ++ -g "$iscsi_target_group" -a "$iscsi_target_ip" \ ++ -p "$iscsi_target_port" \ ++ ${iscsi_username:+-u "$iscsi_username"} \ ++ ${iscsi_password:+-w "$iscsi_password"} \ ++ ${iscsi_in_username:+-U "$iscsi_in_username"} \ ++ ${iscsi_in_password:+-W "$iscsi_in_password"} \ ++ ${iscsi_iface_name:+--param "iface.iscsi_ifacename=$iscsi_iface_name"} \ ++ ${iscsi_netdev_name:+--param "iface.net_ifacename=$iscsi_netdev_name"} \ + ${iscsi_param} \ + && { > $hookdir/initqueue/work ; } + fi diff --git a/0159-iscsi-only-systemctl-try-restart-iscsid-if-systemd-i.patch b/0159-iscsi-only-systemctl-try-restart-iscsid-if-systemd-i.patch new file mode 100644 index 0000000..e0239b8 --- /dev/null +++ b/0159-iscsi-only-systemctl-try-restart-iscsid-if-systemd-i.patch @@ -0,0 +1,86 @@ +From ed92ecaa3cafa890583e22377c5f5014a332e59f Mon Sep 17 00:00:00 2001 +From: Harald Hoyer +Date: Fri, 13 Nov 2015 13:16:10 +0100 +Subject: [PATCH] iscsi: only systemctl try-restart iscsid, if systemd is used + +--- + modules.d/95iscsi/iscsiroot.sh | 20 +++++++++++++++----- + modules.d/95iscsi/parse-iscsiroot.sh | 11 ++++++++++- + 2 files changed, 25 insertions(+), 6 deletions(-) + +diff --git a/modules.d/95iscsi/iscsiroot.sh b/modules.d/95iscsi/iscsiroot.sh +index 8a98881..38cbc5e 100755 +--- a/modules.d/95iscsi/iscsiroot.sh ++++ b/modules.d/95iscsi/iscsiroot.sh +@@ -115,9 +115,12 @@ handle_netroot() + rm -f /etc/iscsi/initiatorname.iscsi + mkdir -p /etc/iscsi + ln -fs /run/initiatorname.iscsi /etc/iscsi/initiatorname.iscsi +- systemctl restart iscsid +- sleep 1 + > /tmp/iscsi_set_initiator ++ if [ -n "$DRACUT_SYSTEMD" ]; then ++ systemctl try-restart iscsid ++ # FIXME: iscsid is not yet ready, when the service is :-/ ++ sleep 1 ++ fi + fi + + if [ -z "$iscsi_initiator" ]; then +@@ -133,10 +136,12 @@ handle_netroot() + rm -f /etc/iscsi/initiatorname.iscsi + mkdir -p /etc/iscsi + ln -fs /run/initiatorname.iscsi /etc/iscsi/initiatorname.iscsi +- systemctl restart iscsid + > /tmp/iscsi_set_initiator +- # FIXME: iscsid is not yet ready, when the service is :-/ +- sleep 1 ++ if [ -n "$DRACUT_SYSTEMD" ]; then ++ systemctl try-restart iscsid ++ # FIXME: iscsid is not yet ready, when the service is :-/ ++ sleep 1 ++ fi + fi + + +@@ -157,6 +162,11 @@ handle_netroot() + if ! [ -e /etc/iscsi/initiatorname.iscsi ]; then + mkdir -p /etc/iscsi + ln -fs /run/initiatorname.iscsi /etc/iscsi/initiatorname.iscsi ++ if [ -n "$DRACUT_SYSTEMD" ]; then ++ systemctl try-restart iscsid ++ # FIXME: iscsid is not yet ready, when the service is :-/ ++ sleep 1 ++ fi + fi + # FIXME $iscsi_protocol?? + +diff --git a/modules.d/95iscsi/parse-iscsiroot.sh b/modules.d/95iscsi/parse-iscsiroot.sh +index 971bab2..1d62b03 100755 +--- a/modules.d/95iscsi/parse-iscsiroot.sh ++++ b/modules.d/95iscsi/parse-iscsiroot.sh +@@ -108,6 +108,11 @@ if arg=$(getarg rd.iscsi.initiator -d iscsi_initiator=) && [ -n "$arg" ] && ! [ + if ! [ -e /etc/iscsi/initiatorname.iscsi ]; then + mkdir -p /etc/iscsi + ln -fs /run/initiatorname.iscsi /etc/iscsi/initiatorname.iscsi ++ if [ -n "$DRACUT_SYSTEMD" ]; then ++ systemctl try-restart iscsid ++ # FIXME: iscsid is not yet ready, when the service is :-/ ++ sleep 1 ++ fi + fi + fi + +@@ -120,7 +125,11 @@ if [ -z $iscsi_initiator ] && [ -f /sys/firmware/ibft/initiator/initiator-name ] + mkdir -p /etc/iscsi + ln -fs /run/initiatorname.iscsi /etc/iscsi/initiatorname.iscsi + > /tmp/iscsi_set_initiator +- systemctl try-restart iscsid && sleep 1 ++ if [ -n "$DRACUT_SYSTEMD" ]; then ++ systemctl try-restart iscsid ++ # FIXME: iscsid is not yet ready, when the service is :-/ ++ sleep 1 ++ fi + fi + fi + diff --git a/0160-Add-awk-and-getopt-as-dependencies-of-znetconf.patch b/0160-Add-awk-and-getopt-as-dependencies-of-znetconf.patch new file mode 100644 index 0000000..25b9997 --- /dev/null +++ b/0160-Add-awk-and-getopt-as-dependencies-of-znetconf.patch @@ -0,0 +1,34 @@ +From dcc2a4344b064ab91a0a89baa2453244de78ceb4 Mon Sep 17 00:00:00 2001 +From: Mei Liu +Date: Tue, 10 Nov 2015 12:34:24 +0800 +Subject: [PATCH] Add awk and getopt as dependencies of znetconf + +znetconf command is part of s390utils-base package. It depends on +awk and getopt. + +This patch is used to fix the following error: + +dracut:/# +znetconf -c + +/usr/sbin/znetconf: line 70: awk: command not found +/usr/sbin/znetconf: line 1138: getopt: command not found + +Signed-off-by: Mei Liu +--- + modules.d/80cms/module-setup.sh | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/modules.d/80cms/module-setup.sh b/modules.d/80cms/module-setup.sh +index 1afac16..05c93e5 100755 +--- a/modules.d/80cms/module-setup.sh ++++ b/modules.d/80cms/module-setup.sh +@@ -27,7 +27,7 @@ install() { + inst_script "$moddir/cmsifup.sh" /sbin/cmsifup + inst_multiple /etc/cmsfs-fuse/filetypes.conf /etc/udev/rules.d/99-fuse.rules /etc/fuse.conf \ + cmsfs-fuse fusermount ulockmgr_server bash insmod rmmod cat normalize_dasd_arg sed \ +- $(rpm -ql s390utils-base) ++ $(rpm -ql s390utils-base) awk getopt + + inst_libdir_file "gconv/*" + #inst /usr/lib/locale/locale-archive diff --git a/0161-dracut.sh-Support-mount-with-just-mountpoint-as-para.patch b/0161-dracut.sh-Support-mount-with-just-mountpoint-as-para.patch new file mode 100644 index 0000000..ef95f68 --- /dev/null +++ b/0161-dracut.sh-Support-mount-with-just-mountpoint-as-para.patch @@ -0,0 +1,63 @@ +From edbd9ca058bcb19f351aca470581db1a67b706d7 Mon Sep 17 00:00:00 2001 +From: Fabian +Date: Fri, 11 Sep 2015 13:35:57 +0200 +Subject: [PATCH] dracut.sh: Support --mount with just mountpoint as parameter + +Right now the --mount parameter of dracut expects a rather long fstab-like +line. This makes it possible to invoke dracut with e.g. --mount /boot. +--- + dracut.8.asc | 4 ++++ + dracut.sh | 16 +++++++++++++++- + 2 files changed, 19 insertions(+), 1 deletion(-) + +diff --git a/dracut.8.asc b/dracut.8.asc +index 5f45ed9..d22c1cb 100644 +--- a/dracut.8.asc ++++ b/dracut.8.asc +@@ -338,6 +338,10 @@ provide a valid _/etc/fstab_. + The default __ is "0". + the default __ is "2". + ++**--mount** "__":: ++ Like above, but __, __ and __ ++ are determined by looking at the current mounts. ++ + **--add-device** __ :: + Bring up __ in initramfs, __ should be the device name. + This can be useful in hostonly mode for resume support when your swap is on +diff --git a/dracut.sh b/dracut.sh +index fb5d400..52a628a 100755 +--- a/dracut.sh ++++ b/dracut.sh +@@ -160,6 +160,8 @@ Creates initial ramdisk images for preloading modules + --mount "[DEV] [MP] [FSTYPE] [FSOPTS]" + Mount device [DEV] on mountpoint [MP] with filesystem + [FSTYPE] and options [FSOPTS] in the initramfs ++ --mount "[MP]" Same as above, but [DEV], [FSTYPE] and [FSOPTS] are ++ determined by looking at the current mounts. + --add-device "[DEV]" Bring up [DEV] in initramfs + -i, --include [SOURCE] [TARGET] + Include the files in the SOURCE directory into the +@@ -1469,9 +1471,21 @@ if [[ $kernel_only != yes ]]; then + + for line in "${fstab_lines[@]}"; do + line=($line) +- [ -z "${line[3]}" ] && line[3]="defaults" ++ ++ if [ -z "${line[1]}" ]; then ++ # Determine device and mount options from current system ++ mountpoint -q "${line[0]}" || derror "${line[0]} is not a mount point!" ++ line=($(findmnt --raw -n --target "${line[0]}" --output=source,target,fstype,options)) ++ dinfo "Line for ${line[1]}: ${line[@]}" ++ else ++ # Use default options ++ [ -z "${line[3]}" ] && line[3]="defaults" ++ fi ++ ++ # Default options for freq and passno + [ -z "${line[4]}" ] && line[4]="0" + [ -z "${line[5]}" ] && line[5]="2" ++ + strstr "${line[2]}" "nfs" && line[5]="0" + echo "${line[@]}" >> "${initdir}/etc/fstab" + done diff --git a/0162-Revert-Change-the-implementation-of-action_on_fail.patch b/0162-Revert-Change-the-implementation-of-action_on_fail.patch new file mode 100644 index 0000000..515c596 --- /dev/null +++ b/0162-Revert-Change-the-implementation-of-action_on_fail.patch @@ -0,0 +1,97 @@ +From 74c9fb947b265f30f4190ce77269ec0cd0e73925 Mon Sep 17 00:00:00 2001 +From: "dyoung@redhat.com" +Date: Mon, 31 Aug 2015 10:43:15 +0800 +Subject: [PATCH] Revert "Change the implementation of action_on_fail" + +This reverts commit d2765b5175663d094737d6819cc3f3df53e7a4cb. + +action_on_fail is useless thus remove the commits for it one by one. + +Signed-off-by: Dave Young +--- + dracut.cmdline.7.asc | 4 ++++ + .../98dracut-systemd/dracut-emergency.service | 2 +- + modules.d/98dracut-systemd/emergency.service | 2 +- + modules.d/99base/dracut-lib.sh | 28 ++++++++++++++-------- + 4 files changed, 24 insertions(+), 12 deletions(-) + +diff --git a/dracut.cmdline.7.asc b/dracut.cmdline.7.asc +index d790afd..ad99799 100644 +--- a/dracut.cmdline.7.asc ++++ b/dracut.cmdline.7.asc +@@ -159,6 +159,10 @@ Misc + specify the controlling terminal for the console. + This is useful, if you have multiple "console=" arguments. + ++**rd.action_on_fail=**_{shell|continue}_:: ++ Specify the action after failure. By default it's emergency_shell. ++ 'continue' means: ignore the current failure and go ahead. ++ + [[dracutkerneldebug]] + Debug + ~~~~~ +diff --git a/modules.d/98dracut-systemd/dracut-emergency.service b/modules.d/98dracut-systemd/dracut-emergency.service +index 5a6d525..a4b81bc 100644 +--- a/modules.d/98dracut-systemd/dracut-emergency.service ++++ b/modules.d/98dracut-systemd/dracut-emergency.service +@@ -13,7 +13,7 @@ DefaultDependencies=no + After=systemd-vconsole-setup.service + Wants=systemd-vconsole-setup.service + Conflicts=emergency.service emergency.target +-ConditionPathExists=!/lib/dracut/no-emergency-shell ++ConditionKernelCommandLine=!action_on_fail=continue + + [Service] + Environment=HOME=/ +diff --git a/modules.d/98dracut-systemd/emergency.service b/modules.d/98dracut-systemd/emergency.service +index 5f1eaa2..c19fe37 100644 +--- a/modules.d/98dracut-systemd/emergency.service ++++ b/modules.d/98dracut-systemd/emergency.service +@@ -12,7 +12,7 @@ Description=Emergency Shell + DefaultDependencies=no + After=systemd-vconsole-setup.service + Wants=systemd-vconsole-setup.service +-ConditionPathExists=!/lib/dracut/no-emergency-shell ++ConditionKernelCommandLine=!action_on_fail=continue + + [Service] + Environment=HOME=/ +diff --git a/modules.d/99base/dracut-lib.sh b/modules.d/99base/dracut-lib.sh +index 03a283c..cc5bb42 100755 +--- a/modules.d/99base/dracut-lib.sh ++++ b/modules.d/99base/dracut-lib.sh +@@ -1143,16 +1143,24 @@ emergency_shell() + + action_on_fail() + { +- if [ -f "$initdir/lib/dracut/no-emergency-shell" ]; then +- [ "$1" = "-n" ] && shift 2 +- [ "$1" = "--shutdown" ] && shift 2 +- warn "$*" +- warn "Not dropping to emergency shell, because $initdir/lib/dracut/no-emergency-shell exists." +- return 0 +- fi +- +- emergency_shell $@ +- return 1 ++ local _action=$(getarg rd.action_on_fail= -d action_on_fail=) ++ case "$_action" in ++ continue) ++ [ "$1" = "-n" ] && shift 2 ++ [ "$1" = "--shutdown" ] && shift 2 ++ warn "$*" ++ warn "Not dropping to emergency shell, because 'action_on_fail=continue' was set on the kernel command line." ++ return 0 ++ ;; ++ shell) ++ emergency_shell $@ ++ return 1 ++ ;; ++ *) ++ emergency_shell $@ ++ return 1 ++ ;; ++ esac + } + + # Retain the values of these variables but ensure that they are unexported diff --git a/0163-Revert-rename-kernel-command-line-param-action_on_fa.patch b/0163-Revert-rename-kernel-command-line-param-action_on_fa.patch new file mode 100644 index 0000000..d3310ef --- /dev/null +++ b/0163-Revert-rename-kernel-command-line-param-action_on_fa.patch @@ -0,0 +1,42 @@ +From 927d1e28c9ad63794df6c1a21c2e7b7bca8d86ce Mon Sep 17 00:00:00 2001 +From: "dyoung@redhat.com" +Date: Mon, 31 Aug 2015 10:43:16 +0800 +Subject: [PATCH] Revert "rename kernel command line param action_on_fail to + rd.action_on_fail" + +This reverts commit 391d6057908be2fe78f8084eb1b2adc27c781c0b. + +action_on_fail is useless thus remove the commits for it one by one. + +Signed-off-by: Dave Young +--- + dracut.cmdline.7.asc | 2 +- + modules.d/99base/dracut-lib.sh | 2 +- + 2 files changed, 2 insertions(+), 2 deletions(-) + +diff --git a/dracut.cmdline.7.asc b/dracut.cmdline.7.asc +index ad99799..cd8cc66 100644 +--- a/dracut.cmdline.7.asc ++++ b/dracut.cmdline.7.asc +@@ -159,7 +159,7 @@ Misc + specify the controlling terminal for the console. + This is useful, if you have multiple "console=" arguments. + +-**rd.action_on_fail=**_{shell|continue}_:: ++**action_on_fail=**_{shell|continue}_:: + Specify the action after failure. By default it's emergency_shell. + 'continue' means: ignore the current failure and go ahead. + +diff --git a/modules.d/99base/dracut-lib.sh b/modules.d/99base/dracut-lib.sh +index cc5bb42..1ac9b3c 100755 +--- a/modules.d/99base/dracut-lib.sh ++++ b/modules.d/99base/dracut-lib.sh +@@ -1143,7 +1143,7 @@ emergency_shell() + + action_on_fail() + { +- local _action=$(getarg rd.action_on_fail= -d action_on_fail=) ++ local _action=$(getarg action_on_fail=) + case "$_action" in + continue) + [ "$1" = "-n" ] && shift 2 diff --git a/0164-Revert-systemd-emergency.service-do-not-run-for-acti.patch b/0164-Revert-systemd-emergency.service-do-not-run-for-acti.patch new file mode 100644 index 0000000..081974f --- /dev/null +++ b/0164-Revert-systemd-emergency.service-do-not-run-for-acti.patch @@ -0,0 +1,27 @@ +From a95a727fdcd110470d99bd431129ec1624881c7f Mon Sep 17 00:00:00 2001 +From: "dyoung@redhat.com" +Date: Mon, 31 Aug 2015 10:43:17 +0800 +Subject: [PATCH] Revert "systemd/emergency.service: do not run for + action_on_fail=continue" + +This reverts commit dcae873414ff643e1de790f256e414923e2aef8b. + +action_on_fail is useless thus remove the commits for it one by one. + +Signed-off-by: Dave Young +--- + modules.d/98dracut-systemd/emergency.service | 1 - + 1 file changed, 1 deletion(-) + +diff --git a/modules.d/98dracut-systemd/emergency.service b/modules.d/98dracut-systemd/emergency.service +index c19fe37..35d9c31 100644 +--- a/modules.d/98dracut-systemd/emergency.service ++++ b/modules.d/98dracut-systemd/emergency.service +@@ -12,7 +12,6 @@ Description=Emergency Shell + DefaultDependencies=no + After=systemd-vconsole-setup.service + Wants=systemd-vconsole-setup.service +-ConditionKernelCommandLine=!action_on_fail=continue + + [Service] + Environment=HOME=/ diff --git a/0165-Revert-dracut-emergency.service-do-not-start-for-act.patch b/0165-Revert-dracut-emergency.service-do-not-start-for-act.patch new file mode 100644 index 0000000..6f246b7 --- /dev/null +++ b/0165-Revert-dracut-emergency.service-do-not-start-for-act.patch @@ -0,0 +1,27 @@ +From 946722e4655924915e46a50d3f0700e26832fba3 Mon Sep 17 00:00:00 2001 +From: "dyoung@redhat.com" +Date: Mon, 31 Aug 2015 10:43:18 +0800 +Subject: [PATCH] Revert "dracut-emergency.service: do not start for + "action_on_fail=continue"" + +This reverts commit b78e6ac2c328c76057b17059a761ab44707f9aa0. + +action_on_fail is useless thus remove the commits for it one by one. + +Signed-off-by: Dave Young +--- + modules.d/98dracut-systemd/dracut-emergency.service | 1 - + 1 file changed, 1 deletion(-) + +diff --git a/modules.d/98dracut-systemd/dracut-emergency.service b/modules.d/98dracut-systemd/dracut-emergency.service +index a4b81bc..a523671 100644 +--- a/modules.d/98dracut-systemd/dracut-emergency.service ++++ b/modules.d/98dracut-systemd/dracut-emergency.service +@@ -13,7 +13,6 @@ DefaultDependencies=no + After=systemd-vconsole-setup.service + Wants=systemd-vconsole-setup.service + Conflicts=emergency.service emergency.target +-ConditionKernelCommandLine=!action_on_fail=continue + + [Service] + Environment=HOME=/ diff --git a/0166-Revert-99fs-lib-fs-lib.sh-Let-user-specify-the-actio.patch b/0166-Revert-99fs-lib-fs-lib.sh-Let-user-specify-the-actio.patch new file mode 100644 index 0000000..044c5d4 --- /dev/null +++ b/0166-Revert-99fs-lib-fs-lib.sh-Let-user-specify-the-actio.patch @@ -0,0 +1,36 @@ +From d6dfde78303ed20a4d8b3e7b77a447e7e12cbbba Mon Sep 17 00:00:00 2001 +From: "dyoung@redhat.com" +Date: Mon, 31 Aug 2015 10:43:19 +0800 +Subject: [PATCH] Revert "99fs-lib/fs-lib.sh: Let user specify the action after + fail for fsck" + +This reverts commit 679fa7ed3c0f4c827bfc6885d34f56713fe85c1e. + +action_on_fail is useless thus remove the commits for it one by one. + +Signed-off-by: Dave Young +--- + modules.d/99fs-lib/fs-lib.sh | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/modules.d/99fs-lib/fs-lib.sh b/modules.d/99fs-lib/fs-lib.sh +index df3803d..672d027 100755 +--- a/modules.d/99fs-lib/fs-lib.sh ++++ b/modules.d/99fs-lib/fs-lib.sh +@@ -5,14 +5,14 @@ type getarg >/dev/null 2>&1 || . /lib/dracut-lib.sh + fsck_ask_reboot() { + info "note - fsck suggests reboot, if you" + info "leave shell, booting will continue normally" +- action_on_fail -n "(reboot ?)" ++ emergency_shell -n "(reboot ?)" + } + + fsck_ask_err() { + warn "*** An error occurred during the file system check." + warn "*** Dropping you to a shell; the system will try" + warn "*** to mount the filesystem(s), when you leave the shell." +- action_on_fail -n "(Repair filesystem)" ++ emergency_shell -n "(Repair filesystem)" + } + + # inherits: _ret _drv _out diff --git a/0167-Revert-Let-user-specify-the-action-after-fail.patch b/0167-Revert-Let-user-specify-the-action-after-fail.patch new file mode 100644 index 0000000..05584e8 --- /dev/null +++ b/0167-Revert-Let-user-specify-the-action-after-fail.patch @@ -0,0 +1,209 @@ +From 687000767464401261f336d118de9bba7f50e88d Mon Sep 17 00:00:00 2001 +From: "dyoung@redhat.com" +Date: Mon, 31 Aug 2015 10:43:20 +0800 +Subject: [PATCH] Revert "Let user specify the action after fail" + +This reverts commit 9d787df19674937e8c07bd295b5d282a63829209 + +action_on_fail is useless thus remove the commits for it one by one. + +Signed-off-by: Dave Young +--- + dracut.cmdline.7.asc | 4 ---- + modules.d/95rootfs-block/mount-root.sh | 2 +- + modules.d/98dracut-systemd/dracut-initqueue.sh | 2 +- + modules.d/98dracut-systemd/dracut-mount.sh | 2 +- + modules.d/98selinux/selinux-loadpolicy.sh | 6 ++++-- + modules.d/98usrmount/mount-usr.sh | 4 ++-- + modules.d/99base/dracut-lib.sh | 22 ---------------------- + modules.d/99base/init.sh | 12 ++++++------ + 8 files changed, 15 insertions(+), 39 deletions(-) + +diff --git a/dracut.cmdline.7.asc b/dracut.cmdline.7.asc +index cd8cc66..d790afd 100644 +--- a/dracut.cmdline.7.asc ++++ b/dracut.cmdline.7.asc +@@ -159,10 +159,6 @@ Misc + specify the controlling terminal for the console. + This is useful, if you have multiple "console=" arguments. + +-**action_on_fail=**_{shell|continue}_:: +- Specify the action after failure. By default it's emergency_shell. +- 'continue' means: ignore the current failure and go ahead. +- + [[dracutkerneldebug]] + Debug + ~~~~~ +diff --git a/modules.d/95rootfs-block/mount-root.sh b/modules.d/95rootfs-block/mount-root.sh +index 7e9c5bb..924393b 100755 +--- a/modules.d/95rootfs-block/mount-root.sh ++++ b/modules.d/95rootfs-block/mount-root.sh +@@ -66,7 +66,7 @@ mount_root() { + warn "*** Warning -- the system did not shut down cleanly. " + warn "*** Dropping you to a shell; the system will continue" + warn "*** when you leave the shell." +- action_on_fail ++ emergency_shell + fi + fsckoptions="$AUTOFSCK_OPT $fsckoptions" + fi +diff --git a/modules.d/98dracut-systemd/dracut-initqueue.sh b/modules.d/98dracut-systemd/dracut-initqueue.sh +index 881f639..3ddc236 100755 +--- a/modules.d/98dracut-systemd/dracut-initqueue.sh ++++ b/modules.d/98dracut-systemd/dracut-initqueue.sh +@@ -68,7 +68,7 @@ while :; do + main_loop=$(($main_loop+1)) + if [ $main_loop -gt $RDRETRY ]; then + if ! [ -f /sysroot/etc/fstab ] || ! [ -e /sysroot/sbin/init ] ; then +- action_on_fail "Could not boot." && break ++ emergency_shell "Could not boot." + fi + warn "Not all disks have been found." + warn "You might want to regenerate your initramfs." +diff --git a/modules.d/98dracut-systemd/dracut-mount.sh b/modules.d/98dracut-systemd/dracut-mount.sh +index 11ba7bc..c4febfe 100755 +--- a/modules.d/98dracut-systemd/dracut-mount.sh ++++ b/modules.d/98dracut-systemd/dracut-mount.sh +@@ -29,7 +29,7 @@ while :; do + done + + i=$(($i+1)) +- [ $i -gt 20 ] && action_on_fail "Can't mount root filesystem" && break ++ [ $i -gt 20 ] && emergency_shell "Can't mount root filesystem" + done + + export -p > /dracut-state.sh +diff --git a/modules.d/98selinux/selinux-loadpolicy.sh b/modules.d/98selinux/selinux-loadpolicy.sh +index d0ac834..ca81a38 100755 +--- a/modules.d/98selinux/selinux-loadpolicy.sh ++++ b/modules.d/98selinux/selinux-loadpolicy.sh +@@ -54,14 +54,16 @@ rd_load_policy() + if [ $ret -eq 3 -o $permissive -eq 0 ]; then + warn "Machine in enforcing mode." + warn "Not continuing" +- action_on_fail -n selinux || exit 1 ++ emergency_shell -n selinux ++ exit 1 + fi + return 0 + elif [ $permissive -eq 0 -a "$SELINUX" != "disabled" ]; then + warn "Machine in enforcing mode and cannot execute load_policy." + warn "To disable selinux, add selinux=0 to the kernel command line." + warn "Not continuing" +- action_on_fail -n selinux || exit 1 ++ emergency_shell -n selinux ++ exit 1 + fi + } + +diff --git a/modules.d/98usrmount/mount-usr.sh b/modules.d/98usrmount/mount-usr.sh +index d1a629c..1699604 100755 +--- a/modules.d/98usrmount/mount-usr.sh ++++ b/modules.d/98usrmount/mount-usr.sh +@@ -40,7 +40,7 @@ fsck_usr() + warn "*** Warning -- the system did not shut down cleanly. " + warn "*** Dropping you to a shell; the system will continue" + warn "*** when you leave the shell." +- action_on_fail ++ emergency_shell + fi + _fsckoptions="$AUTOFSCK_OPT $_fsckoptions" + fi +@@ -103,7 +103,7 @@ mount_usr() + warn "Mounting /usr to $NEWROOT/usr failed" + warn "*** Dropping you to a shell; the system will continue" + warn "*** when you leave the shell." +- action_on_fail ++ emergency_shell + fi + fi + } +diff --git a/modules.d/99base/dracut-lib.sh b/modules.d/99base/dracut-lib.sh +index 1ac9b3c..d3a7b59 100755 +--- a/modules.d/99base/dracut-lib.sh ++++ b/modules.d/99base/dracut-lib.sh +@@ -1141,28 +1141,6 @@ emergency_shell() + fi + } + +-action_on_fail() +-{ +- local _action=$(getarg action_on_fail=) +- case "$_action" in +- continue) +- [ "$1" = "-n" ] && shift 2 +- [ "$1" = "--shutdown" ] && shift 2 +- warn "$*" +- warn "Not dropping to emergency shell, because 'action_on_fail=continue' was set on the kernel command line." +- return 0 +- ;; +- shell) +- emergency_shell $@ +- return 1 +- ;; +- *) +- emergency_shell $@ +- return 1 +- ;; +- esac +-} +- + # Retain the values of these variables but ensure that they are unexported + # This is a POSIX-compliant equivalent of bash's "export -n" + export_n() +diff --git a/modules.d/99base/init.sh b/modules.d/99base/init.sh +index a59e8ea..e2e4029 100755 +--- a/modules.d/99base/init.sh ++++ b/modules.d/99base/init.sh +@@ -85,7 +85,7 @@ if command -v kmod >/dev/null 2>/dev/null; then + done + fi + +-trap "action_on_fail Signal caught!" 0 ++trap "emergency_shell Signal caught!" 0 + + export UDEVVERSION=$(udevadm --version) + if [ $UDEVVERSION -gt 166 ]; then +@@ -214,7 +214,7 @@ while :; do + + main_loop=$(($main_loop+1)) + [ $main_loop -gt $RDRETRY ] \ +- && { flock -s 9 ; action_on_fail "Could not boot." && break; } 9>/.console_lock ++ && { flock -s 9 ; emergency_shell "Could not boot."; } 9>/.console_lock + done + unset job + unset queuetriggered +@@ -249,7 +249,7 @@ while :; do + + _i_mount=$(($_i_mount+1)) + [ $_i_mount -gt 20 ] \ +- && { flock -s 9 ; action_on_fail "Can't mount root filesystem" && break; } 9>/.console_lock ++ && { flock -s 9 ; emergency_shell "Can't mount root filesystem"; } 9>/.console_lock + done + + { +@@ -283,7 +283,7 @@ done + [ "$INIT" ] || { + echo "Cannot find init!" + echo "Please check to make sure you passed a valid root filesystem!" +- action_on_fail ++ emergency_shell + } + + if [ $UDEVVERSION -lt 168 ]; then +@@ -387,13 +387,13 @@ if [ -f /etc/capsdrop ]; then + warn "Command:" + warn capsh --drop=$CAPS_INIT_DROP -- -c exec switch_root "$NEWROOT" "$INIT" $initargs + warn "failed." +- action_on_fail ++ emergency_shell + } + else + unset RD_DEBUG + exec $SWITCH_ROOT "$NEWROOT" "$INIT" $initargs || { + warn "Something went very badly wrong in the initramfs. Please " + warn "file a bug against dracut." +- action_on_fail ++ emergency_shell + } + fi diff --git a/0168-dracut.sh-remove-the-concept-of-host_modalias.patch b/0168-dracut.sh-remove-the-concept-of-host_modalias.patch new file mode 100644 index 0000000..1609a39 --- /dev/null +++ b/0168-dracut.sh-remove-the-concept-of-host_modalias.patch @@ -0,0 +1,77 @@ +From 07a081f352497258862ae164d11d9e6dc2c5b959 Mon Sep 17 00:00:00 2001 +From: Harald Hoyer +Date: Fri, 13 Nov 2015 13:40:38 +0100 +Subject: [PATCH] dracut.sh: remove the concept of host_modalias + +We can never gather enough information about compiled in modules, so +don't pretend to know and do smart decisions. +--- + dracut-init.sh | 14 ++------------ + dracut.sh | 22 +--------------------- + 2 files changed, 3 insertions(+), 33 deletions(-) + +diff --git a/dracut-init.sh b/dracut-init.sh +index d254e76..f22256c 100644 +--- a/dracut-init.sh ++++ b/dracut-init.sh +@@ -1022,18 +1022,8 @@ module_is_host_only() { + modinfo -F filename "$_mod" &>/dev/null && return 1 + fi + +- _aliases=$(modinfo -k $kernel -F alias $_mod 2>/dev/null) +- +- # if the module has no aliases, install it +- [[ $_aliases ]] || return 0 +- +- # finally check all modalias +- for a in $_aliases; do +- for i in "${!host_modalias[@]}"; do +- [[ $i == $a ]] && return 0 +- done +- done +- ++ # just install the module, better safe than sorry ++ return 0 + fi + + return 1 +diff --git a/dracut.sh b/dracut.sh +index 52a628a..a21295d 100755 +--- a/dracut.sh ++++ b/dracut.sh +@@ -1187,26 +1187,6 @@ if [[ $hostonly ]]; then + fi + done < /etc/fstab + fi +- +- # record all host modaliases +- declare -A host_modalias +- find /sys/devices -name modalias -exec cat '{}' \; > "$initdir/.modalias" +- while read -r modalias || [ -n "$modalias" ]; do +- [[ $modalias ]] && host_modalias["$modalias"]=1 +- done < "$initdir/.modalias" +- +- rm -f -- "$initdir/.modalias" +- +- while read _k _s _v || [ -n "$_k" ]; do +- [ "$_k" != "name" -a "$_k" != "driver" ] && continue +- host_modalias["$_v"]=1 +- done +Date: Fri, 16 Oct 2015 04:04:34 +0200 +Subject: [PATCH] Check rd.zfcp= format in dracut hook:cmdline process stage + +When using rd.zfcp= parameter in generic.prm file, wrong format +parameters will prevent the zfcp driver to add the correct SCSI +disk. dracut should die when a wrong rd.zfcp= parameter supplied. + +Signed-off-by: Zhiguo Deng +--- + modules.d/95zfcp/parse-zfcp.sh | 2 ++ + 1 file changed, 2 insertions(+) + +diff --git a/modules.d/95zfcp/parse-zfcp.sh b/modules.d/95zfcp/parse-zfcp.sh +index 223cd32..6e1514f 100755 +--- a/modules.d/95zfcp/parse-zfcp.sh ++++ b/modules.d/95zfcp/parse-zfcp.sh +@@ -3,6 +3,8 @@ + getargbool 1 rd.zfcp.conf -d -n rd_NO_ZFCPCONF || rm /etc/zfcp.conf + + for zfcp_arg in $(getargs rd.zfcp -d 'rd_ZFCP='); do ++ echo $zfcp_arg | grep '0\.[0-9a-fA-F]\.[0-9a-fA-F]\{4\},0x[0-9a-fA-F]\{16\},0x[0-9a-fA-F]\{16\}' >/dev/null ++ test $? -ne 0 && die "For argument 'rd.zfcp=$zfcp_arg'\nSorry, invalid format." + ( + IFS="," + set $zfcp_arg diff --git a/0170-dracut-init.sh-libdir-paths-need-dracut-function.sh.patch b/0170-dracut-init.sh-libdir-paths-need-dracut-function.sh.patch new file mode 100644 index 0000000..8125695 --- /dev/null +++ b/0170-dracut-init.sh-libdir-paths-need-dracut-function.sh.patch @@ -0,0 +1,31 @@ +From 456f299ab8e3168d709c35cf7ec09d1683c4cec3 Mon Sep 17 00:00:00 2001 +From: Harald Hoyer +Date: Fri, 13 Nov 2015 14:19:53 +0100 +Subject: [PATCH] dracut-init.sh: libdir paths need dracut-function.sh + +--- + dracut-init.sh | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/dracut-init.sh b/dracut-init.sh +index f22256c..fc35d7b 100644 +--- a/dracut-init.sh ++++ b/dracut-init.sh +@@ -78,6 +78,8 @@ export srcmods + export hookdirs + } + ++. $dracutbasedir/dracut-functions.sh ++ + # Detect lib paths + if ! [[ $libdirs ]] ; then + if [[ "$(ldd /bin/sh)" == */lib64/* ]] &>/dev/null \ +@@ -94,8 +96,6 @@ if ! [[ $libdirs ]] ; then + export libdirs + fi + +-. $dracutbasedir/dracut-functions.sh +- + # helper function for check() in module-setup.sh + # to check for required installed binaries + # issues a standardized warning message diff --git a/0171-iscsi-parse-iscsiroot.sh-reload-udev-rules.patch b/0171-iscsi-parse-iscsiroot.sh-reload-udev-rules.patch new file mode 100644 index 0000000..4ef9c53 --- /dev/null +++ b/0171-iscsi-parse-iscsiroot.sh-reload-udev-rules.patch @@ -0,0 +1,37 @@ +From 602dce9ff2f865038e8e6c618a24b04157809026 Mon Sep 17 00:00:00 2001 +From: Harald Hoyer +Date: Fri, 13 Nov 2015 16:37:48 +0100 +Subject: [PATCH] iscsi/parse-iscsiroot.sh: reload udev rules + +in the DHCP case udev is already running, so reload the rules before +continuing. +--- + modules.d/95iscsi/parse-iscsiroot.sh | 8 ++++++++ + 1 file changed, 8 insertions(+) + +diff --git a/modules.d/95iscsi/parse-iscsiroot.sh b/modules.d/95iscsi/parse-iscsiroot.sh +index 1d62b03..43b2e08 100755 +--- a/modules.d/95iscsi/parse-iscsiroot.sh ++++ b/modules.d/95iscsi/parse-iscsiroot.sh +@@ -41,6 +41,7 @@ if [ "${root%%:*}" = "iscsi" ] ; then + netroot=$root + # if root is not specified try to mount the whole iSCSI LUN + printf 'ENV{DEVTYPE}!="partition", SYMLINK=="disk/by-path/*-iscsi-*-*", SYMLINK+="root"\n' >> /etc/udev/rules.d/99-iscsi-root.rules ++ [ -n "$DRACUT_SYSTEMD" ] && systemctl is-active systemd-udevd && udevadm control --reload-rules + root=/dev/root + + write_fs_tab /dev/root +@@ -53,6 +54,13 @@ for nroot in $(getargs netroot); do + break + done + ++# Root takes precedence over netroot ++if [ "${root}" = "/dev/root" ] && getarg "netroot=dhcp" ; then ++ # if root is not specified try to mount the whole iSCSI LUN ++ printf 'ENV{DEVTYPE}!="partition", SYMLINK=="disk/by-path/*-iscsi-*-*", SYMLINK+="root"\n' >> /etc/udev/rules.d/99-iscsi-root.rules ++ [ -n "$DRACUT_SYSTEMD" ] && systemctl is-active systemd-udevd && udevadm control --reload-rules ++fi ++ + if [ -n "$iscsiroot" ] ; then + [ -z "$netroot" ] && netroot=$root + diff --git a/dracut.spec b/dracut.spec index f287e79..667ca59 100644 --- a/dracut.spec +++ b/dracut.spec @@ -1,6 +1,11 @@ %define dracutlibdir %{_prefix}/lib/dracut %bcond_without doc +# We ship a .pc file but don't want to have a dep on pkg-config. We +# strip the automatically generated dep here and instead co-own the +# directory. +%global __requires_exclude pkg-config + # Variables must be defined %define with_nbd 1 @@ -11,7 +16,7 @@ Name: dracut Version: 043 -Release: 60.git20150811%{?dist} +Release: 172.git20151113%{?dist} Summary: Initramfs generator using udev %if 0%{?fedora} || 0%{?rhel} @@ -77,18 +82,130 @@ Patch44: 0044-syncheck-Look-for-echo-n-usage-in-modules.patch Patch45: 0045-dracut.spec-add-dracut-init.sh.patch Patch46: 0046-use-mktemp-p-instead-of-tmpdir-for-busybox.patch Patch47: 0047-dmsquash-generator.sh-increase-timeout-for-checkisom.patch -Patch48: 0048-Cleanup-compressor-handling.patch -Patch49: 0049-Add-missing-echo-to-output-the-result.patch -Patch50: 0050-crypt-s-allow-discards-discard-for-crypttab.patch -Patch51: 0051-qemu-add-spapr-vscsi-kernel-module.patch -Patch52: 0052-dracut.sh-simplify-modalias-reading.patch -Patch53: 0053-90qemu-fixed-systemd-detect-virt-output-parsing.patch -Patch54: 0054-Remove-98integrity-s-dependency-on-selinux.patch -Patch55: 0055-Extend-evm-enable.sh-to-load-the-EVM-public-key.patch -Patch56: 0056-Define-new-script-to-load-keys-on-the-IMA-keyring-up.patch -Patch57: 0057-Revert-securitfs-change.patch -Patch58: 0058-base-dracut-lib.sh-Dup-stdout-and-stderr.patch -Patch59: 0059-dracut.sh-remove-quotes-from-install_items-and-insta.patch +Patch48: 0048-remove-the-incomplete-.img-file.patch +Patch49: 0049-Cleanup-compressor-handling.patch +Patch50: 0050-Add-missing-echo-to-output-the-result.patch +Patch51: 0051-crypt-s-allow-discards-discard-for-crypttab.patch +Patch52: 0052-qemu-add-spapr-vscsi-kernel-module.patch +Patch53: 0053-dracut-initramfs-restore-make-mount-error-nonfatal.patch +Patch54: 0054-dracut.sh-simplify-modalias-reading.patch +Patch55: 0055-90qemu-fixed-systemd-detect-virt-output-parsing.patch +Patch56: 0056-Remove-98integrity-s-dependency-on-selinux.patch +Patch57: 0057-Extend-evm-enable.sh-to-load-the-EVM-public-key.patch +Patch58: 0058-Define-new-script-to-load-keys-on-the-IMA-keyring-up.patch +Patch59: 0059-Revert-securitfs-change.patch +Patch60: 0060-base-dracut-lib.sh-Dup-stdout-and-stderr.patch +Patch61: 0061-dracut.sh-remove-quotes-from-install_items-and-insta.patch +Patch62: 0062-network-net-lib.sh-add-is_ip.patch +Patch63: 0063-systemd-add-systemd-run-and-systemd-escape.patch +Patch64: 0064-network-parse-ip-opts.sh-assume-rd.neednet-for-multi.patch +Patch65: 0065-nfs-parse-nfsroot.sh-silence-useless-warning-if-netr.patch +Patch66: 0066-dracut-systemd-dracut-initqueue.sh-be-verbose-about-.patch +Patch67: 0067-base-dracut-lib.sh-forget-about-the-idea-of-output-r.patch +Patch68: 0068-iscsi-integrate-with-systemd-and-improve-robustness.patch +Patch69: 0069-TEST-30-ISCSI-dhcpd.conf-set-the-LUN.patch +Patch70: 0070-TEST-30-ISCSI-switch-to-scsi-target-utils.patch +Patch71: 0071-dracut.cmdline.7.asc-document-rd.iscsi.waitnet-and-r.patch +Patch72: 0072-iscsi-parse-iscsiroot.sh-use-iBFT-initiator-name.patch +Patch73: 0073-iscsi-iscsiroot.sh-handle-timeout-with-all-interface.patch +Patch74: 0074-TEST-30-ISCSI-test-more-and-set-static-initiator-nam.patch +Patch75: 0075-The-default-gateway-might-need-a-static-route.patch +Patch76: 0076-dracut-functions.sh-remove-duplicate-declaratio-of-l.patch +Patch77: 0077-dracut.sh-remove-duplicate-call-of-push_host_devs.patch +Patch78: 0078-dracut-functions.sh-fixed-dracutbasedir-when-sourced.patch +Patch79: 0079-systemd-initrd-fix-typo-in-error-message.patch +Patch80: 0080-systemd-networkd-fix-typo-in-error-message.patch +Patch81: 0081-install-blob-fix-typos-in-usage.patch +Patch82: 0082-dracut.8.asc-mention-lsinitrd-1-in-see-also.patch +Patch83: 0083-dir-locals-Avoid-use-of-setq-which-triggers-Emacs-wa.patch +Patch84: 0084-lsinitrd-Suppress-cat-write-error-Broken-pipe.patch +Patch85: 0085-PKGFILE-update-to-latest-makepkg.patch +Patch86: 0086-PKGFILE-version-is-now-completely-constructed-from-g.patch +Patch87: 0087-PKGFILE-prevent-out-of-tree-builds.patch +Patch88: 0088-dracut-logger-prefix-stderr-output-with-dracut.patch +Patch89: 0089-dmsquash-live-root-Request-overflow-support-for-pers.patch +Patch90: 0090-dmsquash-live-root-Use-non-persistent-metadata-snaps.patch +Patch91: 0091-Makefile-fix-VERSION-and-GITVERSION.patch +Patch92: 0092-dracut.spec-omit-pkg-config-from-dependencies.patch +Patch93: 0093-fips-add-authenc-and-authencesn-kernel-modules.patch +Patch94: 0094-lvm-remove-all-quirk-arguments.patch +Patch95: 0095-dracut.sh-remove-_EARLY-from-CONFIG_MICROCODE_-check.patch +Patch96: 0096-dracut.sh-quote-outfile-on-error-removal.patch +Patch97: 0097-dracut-systemd-module-setup.sh-remove-duplicate-vcon.patch +Patch98: 0098-Makefile-remove-output-file-before-creating-it.patch +Patch99: 0099-TEST-30-ISCSI-add-rd.scsi.firmware.patch +Patch100: 0100-initqueue-add-online-queue.patch +Patch101: 0101-dracut.spec-raise-systemd-requirement-to-219.patch +Patch102: 0102-iscsi-iscsiroot.sh-handle-firmware-in-online-queue.patch +Patch103: 0103-iscsi-parse-iscsiroot.sh-do-not-modify-netroot.patch +Patch104: 0104-network-add-options-to-tweak-timeouts.patch +Patch105: 0105-fcoe-start-with-fcoemon-instead-of-fipvlan.patch +Patch106: 0106-fcoe-EDD-parsing-patch-for-i40e.patch +Patch107: 0107-fcoe-fcoe-edd.sh-cleanup-the-script.patch +Patch108: 0108-livenet-don-t-attempt-to-download-the-image-for-ever.patch +Patch109: 0109-multipath-install-all-multipath-path-selector-kernel.patch +Patch110: 0110-man-page-changed-grub.conf-to-grub2.cfg.patch +Patch111: 0111-crypt-install-drbg-unconditionally-in-hostonly-mode.patch +Patch112: 0112-iscsi-module-setup.sh-iscsid-need-var-lib-iscsi.patch +Patch113: 0113-TEST-30-ISCSI-fix-test-to-run-with-new-iscsi.patch +Patch114: 0114-iscsi-handle-timeout-case-better.patch +Patch115: 0115-systemd-dracut-cmdline.sh-print-out-cmdline-in-one-l.patch +Patch116: 0116-network-ifup.sh-let-dhcp-client-run-in-the-backgroun.patch +Patch117: 0117-network-ifup.sh-arping-for-static-IPv4-addresses.patch +Patch118: 0118-network-parse-ip-opts.sh-bind-enx-interface-to-the-M.patch +Patch119: 0119-udev-rules-install-40-redhat.rules.patch +Patch120: 0120-fcoe-cleanup-lldpad.patch +Patch121: 0121-network-net-lib.sh-ibft-unset-gateway-or-dns-if-set-.patch +Patch122: 0122-network-dhclient-exit-arping-immediatly-if-we-get-an.patch +Patch123: 0123-dmraid-only-scan-once-because-of-one-device.patch +Patch124: 0124-test-TEST-04-FULL-SYSTEMD-create-root.sh-modprobe-bt.patch +Patch125: 0125-TEST-15-BTRFS-load-btrfs-module.patch +Patch126: 0126-network-ifup.sh-do_static-error-out-if-interface-cou.patch +Patch127: 0127-network-ifup.sh-do_static-error-out-if-IP-is-already.patch +Patch128: 0128-iscsi-parse-iscsiroot.sh-handle-firmware-in-online-q.patch +Patch129: 0129-iscsi-parse-iscsiroot.sh-restart-iscsid-with-try-res.patch +Patch130: 0130-network-ifup.sh-save-return-value-of-ifup.patch +Patch131: 0131-network-also-mark-interfaces-up-with-their-MAC.patch +Patch132: 0132-network-ifup.sh-only-use-dhcp-on-unknown-interfaces-.patch +Patch133: 0133-cms-cmsifup.sh-do-not-use-ifup-m.patch +Patch134: 0134-network-ifup-fix-warning-about-not-bringing-interfac.patch +Patch135: 0135-network-net-lib.sh-fix-wait_for_if_up.patch +Patch136: 0136-network-net-lib.sh-fix-IPv6-route-parsing.patch +Patch137: 0137-network-ifup-do-DHCP-for-BOOTDEV.patch +Patch138: 0138-livenet-livenetroot.sh-fixed-error-condition.patch +Patch139: 0139-iscsi-parse-iscsiroot.sh-only-set-initiator-name-if-.patch +Patch140: 0140-network-move-ip-ibft-handling-to-network-module.patch +Patch141: 0141-network-dhclient-script.sh-fix-RENEW.patch +Patch142: 0142-network-add-all_ifaces_setup.patch +Patch143: 0143-iscsi-iscsiroot.sh-use-all_ifaces_setup.patch +Patch144: 0144-network-netroot.sh-better-handling-of-netroot-and-dh.patch +Patch145: 0145-iscsi-iscsiroot.sh-handle-iscsi_firmware-in-online-a.patch +Patch146: 0146-dracut.sh-add-command-line-option-for-install_i18_al.patch +Patch147: 0147-dracut.sh-do-not-create-microcode-if-no-firmware-is-.patch +Patch148: 0148-iscsi-parse-iscsiroot.sh-correct-handling-if-netroot.patch +Patch149: 0149-dracut.sh-no-microcode-if-get_ucode_file-returns-emp.patch +Patch150: 0150-network-wait_for_ifup-handle-NO-CARRIER-output.patch +Patch151: 0151-dracut.sh-fixed-typo-in-microcode-generation.patch +Patch152: 0152-base-dracut-lib.sh-getargs-don-t-return-1-for-empty-.patch +Patch153: 0153-network-ifup.sh-skip-empty-nameserver-values.patch +Patch154: 0154-dracut-systemd-rootfs-generator.sh-s-RequiresOverrid.patch +Patch155: 0155-add-no-reproducible-to-turn-off-reproducible-mode.patch +Patch156: 0156-reduce-dracut-functions.sh-and-add-to-dracut-init.sh.patch +Patch157: 0157-repro-squash.patch +Patch158: 0158-iscsi-iscsiroot.sh-put-variables-in-quotes.patch +Patch159: 0159-iscsi-only-systemctl-try-restart-iscsid-if-systemd-i.patch +Patch160: 0160-Add-awk-and-getopt-as-dependencies-of-znetconf.patch +Patch161: 0161-dracut.sh-Support-mount-with-just-mountpoint-as-para.patch +Patch162: 0162-Revert-Change-the-implementation-of-action_on_fail.patch +Patch163: 0163-Revert-rename-kernel-command-line-param-action_on_fa.patch +Patch164: 0164-Revert-systemd-emergency.service-do-not-run-for-acti.patch +Patch165: 0165-Revert-dracut-emergency.service-do-not-start-for-act.patch +Patch166: 0166-Revert-99fs-lib-fs-lib.sh-Let-user-specify-the-actio.patch +Patch167: 0167-Revert-Let-user-specify-the-action-after-fail.patch +Patch168: 0168-dracut.sh-remove-the-concept-of-host_modalias.patch +Patch169: 0169-Check-rd.zfcp-format-in-dracut-hook-cmdline-process-.patch +Patch170: 0170-dracut-init.sh-libdir-paths-need-dracut-function.sh.patch +Patch171: 0171-iscsi-parse-iscsiroot.sh-reload-udev-rules.patch Source1: https://www.gnu.org/licenses/lgpl-2.1.txt @@ -169,7 +286,7 @@ Requires: kpartx %if 0%{?fedora} || 0%{?rhel} > 6 Requires: util-linux >= 2.21 -Requires: systemd >= 199 +Requires: systemd >= 219 Requires: procps-ng Conflicts: grubby < 8.23 Conflicts: initscripts < 8.63-1 @@ -387,6 +504,7 @@ rm -rf -- $RPM_BUILD_ROOT %endif %dir %{_sysconfdir}/dracut.conf.d %dir %{dracutlibdir}/dracut.conf.d +%dir %{_datadir}/pkgconfig %{_datadir}/pkgconfig/dracut.pc %if %{with doc} @@ -548,6 +666,9 @@ rm -rf -- $RPM_BUILD_ROOT %endif %changelog +* Fr Nov 13 2015 Harald Hoyer - 043-172.git20151113 +- git snapshot + * Tue Aug 11 2015 Harald Hoyer 043-60.git20150811 - fixed checkiso timeout - fixed log output although quiet is set