From 6f6689329ccfb56cfe20853765d374f6068443cf5b1f606626d9a8915d23e341 Mon Sep 17 00:00:00 2001 From: Thomas Renninger Date: Mon, 13 Jan 2014 18:00:03 +0000 Subject: [PATCH] Exit without calling update-bootloader (bnc#858268): Add: dracut_do_not_update_booloader_if_no_kernel_is_found.patch Adding: Requires: systemd-sysvinit which has reboot, halt and other binaries dracut likes to add to the initrd. Cleanup and adjust to latest mainline: Dropping as these are included in the latest update_git_v034_to_head patch: Drop: 0001-95dasd-Install-kernel-modules-only-once.patch Drop: 0002-95dasd-Only-install-module-if-normalize_dasd_arg-is-.patch Drop: 0003-95dasd_mod-make-dasd_cio_free-optional.patch Drop: 0004-95zfcp-Make-installation-optional.patch Drop: 0005-95znet-Make-installation-optional.patch Drop: 0007-Fixup-keymap-setting-for-openSUSE.patch Drop: 0008-Add-DASD-configuration-for-SuSE.patch Drop: 0009-Add-zfcp-scripts-for-SUSE.patch Drop: 0010-Make-logfile-configurable.patch Drop: 0011-mkinitrd-suse-Add-SUSE-compability-wrapper-for-dracu.patch Drop: 0012-mkinitrd-suse.8.asc-Add-manpage-for-SUSE-compat-mkin.patch Drop: 0015-Fixup-script-permissions.patch Drop: 0016-Remove-shebang-from-shell-completion-files.patch Drop: dracut-git-update.patch Rebase: 0013-Correct-paths-for-openSUSE.patch This is a rename of dracut-git-update.patch to: Add: dracut_git_v034_to_head.patch OBS-URL: https://build.opensuse.org/package/show/Base:System/dracut?expand=0&rev=87 --- ...asd-Install-kernel-modules-only-once.patch | 37 - ...all-module-if-normalize_dasd_arg-is-.patch | 28 - ...dasd_mod-make-dasd_cio_free-optional.patch | 41 - 0004-95zfcp-Make-installation-optional.patch | 38 - 0005-95znet-Make-installation-optional.patch | 28 - 0007-Fixup-keymap-setting-for-openSUSE.patch | 29 - 0008-Add-DASD-configuration-for-SuSE.patch | 155 - 0009-Add-zfcp-scripts-for-SUSE.patch | 121 - 0010-Make-logfile-configurable.patch | 70 - ...d-SUSE-compability-wrapper-for-dracu.patch | 378 -- ...asc-Add-manpage-for-SUSE-compat-mkin.patch | 139 - 0013-Correct-paths-for-openSUSE.patch | 31 +- 0015-Fixup-script-permissions.patch | 49 - ...-shebang-from-shell-completion-files.patch | 37 - dracut.changes | 32 + dracut.spec | 46 +- ...date_booloader_if_no_kernel_is_found.patch | 13 + ...ate.patch => dracut_git_v034_to_head.patch | 3536 ++++++++++++++++- 18 files changed, 3488 insertions(+), 1320 deletions(-) delete mode 100644 0001-95dasd-Install-kernel-modules-only-once.patch delete mode 100644 0002-95dasd-Only-install-module-if-normalize_dasd_arg-is-.patch delete mode 100644 0003-95dasd_mod-make-dasd_cio_free-optional.patch delete mode 100644 0004-95zfcp-Make-installation-optional.patch delete mode 100644 0005-95znet-Make-installation-optional.patch delete mode 100644 0007-Fixup-keymap-setting-for-openSUSE.patch delete mode 100644 0008-Add-DASD-configuration-for-SuSE.patch delete mode 100644 0009-Add-zfcp-scripts-for-SUSE.patch delete mode 100644 0010-Make-logfile-configurable.patch delete mode 100644 0011-mkinitrd-suse-Add-SUSE-compability-wrapper-for-dracu.patch delete mode 100644 0012-mkinitrd-suse.8.asc-Add-manpage-for-SUSE-compat-mkin.patch delete mode 100644 0015-Fixup-script-permissions.patch delete mode 100644 0016-Remove-shebang-from-shell-completion-files.patch create mode 100644 dracut_do_not_update_booloader_if_no_kernel_is_found.patch rename dracut-git-update.patch => dracut_git_v034_to_head.patch (59%) diff --git a/0001-95dasd-Install-kernel-modules-only-once.patch b/0001-95dasd-Install-kernel-modules-only-once.patch deleted file mode 100644 index 883fe27..0000000 --- a/0001-95dasd-Install-kernel-modules-only-once.patch +++ /dev/null @@ -1,37 +0,0 @@ -From 0c3400336c7916819fd24b8081e24098880ef244 Mon Sep 17 00:00:00 2001 -From: Hannes Reinecke -Date: Thu, 21 Nov 2013 11:51:30 +0100 -Subject: [PATCH] 95dasd: Install kernel modules only once - -Move kernel module selection to 95dasd_mod and make 95dasd depend -on that module. - -Signed-off-by: Hannes Reinecke ---- - modules.d/95dasd/module-setup.sh | 6 +----- - 1 file changed, 1 insertion(+), 5 deletions(-) - -diff --git a/modules.d/95dasd/module-setup.sh b/modules.d/95dasd/module-setup.sh -index 861df29..16207bc 100755 ---- a/modules.d/95dasd/module-setup.sh -+++ b/modules.d/95dasd/module-setup.sh -@@ -11,15 +11,11 @@ check() { - - # called by dracut - depends() { -+ echo "dasd_mod" - return 0 - } - - # called by dracut --installkernel() { -- instmods dasd_mod dasd_eckd_mod dasd_fba_mod dasd_diag_mod --} -- --# called by dracut - install() { - inst_hook cmdline 30 "$moddir/parse-dasd.sh" - inst_multiple dasdinfo dasdconf.sh normalize_dasd_arg --- -1.8.1.4 - diff --git a/0002-95dasd-Only-install-module-if-normalize_dasd_arg-is-.patch b/0002-95dasd-Only-install-module-if-normalize_dasd_arg-is-.patch deleted file mode 100644 index 2dc2ae1..0000000 --- a/0002-95dasd-Only-install-module-if-normalize_dasd_arg-is-.patch +++ /dev/null @@ -1,28 +0,0 @@ -From 3d10724ecd78a62ec8c987c97f9b5f4236c681a4 Mon Sep 17 00:00:00 2001 -From: Hannes Reinecke -Date: Thu, 21 Nov 2013 11:53:09 +0100 -Subject: [PATCH] 95dasd: Only install module if normalize_dasd_arg is present - -normalize_dasd_arg is a RedHat specific script, so no point -installing this module if the script isn't present. - -Signed-off-by: Hannes Reinecke ---- - modules.d/95dasd/module-setup.sh | 1 + - 1 file changed, 1 insertion(+) - -diff --git a/modules.d/95dasd/module-setup.sh b/modules.d/95dasd/module-setup.sh -index 16207bc..9c93d40 100755 ---- a/modules.d/95dasd/module-setup.sh -+++ b/modules.d/95dasd/module-setup.sh -@@ -5,6 +5,7 @@ - # called by dracut - check() { - local _arch=$(uname -m) -+ [ -x /sbin/normalize_dasd_arg ] || return 1 - [ "$_arch" = "s390" -o "$_arch" = "s390x" ] || return 1 - return 0 - } --- -1.8.1.4 - diff --git a/0003-95dasd_mod-make-dasd_cio_free-optional.patch b/0003-95dasd_mod-make-dasd_cio_free-optional.patch deleted file mode 100644 index 9b1f039..0000000 --- a/0003-95dasd_mod-make-dasd_cio_free-optional.patch +++ /dev/null @@ -1,41 +0,0 @@ -From 7d00da419fcbdb8736cbbe7caf13209589b43d9c Mon Sep 17 00:00:00 2001 -From: Hannes Reinecke -Date: Thu, 21 Nov 2013 12:33:57 +0100 -Subject: [PATCH] 95dasd_mod: make dasd_cio_free optional - -dasd_cio_free is a RedHat-specific tool, so make it optional. - -Signed-off-by: Hannes Reinecke ---- - modules.d/95dasd_mod/module-setup.sh | 3 ++- - modules.d/95dasd_mod/parse-dasd-mod.sh | 4 +++- - 2 files changed, 5 insertions(+), 2 deletions(-) - -diff --git a/modules.d/95dasd_mod/module-setup.sh b/modules.d/95dasd_mod/module-setup.sh -index 011010d..8fde525 100755 ---- a/modules.d/95dasd_mod/module-setup.sh -+++ b/modules.d/95dasd_mod/module-setup.sh -@@ -23,6 +23,7 @@ installkernel() { - # called by dracut - install() { - inst_hook cmdline 31 "$moddir/parse-dasd-mod.sh" -- inst_multiple dasd_cio_free grep sed seq -+ inst_multiple grep sed seq -+ inst_multiple -o dasd_cio_free - } - -diff --git a/modules.d/95dasd_mod/parse-dasd-mod.sh b/modules.d/95dasd_mod/parse-dasd-mod.sh -index 87c88ed..0236d12 100755 ---- a/modules.d/95dasd_mod/parse-dasd-mod.sh -+++ b/modules.d/95dasd_mod/parse-dasd-mod.sh -@@ -15,4 +15,6 @@ if [ -n "$mod_args" ]; then - fi - - unset dasd_arg --dasd_cio_free -+if [ -x /sbin/dasd_cio_free ] ; then -+ dasd_cio_free -+fi --- -1.8.1.4 - diff --git a/0004-95zfcp-Make-installation-optional.patch b/0004-95zfcp-Make-installation-optional.patch deleted file mode 100644 index bf342a0..0000000 --- a/0004-95zfcp-Make-installation-optional.patch +++ /dev/null @@ -1,38 +0,0 @@ -From f0c233bc4396d3e47a8e660d2d27d78bd32762d7 Mon Sep 17 00:00:00 2001 -From: Hannes Reinecke -Date: Thu, 21 Nov 2013 11:58:31 +0100 -Subject: [PATCH] 95zfcp: Make installation optional - -zfcp_cio_free is a RedHat-specific tool, so do not install this -module if the program isn't present. - -Signed-off-by: Hannes Reinecke ---- - modules.d/95zfcp/module-setup.sh | 4 +--- - 1 file changed, 1 insertion(+), 3 deletions(-) - -diff --git a/modules.d/95zfcp/module-setup.sh b/modules.d/95zfcp/module-setup.sh -index 5d9b506..dfbeed5 100755 ---- a/modules.d/95zfcp/module-setup.sh -+++ b/modules.d/95zfcp/module-setup.sh -@@ -5,6 +5,7 @@ - # called by dracut - check() { - arch=$(uname -m) -+ [ -x /sbin/zfcp_cio_free ] || return 1 - [ "$arch" = "s390" -o "$arch" = "s390x" ] || return 1 - - return 0 -@@ -12,9 +13,6 @@ check() { - - # called by dracut - depends() { -- arch=$(uname -m) -- [ "$arch" = "s390" -o "$arch" = "s390x" ] || return 1 -- - return 0 - } - --- -1.8.1.4 - diff --git a/0005-95znet-Make-installation-optional.patch b/0005-95znet-Make-installation-optional.patch deleted file mode 100644 index f31a949..0000000 --- a/0005-95znet-Make-installation-optional.patch +++ /dev/null @@ -1,28 +0,0 @@ -From 8a7276ae8aae5694c40d977580c7db6c5c47a81a Mon Sep 17 00:00:00 2001 -From: Hannes Reinecke -Date: Thu, 21 Nov 2013 12:00:14 +0100 -Subject: [PATCH] 95znet: Make installation optional - -znet_cio_free is a RedHat-specific tool, so do not install this -module on systems where the program is missing. - -Signed-off-by: Hannes Reinecke ---- - modules.d/95znet/module-setup.sh | 1 + - 1 file changed, 1 insertion(+) - -diff --git a/modules.d/95znet/module-setup.sh b/modules.d/95znet/module-setup.sh -index 4c211a9..5012b77 100755 ---- a/modules.d/95znet/module-setup.sh -+++ b/modules.d/95znet/module-setup.sh -@@ -5,6 +5,7 @@ - # called by dracut - check() { - arch=$(uname -m) -+ [ -z /sbin/znet_cio_free ] || return 1 - [ "$arch" = "s390" -o "$arch" = "s390x" ] || return 1 - - return 0 --- -1.8.1.4 - diff --git a/0007-Fixup-keymap-setting-for-openSUSE.patch b/0007-Fixup-keymap-setting-for-openSUSE.patch deleted file mode 100644 index 3a8079a..0000000 --- a/0007-Fixup-keymap-setting-for-openSUSE.patch +++ /dev/null @@ -1,29 +0,0 @@ -From 4b40f3a3361d5267d9987c57945ef006e90e964d Mon Sep 17 00:00:00 2001 -From: Hannes Reinecke -Date: Wed, 27 Nov 2013 14:42:24 +0100 -Subject: [PATCH] Fixup keymap setting for openSUSE - -openSUSE is using compressed keymaps. - -Signed-off-by: Hannes Reinecke ---- - modules.d/10i18n/module-setup.sh | 3 +++ - 1 file changed, 3 insertions(+) - -diff --git a/modules.d/10i18n/module-setup.sh b/modules.d/10i18n/module-setup.sh -index 0741c64..f07b148 100755 ---- a/modules.d/10i18n/module-setup.sh -+++ b/modules.d/10i18n/module-setup.sh -@@ -161,6 +161,9 @@ install() { - # Gentoo user may have KEYMAP set to something like "-u pl2", - KEYMAP=${KEYMAP#-* } - -+ # openSUSE user may have KEYMAP set to something like ".gz" -+ KEYMAP=${KEYMAP/.gz/} -+ - # KEYTABLE is a bit special - it defines base keymap name and UNICODE - # determines whether non-UNICODE or UNICODE version is used - --- -1.8.1.4 - diff --git a/0008-Add-DASD-configuration-for-SuSE.patch b/0008-Add-DASD-configuration-for-SuSE.patch deleted file mode 100644 index 1df04ad..0000000 --- a/0008-Add-DASD-configuration-for-SuSE.patch +++ /dev/null @@ -1,155 +0,0 @@ -From 60265e04911e2cfb980d048e378fb2e510b8370d Mon Sep 17 00:00:00 2001 -From: Hannes Reinecke -Date: Thu, 21 Nov 2013 12:23:44 +0100 -Subject: [PATCH] Add DASD configuration for SuSE - -On SuSE the DASD configuration is kept in udev rules, one rule -file per device. So add a new module for copying and creating -these rules during boot. - -Signed-off-by: Hannes Reinecke ---- - dracut-functions.sh | 28 +++++++++++++++++ - modules.d/95dasd_rules/module-setup.sh | 27 ++++++++++++++++ - modules.d/95dasd_rules/parse-dasd.sh | 56 ++++++++++++++++++++++++++++++++++ - 3 files changed, 111 insertions(+) - create mode 100755 modules.d/95dasd_rules/module-setup.sh - create mode 100755 modules.d/95dasd_rules/parse-dasd.sh - -diff --git a/dracut-functions.sh b/dracut-functions.sh -index 2872516..0337c13 100755 ---- a/dracut-functions.sh -+++ b/dracut-functions.sh -@@ -899,6 +899,34 @@ inst_rules() { - 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 -+ if [[ -e $_rule ]]; then -+ inst_rule_programs "$_rule" -+ inst_rule_group_owner "$_rule" -+ inst_rule_initqueue "$_rule" -+ inst_simple "$_rule" -+ _found=$_rule -+ fi -+ done -+ if [ -n ${hostonly} ] ; then -+ for _rule in ${_target}/$1 ; do -+ if [[ -f $_rule ]]; then -+ inst_rule_programs "$_rule" -+ inst_rule_group_owner "$_rule" -+ inst_rule_initqueue "$_rule" -+ inst_simple "$_rule" -+ _found=$_rule -+ fi -+ done -+ fi -+ [[ $_found ]] || dinfo "Skipping udev rule: $_rule" -+} -+ - prepare_udev_rules() { - [ -z "$UDEVVERSION" ] && export UDEVVERSION=$(udevadm --version) - -diff --git a/modules.d/95dasd_rules/module-setup.sh b/modules.d/95dasd_rules/module-setup.sh -new file mode 100755 -index 0000000..d313171 ---- /dev/null -+++ b/modules.d/95dasd_rules/module-setup.sh -@@ -0,0 +1,27 @@ -+#!/bin/bash -+# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*- -+# ex: ts=8 sw=4 sts=4 et filetype=sh -+ -+# called by dracut -+check() { -+ local _arch=$(uname -m) -+ [ -x /sbin/dasd_configure ] || return 1 -+ [ "$_arch" = "s390" -o "$_arch" = "s390x" ] || return 1 -+ return 0 -+} -+ -+# called by dracut -+depends() { -+ echo 'dasd_mod' -+ return 0 -+} -+ -+# called by dracut -+install() { -+ inst_multiple /usr/lib/udev/collect -+ inst_hook cmdline 30 "$moddir/parse-dasd.sh" -+ if [[ $hostonly ]] ; then -+ inst_rules_wildcard 51-dasd-*.rules -+ fi -+ inst_rules 59-dasd.rules -+} -diff --git a/modules.d/95dasd_rules/parse-dasd.sh b/modules.d/95dasd_rules/parse-dasd.sh -new file mode 100755 -index 0000000..9389c44 ---- /dev/null -+++ b/modules.d/95dasd_rules/parse-dasd.sh -@@ -0,0 +1,56 @@ -+#!/bin/sh -+# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*- -+# ex: ts=8 sw=4 sts=4 et filetype=sh -+ -+create_udev_rule() { -+ local ccw=$1 -+ local _drv _cu_type _dev_type -+ local _rule=/etc/udev/rules.d/51-dasd-${ccw}.rules -+ -+ if [ -e /sys/bus/ccw/devices/${ccw} ] ; then -+ read _cu_type < /sys/bus/ccw/devices/${ccw}/cutype -+ read _dev_type < /sys/bus/ccw/devices/${ccw}/devtype -+ fi -+ case "$_cu_type" in -+ 3990/*|2105/*|2107/*|1750/*|9343/*) -+ _drv=dasd-eckd -+ ;; -+ 6310/*) -+ _drv=dasd-fba -+ ;; -+ 3880/*) -+ case "$_dev_type" in -+ 3380/*) -+ _drv=dasd_eckd -+ ;; -+ 3370/*) -+ _drv=dasd-fba -+ ;; -+ esac -+ ;; -+ esac -+ [ -z "${_drv}" ] && return 0 -+ -+ [ -e ${_rule} ] && return 0 -+ -+ cat > $_rule < -Date: Thu, 21 Nov 2013 13:47:17 +0100 -Subject: [PATCH] Add zfcp scripts for SUSE - -SuSE is storing the zfcp configuration in udev files, so we should -be including these. - -Signed-off-by: Hannes Reinecke ---- - modules.d/95zfcp_rules/module-setup.sh | 25 +++++++++++++ - modules.d/95zfcp_rules/parse-zfcp.sh | 65 ++++++++++++++++++++++++++++++++++ - 2 files changed, 90 insertions(+) - create mode 100755 modules.d/95zfcp_rules/module-setup.sh - create mode 100755 modules.d/95zfcp_rules/parse-zfcp.sh - -diff --git a/modules.d/95zfcp_rules/module-setup.sh b/modules.d/95zfcp_rules/module-setup.sh -new file mode 100755 -index 0000000..9a1ab20 ---- /dev/null -+++ b/modules.d/95zfcp_rules/module-setup.sh -@@ -0,0 +1,25 @@ -+#!/bin/bash -+# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*- -+# ex: ts=8 sw=4 sts=4 et filetype=sh -+ -+# called by dracut -+check() { -+ local _arch=$(uname -m) -+ [ -x /sbin/zfcp_disk_configure ] || return 1 -+ [ "$_arch" = "s390" -o "$_arch" = "s390x" ] || return 1 -+ return 0 -+} -+ -+# called by dracut -+depends() { -+ return 0 -+} -+ -+# called by dracut -+install() { -+ inst_multiple /usr/lib/udev/collect -+ inst_hook cmdline 30 "$moddir/parse-zfcp.sh" -+ if [[ $hostonly ]] ; then -+ inst_rules_wildcard 51-zfcp-*.rules -+ fi -+} -diff --git a/modules.d/95zfcp_rules/parse-zfcp.sh b/modules.d/95zfcp_rules/parse-zfcp.sh -new file mode 100755 -index 0000000..24dbdd3 ---- /dev/null -+++ b/modules.d/95zfcp_rules/parse-zfcp.sh -@@ -0,0 +1,65 @@ -+#!/bin/sh -+# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*- -+# ex: ts=8 sw=4 sts=4 et filetype=sh -+ -+create_udev_rule() { -+ local ccw=$1 -+ local wwpn=$2 -+ local lun=$3 -+ local _rule=/etc/udev/rules.d/51-zfcp-${ccw}.rules -+ -+ local _cu_type _dev_type -+ local _rule=/etc/udev/rules.d/51-zfcp-${ccw}.rules -+ -+ if [ -e /sys/bus/ccw/devices/${ccw} ] ; then -+ read _cu_type < /sys/bus/ccw/devices/${ccw}/cutype -+ read _dev_type < /sys/bus/ccw/devices/${ccw}/devtype -+ fi -+ if [ "$_cu_type" != "1731/03" ] ; then -+ return 0; -+ fi -+ if [ "$_dev_type" != "1732/03" ] && [ "$_dev_type" != "1732/04" ] ; then -+ return 0; -+ fi -+ -+ [ -e ${_rule} ] && return 0 -+ -+ if [ ! -f "$_rule" ] ; then -+ cat > $_rule <> $_rule < -Date: Thu, 28 Nov 2013 13:21:30 +0100 -Subject: [PATCH] Make logfile configurable - -Add '--logfile' option to make the log file configurable during -runtime. - -Signed-off-by: Hannes Reinecke ---- - dracut.8.asc | 6 ++++++ - dracut.sh | 4 ++++ - 2 files changed, 10 insertions(+) - -diff --git a/dracut.8.asc b/dracut.8.asc -index 2ea6744..d381dcf 100644 ---- a/dracut.8.asc -+++ b/dracut.8.asc -@@ -275,6 +275,12 @@ Default: - - **--sshkey** __:: ssh key file used with ssh-client module. - -+**--logfile** __:: logfile to use; overrides any setting from -+ the configuration files. -++ -+Default: -+ _/var/log/dracut.log_ -+ - **-l, --local**:: - activates the local mode. dracut will use modules from the current working - directory instead of the system-wide installed modules in -diff --git a/dracut.sh b/dracut.sh -index bce2662..5f63d94 100755 ---- a/dracut.sh -+++ b/dracut.sh -@@ -183,6 +183,7 @@ Creates initial ramdisk images for preloading modules - --keep Keep the temporary initramfs for debugging purposes - --printsize Print out the module install size - --sshkey [SSHKEY] Add ssh key to initramfs (use with ssh-client module) -+ --logfile [FILE] Logfile to use (overrides configuration setting) - - If [LIST] has multiple arguments, then you have to put these in quotes. - -@@ -335,6 +336,7 @@ TEMP=$(unset POSIXLY_CORRECT; getopt \ - --long debug \ - --long profile \ - --long sshkey: \ -+ --long logfile: \ - --long verbose \ - --long quiet \ - --long local \ -@@ -418,6 +420,7 @@ while :; do - --debug) debug="yes";; - --profile) profile="yes";; - --sshkey) sshkey="$2"; shift;; -+ --logfile) logfile_l="$2"; shift;; - -v|--verbose) ((verbosity_mod_l++));; - -q|--quiet) ((verbosity_mod_l--));; - -l|--local) -@@ -690,6 +693,7 @@ stdloglvl=$((stdloglvl + verbosity_mod_l)) - [[ $ro_mnt_l ]] && ro_mnt="yes" - [[ $early_microcode_l ]] && early_microcode=$early_microcode_l - [[ $early_microcode ]] || early_microcode=no -+[[ $logfile_l ]] && logfile="$logfile_l" - # eliminate IFS hackery when messing with fw_dir - fw_dir=${fw_dir//:/ } - --- -1.8.1.4 - diff --git a/0011-mkinitrd-suse-Add-SUSE-compability-wrapper-for-dracu.patch b/0011-mkinitrd-suse-Add-SUSE-compability-wrapper-for-dracu.patch deleted file mode 100644 index 608c9b7..0000000 --- a/0011-mkinitrd-suse-Add-SUSE-compability-wrapper-for-dracu.patch +++ /dev/null @@ -1,378 +0,0 @@ -From 48b0614371e7fabee84a45132771b9427091efa9 Mon Sep 17 00:00:00 2001 -From: Hannes Reinecke -Date: Thu, 28 Nov 2013 10:53:57 +0100 -Subject: [PATCH] mkinitrd-suse: Add SUSE compability wrapper for dracut - -SUSE has its own mkinitrd system. As the arguments clash -with the dracut-provided mkinitrd script I've added a new -mkinitrd-suse.sh wrapper. - -Signed-off-by: Hannes Reinecke ---- - mkinitrd-suse.sh | 354 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ - 1 file changed, 354 insertions(+) - create mode 100755 mkinitrd-suse.sh - -diff --git a/mkinitrd-suse.sh b/mkinitrd-suse.sh -new file mode 100755 -index 0000000..d20270a ---- /dev/null -+++ b/mkinitrd-suse.sh -@@ -0,0 +1,354 @@ -+#!/bin/bash --norc -+# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*- -+# ex: ts=8 sw=4 sts=4 et filetype=sh -+# -+# mkinitrd compability wrapper for SUSE. -+# -+# Copyright (c) 2013 SUSE Linux Products GmbH. All rights reserved. -+# -+# This program is free software; you can redistribute it and/or modify -+# it under the terms of the GNU General Public License as published by -+# the Free Software Foundation; either version 2 of the License, or -+# (at your option) any later version. -+# -+# This program is distributed in the hope that it will be useful, -+# but WITHOUT ANY WARRANTY; without even the implied warranty of -+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -+# GNU General Public License for more details. -+# -+# You should have received a copy of the GNU General Public License -+# along with this program. If not, see . -+# -+ -+boot_dir="/boot" -+quiet=0 -+host_only=1 -+force=0 -+logfile=/var/log/YaST2/mkinitrd.log -+dracut_cmd=dracut -+ -+error() { echo "$@" >&2; } -+ -+usage () { -+ [[ $1 = '-n' ]] && cmd=echo || cmd=error -+ -+ $cmd "usage: ${0##*/} [options]" -+ $cmd "" -+ $cmd " Create initial ramdisk images that contain all kernel modules needed" -+ $cmd " in the early boot process, before the root file system becomes" -+ $cmd " available." -+ $cmd " This usually includes SCSI and/or RAID modules, a file system module" -+ $cmd " for the root file system, or a network interface driver module for dhcp." -+ $cmd "" -+ $cmd " options:" -+ $cmd " -f \"feature list\" Features to be enabled when generating initrd." -+ $cmd " Available features are:" -+ $cmd " iscsi, md, multipath, lvm, lvm2," -+ $cmd " ifup, fcoe, dcbd" -+ $cmd " -k \"kernel list\" List of kernel images for which initrd files are" -+ $cmd " created. Defaults to all kernels found in /boot." -+ $cmd " -i \"initrd list\" List of file names for the initrd; position have" -+ $cmd " match to \"kernel list\". Defaults to all kernels" -+ $cmd " found in /boot." -+ $cmd " -b boot_dir Boot directory. Defaults to /boot." -+ $cmd " -t tmp_dir Temporary directory. Defaults to /var/tmp." -+ $cmd " -M map System.map file to use." -+ $cmd " -A Create a so called \"monster initrd\" which" -+ $cmd " includes all features and modules possible." -+ $cmd " -B Do not update bootloader configuration." -+ $cmd " -v Verbose mode." -+ $cmd " -L Disable logging." -+ $cmd " -h This help screen." -+ $cmd " -m \"module list\" Modules to include in initrd. Defaults to the" -+ $cmd " INITRD_MODULES variable in /etc/sysconfig/kernel" -+ $cmd " -u \"DomU module list\" Modules to include in initrd. Defaults to the" -+ $cmd " DOMU_INITRD_MODULES variable in" -+ $cmd " /etc/sysconfig/kernel." -+ $cmd " -d root_device Root device. Defaults to the device from" -+ $cmd " which / is mounted. Overrides the rootdev" -+ $cmd " enviroment variable if set." -+ $cmd " -j device Journal device" -+ $cmd " -D interface Run dhcp on the specified interface." -+ $cmd " -I interface Configure the specified interface statically." -+ $cmd " -a acpi_dsdt Attach compiled ACPI DSDT (Differentiated" -+ $cmd " System Description Table) to initrd. This" -+ $cmd " replaces the DSDT of the BIOS. Defaults to" -+ $cmd " the ACPI_DSDT variable in /etc/sysconfig/kernel." -+ $cmd " -s size Add splash animation and bootscreen to initrd." -+ -+ [[ $1 = '-n' ]] && exit 0 -+ exit 1 -+} -+ -+# Little helper function for reading args from the commandline. -+# it automatically handles -a b and -a=b variants, and returns 1 if -+# we need to shift $3. -+read_arg() { -+ # $1 = arg name -+ # $2 = arg value -+ # $3 = arg parameter -+ param="$1" -+ local rematch='^[^=]*=(.*)$' result -+ if [[ $2 =~ $rematch ]]; then -+ read "$param" <<< "${BASH_REMATCH[1]}" -+ else -+ for ((i=3; $i <= $#; i++)); do -+ # Only read next arg if it not an arg itself. -+ if [[ ${@:$i:1} = -* ]];then -+ break -+ fi -+ result="$result ${@:$i:1}" -+ # There is no way to shift our callers args, so -+ # return "no of args" to indicate they should do it instead. -+ done -+ read "$1" <<< "$result" -+ return $(($i - 3)) -+ fi -+} -+ -+# Helper functions to calculate ipconfig command line -+calc_netmask() { -+ local prefix=$1 -+ -+ [ -z "$prefix" ] && return -+ mask=$(echo "(2 ^ 32) - (2 ^ $prefix)" | bc -l) -+ byte1=$(( mask >> 24 )) -+ byte2=$(( mask >> 16 )) -+ byte3=$(( mask >> 8 )) -+ byte4=$(( mask & 0xff )) -+ netmask=$(printf "%d.%d.%d.%d" $(( byte1 & 0xff )) $(( byte2 & 0xff )) $(( byte3 & 0xff )) $byte4); -+ -+ echo $netmask -+} -+ -+ipconfig() { -+ local interface=$1 -+ local iplink macaddr broadcast gateway ipaddr prefix netmask -+ -+ iplink=$(ip addr show dev $interface | sed -n 's/ *inet \(.*\) brd.*/\1/p') -+ macaddr=$(ip addr show dev $interface | sed -n 's/.*ether \(.*\) brd.*/\1/p') -+ broadcast=$(ip addr show dev $interface | sed -n 's/.*brd \(.*\) scope.*/\1/p') -+ gateway=$(ip route show dev $interface | sed -n 's/default via \([0-9\.]*\).*/\1/p') -+ -+ ipaddr=${iplink%%/*} -+ prefix=${iplink##*/} -+ netmask=$(calc_netmask $prefix) -+ -+ echo "${ipaddr}:${serveraddr}:${gateway}:${netmask}:${hostname}:${interface}:none::${macaddr}" -+} -+ -+is_xen_kernel() { -+ local kversion=$1 -+ local root_dir=$2 -+ local cfg -+ -+ for cfg in ${root_dir}/boot/config-$kversion $root_dir/lib/modules/$kversion/build/.config -+ do -+ test -r $cfg || continue -+ grep -q "^CONFIG_XEN=y\$" $cfg -+ return -+ done -+ test $kversion != "${kversion%-xen*}" -+ return -+} -+ -+ -+# Taken over from SUSE mkinitrd -+default_kernel_images() { -+ local regex kernel_image kernel_version version_version initrd_image -+ local qf='%{NAME}-%{VERSION}-%{RELEASE}\n' -+ -+ case "$(uname -m)" in -+ s390|s390x) -+ regex='image' -+ ;; -+ ppc|ppc64) -+ regex='vmlinux' -+ ;; -+ i386|x86_64) -+ regex='vmlinuz' -+ ;; -+ arm*) -+ regex='[uz]Image' -+ ;; -+ aarch64) -+ regex='Image' -+ ;; -+ *) regex='vmlinu.' -+ ;; -+ esac -+ -+ kernel_images="" -+ initrd_images="" -+ for kernel_image in $(ls $boot_dir \ -+ | sed -ne "\|^$regex\(-[0-9.]\+-[0-9]\+-[a-z0-9]\+$\)\?|p" \ -+ | grep -v kdump$ ) ; do -+ -+ # Note that we cannot check the RPM database here -- this -+ # script is itself called from within the binary kernel -+ # packages, and rpm does not allow recursive calls. -+ -+ [ -L "$boot_dir/$kernel_image" ] && continue -+ [ "${kernel_image%%.gz}" != "$kernel_image" ] && continue -+ kernel_version=$(/usr/bin/get_kernel_version \ -+ $boot_dir/$kernel_image 2> /dev/null) -+ initrd_image=$(echo $kernel_image | sed -e "s|${regex}|initrd|") -+ if [ "$kernel_image" != "$initrd_image" -a \ -+ -n "$kernel_version" -a \ -+ -d "/lib/modules/$kernel_version" ]; then -+ kernel_images="$kernel_images $boot_dir/$kernel_image" -+ initrd_images="$initrd_images $boot_dir/$initrd_image" -+ fi -+ done -+ for kernel_image in $kernel_images;do -+ kernels="$kernels ${kernel_image#*-}" -+ done -+ for initrd_image in $initrd_images;do -+ targets="$targets $initrd_image" -+ done -+ host_only=1 -+ force=1 -+} -+ -+while (($# > 0)); do -+ case ${1%%=*} in -+ -f) read_arg feature_list "$@" || shift $? -+ # Could be several features -+ ;; -+ -k) # Would be nice to get a list of images here -+ read_arg kernel_images "$@" || shift $? -+ for kernel_image in $kernel_images;do -+ kernels="$kernels ${kernel_image#*-}" -+ done -+ host_only=1 -+ force=1 -+ ;; -+ -i) read_arg initrd_images "$@" || shift $? -+ for initrd_image in $initrd_images;do -+ # Check if the initrd_image contains a path. -+ # if not, then add the default boot_dir -+ dname=`dirname $initrd_image` -+ if [ "$dname" == "." ]; then -+ targets="$targets $boot_dir/$initrd_image"; -+ else -+ targets="$targets $initrd_image"; -+ fi -+ done -+ ;; -+ -b) read_arg boot_dir "$@" || shift $? -+ if [ ! -d $boot_dir ];then -+ error "Boot directory $boot_dir does not exist" -+ exit 1 -+ fi -+ ;; -+ -t) read_arg tmp_dir "$@" || shift $? -+ dracut_args="${dracut_args} --tmpdir $tmp_dir" -+ ;; -+ -M) read_arg map_file "$@" || shift $? -+ ;; -+ -A) host_only=0;; -+ -B) skip_update_bootloader=1;; -+ -v|--verbose) dracut_args="${dracut_args} -v";; -+ -L) logfile=;; -+ -h|--help) usage -n;; -+ -m) read_arg module_list "$@" || shift $? ;; -+ -u) read_arg domu_module_list "$@" || shift $? -+ echo "mkinitrd: DomU modules not yet supported" ;; -+ -d) read_arg rootfs "$@" || shift $? -+ dracut_args="${dracut_args} --filesystems $rootfs" ;; -+ -D) read_arg dhcp_if "$@" || shift $? -+ dracut_cmdline="${dracut_cmdline} ip=${dhcp_if}:dhcp" -+ ;; -+ -I) read_arg static_if "$@" || shift $? -+ dracut_cmdline="${dracut_cmdline} ip=$(ipconfig $static_if)": -+ ;; -+ -a) read_arg acpi_dsdt "$@" || shift $? -+ echo "mkinitrd: custom DSDT not yet supported" -+ exit 1 -+ ;; -+ -s) read_arg boot_splash "$@" || shift $? -+ echo "mkinitrd: boot splash not yet supported" -+ exit 1 -+ ;; -+ -V) echo "mkinitrd: vendor scipts are no longer supported" -+ exit 1;; -+ --dracut) -+ read_arg dracut_cmd "$@" || shift $? ;; -+ --version|-R) -+ echo "mkinitrd: dracut compatibility wrapper" -+ exit 0;; -+ --force) force=1;; -+ --quiet|-q) quiet=1;; -+ *) if [[ ! $targets ]]; then -+ targets=$1 -+ elif [[ ! $kernels ]]; then -+ kernels=$1 -+ else -+ usage -+ fi;; -+ esac -+ shift -+done -+ -+[[ $targets && $kernels ]] || default_kernel_images -+[[ $targets && $kernels ]] || (error "No kernel found in $boot_dir" && usage) -+ -+# We can have several targets/kernels, transform the list to an array -+targets=( $targets ) -+[[ $kernels ]] && kernels=( $kernels ) -+ -+[[ $logfile ]] && dracut_args="${dracut_args} --logfile $logfile" -+[[ $host_only == 1 ]] && dracut_args="${dracut_args} --hostonly" -+[[ $force == 1 ]] && dracut_args="${dracut_args} --force" -+[[ $dracut_cmdline ]] && dracut_args="${dracut_args} --kernel-cmdline ${dracut_cmdline}" -+[ -z "$(type -p update-bootloader)" ] && skip_update_bootloader=1 -+ -+# Update defaults from /etc/sysconfig/kernel -+if [ -f /etc/sysconfig/kernel ] ; then -+ . /etc/sysconfig/kernel -+fi -+[[ $module_list ]] || module_list="${INITRD_MODULES}" -+basicmodules="$basicmodules ${module_list}" -+[[ $domu_module_list ]] || domu_module_list="${DOMU_INITRD_MODULES}" -+[[ $acpi_dsdt ]] || acpi_dsdt="${ACPI_DSDT}" -+ -+echo "Creating: target|kernel|dracut args|basicmodules " -+for ((i=0 ; $i<${#targets[@]} ; i++)); do -+ -+ if [[ $img_vers ]];then -+ target="${targets[$i]}-${kernels[$i]}" -+ else -+ target="${targets[$i]}" -+ fi -+ kernel="${kernels[$i]}" -+ -+ # Duplicate code: No way found how to redirect output based on $quiet -+ if [[ $quiet == 1 ]];then -+ echo "$target|$kernel|$dracut_args|$basicmodules" -+ if is_xen_kernel $kernel $rootfs ; then -+ basicmodules="$basicmodules ${domu_module_list}" -+ fi -+ if [[ $basicmodules ]]; then -+ $dracut_cmd $dracut_args --add-drivers "$basicmodules" "$target" \ -+ "$kernel" &>/dev/null -+ else -+ $dracut_cmd $dracut_args "$target" "$kernel" &>/dev/null -+ fi -+ else -+ if is_xen_kernel $kernel $rootfs ; then -+ basicmodules="$basicmodules ${domu_module_list}" -+ fi -+ if [[ $basicmodules ]]; then -+ $dracut_cmd $dracut_args --add-drivers "$basicmodules" "$target" \ -+ "$kernel" -+ else -+ $dracut_cmd $dracut_args "$target" "$kernel" -+ fi -+ fi -+done -+ -+if [ "$skip_update_bootloader" ] ; then -+ echo 2>&1 "Did not refresh the bootloader. You might need to refresh it manually." -+else -+ update-bootloader --refresh -+fi --- -1.8.1.4 - diff --git a/0012-mkinitrd-suse.8.asc-Add-manpage-for-SUSE-compat-mkin.patch b/0012-mkinitrd-suse.8.asc-Add-manpage-for-SUSE-compat-mkin.patch deleted file mode 100644 index 6cd0254..0000000 --- a/0012-mkinitrd-suse.8.asc-Add-manpage-for-SUSE-compat-mkin.patch +++ /dev/null @@ -1,139 +0,0 @@ -From ed220c000020db2d883e798cbfa51e80e289b218 Mon Sep 17 00:00:00 2001 -From: Hannes Reinecke -Date: Fri, 29 Nov 2013 08:01:34 +0100 -Subject: [PATCH] mkinitrd-suse.8.asc: Add manpage for SUSE compat mkinitrd - -Signed-off-by: Hannes Reinecke ---- - Makefile | 1 + - mkinitrd-suse.8.asc | 106 ++++++++++++++++++++++++++++++++++++++++++++++++++++ - 2 files changed, 107 insertions(+) - create mode 100644 mkinitrd-suse.8.asc - -diff --git a/Makefile b/Makefile -index e7da948..ba551cf 100644 ---- a/Makefile -+++ b/Makefile -@@ -27,6 +27,7 @@ man7pages = dracut.cmdline.7 \ - man8pages = dracut.8 \ - dracut-catimages.8 \ - mkinitrd.8 \ -+ mkinitrd-suse.8 \ - modules.d/98systemd/dracut-cmdline.service.8 \ - modules.d/98systemd/dracut-initqueue.service.8 \ - modules.d/98systemd/dracut-mount.service.8 \ -diff --git a/mkinitrd-suse.8.asc b/mkinitrd-suse.8.asc -new file mode 100644 -index 0000000..9eb8fc9 ---- /dev/null -+++ b/mkinitrd-suse.8.asc -@@ -0,0 +1,106 @@ -+MKINITRD(8) -+=========== -+:doctype: manpage -+:man source: dracut -+:man manual: dracut -+ -+NAME -+---- -+mkinitrd-suse - is a compat wrapper, which calls dracut to generate an initramfs -+ -+SYNOPSIS -+-------- -+*mkinitrd* ['OPTION...'] -+ -+DESCRIPTION -+----------- -+*mkinitrd* creates an initramfs image for the kernel with -+version by calling *dracut*. -+ -+[IMPORTANT] -+This version of mkinitrd is provided for compability with older -+versions of mkinitrd. If a more fine grained control over the -+resulting image is needed, *dracut* should be called directly. -+ -+OPTIONS -+------- -+**-R, --version**:: -+ print info about the version -+ -+**-k** __:: -+ List of kernel images for which initrd files are created (relative -+ to _boot_dir_), defaults to _vmlinux_ on ppc/ppc64, _image_ on s390/s390x -+ and _vmlinuz_ for everything else. -+ -+**-i** __:: -+ List of file names (relative to _boot_dir_) for the initrd; positions -+ have to match the _kernel_list_. Defaults to _initrd_. -+ -+**-m** __:: -+ Modules to include in initrd, defaults to _INITRD_MODULES_ variable -+ in */etc/sysconfig/kernel*. -+ -+**-f** __:: -+ Features to be enabled for the initrd. In general mkinitrd -+ configures the initrd for the root device it is started from. With -+ this option additional feature can be enabled. -+ -+**-b** __:: -+ Boot directory, defaults to */boot*, where the initrd is created. -+ -+**-d** __:: -+ Root device, defaults to the device from which the root_dir is -+ mounted; overwrites the rootdev enviroment variable if set -+ -+**-s** __:: -+ Add splash animation and bootscreen to initrd. -+ -+**-D** _:: -+ Run dhcp on the specified interface (for example "eth0"). -+ -+**-I** _:: -+ Configure the specified interface statically. -+ -+**-a** _:: -+ Attach compiled ACPI DSDT (Differentiated System Description Table) -+ to initrd. This replaces the DSDT of the BIOS. Defaults to the -+ _ACPI_DSDT_ variable in */etc/sysconfig/kernel*. -+ -+**-M** _:: -+ System.map file to use. -+ -+**-B**:: -+ Don’t run the *update-bootloader(8)* script after the initrd(s) have -+ been created. This is useful if you call mkinitrd(8) for anything -+ else than the running system. -+ -+**-A**:: -+ Create a so called "monster initrd" which includes all available -+ features and modules. -+ -+**-v, --verbose**:: -+ increase verbosity level -+ -+**-L**:: -+ Disable logging to _/var/log/YaST2/mkinitrd.log_. This is useful for -+ testing if you don’t want to clutter the system log. -+ -+**--force**:: -+ overwrite existing initramfs file. -+ -+**--help**:: -+ print a help message and exit. -+ -+AVAILABILITY -+------------ -+The mkinitrd command is part of the dracut package and is available from -+link:$$https://dracut.wiki.kernel.org$$[https://dracut.wiki.kernel.org] -+ -+AUTHORS -+------- -+Harald Hoyer, Hannes Reinecke -+ -+SEE ALSO -+-------- -+*dracut*(8) -+*update-bootloader*(8) --- -1.8.1.4 - diff --git a/0013-Correct-paths-for-openSUSE.patch b/0013-Correct-paths-for-openSUSE.patch index 8d5521b..b706ecd 100644 --- a/0013-Correct-paths-for-openSUSE.patch +++ b/0013-Correct-paths-for-openSUSE.patch @@ -14,11 +14,11 @@ Signed-off-by: Hannes Reinecke modules.d/98systemd/rescue.service | 2 +- 3 files changed, 4 insertions(+), 2 deletions(-) -diff --git a/dracut.sh b/dracut.sh -index 5f63d94..8680874 100755 ---- a/dracut.sh -+++ b/dracut.sh -@@ -683,7 +683,7 @@ stdloglvl=$((stdloglvl + verbosity_mod_l)) +Index: dracut-034/dracut.sh +=================================================================== +--- dracut-034.orig/dracut.sh ++++ dracut-034/dracut.sh +@@ -683,7 +683,7 @@ stdloglvl=$((stdloglvl + verbosity_mod_l [[ $mdadmconf_l ]] && mdadmconf=$mdadmconf_l [[ $lvmconf_l ]] && lvmconf=$lvmconf_l [[ $dracutbasedir ]] || dracutbasedir=/usr/lib/dracut @@ -27,11 +27,11 @@ index 5f63d94..8680874 100755 [[ $tmpdir_l ]] && tmpdir="$tmpdir_l" [[ $tmpdir ]] || tmpdir=/var/tmp [[ $INITRD_COMPRESS ]] && compress=$INITRD_COMPRESS -diff --git a/modules.d/10i18n/module-setup.sh b/modules.d/10i18n/module-setup.sh -index f07b148..3854a38 100755 ---- a/modules.d/10i18n/module-setup.sh -+++ b/modules.d/10i18n/module-setup.sh -@@ -102,6 +102,8 @@ install() { +Index: dracut-034/modules.d/10i18n/module-setup.sh +=================================================================== +--- dracut-034.orig/modules.d/10i18n/module-setup.sh ++++ dracut-034/modules.d/10i18n/module-setup.sh +@@ -98,6 +98,8 @@ install() { install_base() { inst_multiple setfont loadkeys kbd_mode stty @@ -40,10 +40,10 @@ index f07b148..3854a38 100755 if ! dracut_module_included "systemd"; then inst ${moddir}/console_init.sh /lib/udev/console_init -diff --git a/modules.d/98systemd/rescue.service b/modules.d/98systemd/rescue.service -index edc2461..d80900f 100644 ---- a/modules.d/98systemd/rescue.service -+++ b/modules.d/98systemd/rescue.service +Index: dracut-034/modules.d/98systemd/rescue.service +=================================================================== +--- dracut-034.orig/modules.d/98systemd/rescue.service ++++ dracut-034/modules.d/98systemd/rescue.service @@ -16,7 +16,7 @@ Environment=HOME=/ Environment=DRACUT_SYSTEMD=1 Environment=NEWROOT=/sysroot @@ -53,6 +53,3 @@ index edc2461..d80900f 100644 ExecStart=-/bin/sh -i -l ExecStopPost=-/bin/rm -f -- /.console_lock ExecStopPost=-/usr/bin/systemctl --fail --no-block default --- -1.8.1.4 - diff --git a/0015-Fixup-script-permissions.patch b/0015-Fixup-script-permissions.patch deleted file mode 100644 index 86dc4c1..0000000 --- a/0015-Fixup-script-permissions.patch +++ /dev/null @@ -1,49 +0,0 @@ -From 96a44d8e982838a01e3d8f2a62941a9af0952b95 Mon Sep 17 00:00:00 2001 -From: Hannes Reinecke -Date: Fri, 29 Nov 2013 11:36:02 +0100 -Subject: [PATCH] Fixup script permissions - -Scripts with a shebang should be marked as executable. - -Signed-off-by: Hannes Reinecke ---- - modules.d/03modsign/load-modsign-keys.sh | 0 - modules.d/03modsign/module-setup.sh | 0 - modules.d/40network/net-lib.sh | 0 - modules.d/40network/parse-vlan.sh | 0 - modules.d/50drm/module-setup.sh | 0 - modules.d/91crypt-loop/crypt-loop-lib.sh | 0 - modules.d/98pollcdrom/pollcdrom.sh | 0 - 7 files changed, 0 insertions(+), 0 deletions(-) - mode change 100644 => 100755 modules.d/03modsign/load-modsign-keys.sh - mode change 100644 => 100755 modules.d/03modsign/module-setup.sh - mode change 100644 => 100755 modules.d/40network/net-lib.sh - mode change 100644 => 100755 modules.d/40network/parse-vlan.sh - mode change 100644 => 100755 modules.d/50drm/module-setup.sh - mode change 100644 => 100755 modules.d/91crypt-loop/crypt-loop-lib.sh - mode change 100644 => 100755 modules.d/98pollcdrom/pollcdrom.sh - -diff --git a/modules.d/03modsign/load-modsign-keys.sh b/modules.d/03modsign/load-modsign-keys.sh -old mode 100644 -new mode 100755 -diff --git a/modules.d/03modsign/module-setup.sh b/modules.d/03modsign/module-setup.sh -old mode 100644 -new mode 100755 -diff --git a/modules.d/40network/net-lib.sh b/modules.d/40network/net-lib.sh -old mode 100644 -new mode 100755 -diff --git a/modules.d/40network/parse-vlan.sh b/modules.d/40network/parse-vlan.sh -old mode 100644 -new mode 100755 -diff --git a/modules.d/50drm/module-setup.sh b/modules.d/50drm/module-setup.sh -old mode 100644 -new mode 100755 -diff --git a/modules.d/91crypt-loop/crypt-loop-lib.sh b/modules.d/91crypt-loop/crypt-loop-lib.sh -old mode 100644 -new mode 100755 -diff --git a/modules.d/98pollcdrom/pollcdrom.sh b/modules.d/98pollcdrom/pollcdrom.sh -old mode 100644 -new mode 100755 --- -1.8.1.4 - diff --git a/0016-Remove-shebang-from-shell-completion-files.patch b/0016-Remove-shebang-from-shell-completion-files.patch deleted file mode 100644 index 31b8383..0000000 --- a/0016-Remove-shebang-from-shell-completion-files.patch +++ /dev/null @@ -1,37 +0,0 @@ -From d29f993d5a4205f918c5fefb7e03dabc1062e11b Mon Sep 17 00:00:00 2001 -From: Hannes Reinecke -Date: Fri, 29 Nov 2013 12:46:24 +0100 -Subject: [PATCH] Remove shebang from shell-completion files - -Shell-completion files are meant to be sourced, not executed. -So they shouldn't have a shebang at the start. - -Signed-off-by: Hannes Reinecke ---- - dracut-bash-completion.sh | 2 +- - lsinitrd-bash-completion.sh | 2 +- - 2 files changed, 2 insertions(+), 2 deletions(-) - -diff --git a/dracut-bash-completion.sh b/dracut-bash-completion.sh -index d796c35..9f359c6 100644 ---- a/dracut-bash-completion.sh -+++ b/dracut-bash-completion.sh -@@ -1,4 +1,4 @@ --#!/bin/bash -+# - # -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*- - # ex: ts=8 sw=4 sts=4 et filetype=sh - # -diff --git a/lsinitrd-bash-completion.sh b/lsinitrd-bash-completion.sh -index 78ab165..3df2965 100644 ---- a/lsinitrd-bash-completion.sh -+++ b/lsinitrd-bash-completion.sh -@@ -1,4 +1,4 @@ --#!/bin/bash -+# - # -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*- - # ex: ts=8 sw=4 sts=4 et filetype=sh - # --- -1.8.1.4 - diff --git a/dracut.changes b/dracut.changes index 92d929a..e030a2d 100644 --- a/dracut.changes +++ b/dracut.changes @@ -1,3 +1,35 @@ +------------------------------------------------------------------- +Mon Jan 13 17:52:51 UTC 2014 - trenn@suse.de + +Exit without calling update-bootloader (bnc#858268): +Add: dracut_do_not_update_booloader_if_no_kernel_is_found.patch + +Adding: +Requires: systemd-sysvinit +which has reboot, halt and other binaries dracut likes to add to the initrd. + +Cleanup and adjust to latest mainline: +Dropping as these are included in the latest update_git_v034_to_head patch: +Drop: 0001-95dasd-Install-kernel-modules-only-once.patch +Drop: 0002-95dasd-Only-install-module-if-normalize_dasd_arg-is-.patch +Drop: 0003-95dasd_mod-make-dasd_cio_free-optional.patch +Drop: 0004-95zfcp-Make-installation-optional.patch +Drop: 0005-95znet-Make-installation-optional.patch +Drop: 0007-Fixup-keymap-setting-for-openSUSE.patch +Drop: 0008-Add-DASD-configuration-for-SuSE.patch +Drop: 0009-Add-zfcp-scripts-for-SUSE.patch +Drop: 0010-Make-logfile-configurable.patch +Drop: 0011-mkinitrd-suse-Add-SUSE-compability-wrapper-for-dracu.patch +Drop: 0012-mkinitrd-suse.8.asc-Add-manpage-for-SUSE-compat-mkin.patch +Drop: 0015-Fixup-script-permissions.patch +Drop: 0016-Remove-shebang-from-shell-completion-files.patch +Drop: dracut-git-update.patch + +Rebase: 0013-Correct-paths-for-openSUSE.patch + +This is a rename of dracut-git-update.patch to: +Add: dracut_git_v034_to_head.patch + ------------------------------------------------------------------- Fri Dec 20 14:17:54 UTC 2013 - trenn@suse.de diff --git a/dracut.spec b/dracut.spec index 9214d93..5943535 100644 --- a/dracut.spec +++ b/dracut.spec @@ -1,7 +1,7 @@ # # spec file for package dracut # -# Copyright (c) 2013 SUSE LINUX Products GmbH, Nuernberg, Germany. +# Copyright (c) 2014 SUSE LINUX Products GmbH, Nuernberg, Germany. # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -35,27 +35,12 @@ Source3: mkinitrd_setup_dummy Source4: purge-kernels Source5: purge-kernels.service -Patch0: dracut-git-update.patch # S/390 fixes, send to upstream -Patch1: 0001-95dasd-Install-kernel-modules-only-once.patch -Patch2: 0002-95dasd-Only-install-module-if-normalize_dasd_arg-is-.patch -Patch3: 0003-95dasd_mod-make-dasd_cio_free-optional.patch -Patch4: 0004-95zfcp-Make-installation-optional.patch -Patch5: 0005-95znet-Make-installation-optional.patch -Patch6: 0006-Install-bin-mount.patch -Patch7: 0007-Fixup-keymap-setting-for-openSUSE.patch -Patch8: 0008-Add-DASD-configuration-for-SuSE.patch -Patch9: 0009-Add-zfcp-scripts-for-SUSE.patch -Patch10: 0010-Make-logfile-configurable.patch -Patch11: 0011-mkinitrd-suse-Add-SUSE-compability-wrapper-for-dracu.patch -Patch12: 0012-mkinitrd-suse.8.asc-Add-manpage-for-SUSE-compat-mkin.patch - -# SUSE specific patches -Patch20: 0013-Correct-paths-for-openSUSE.patch -Patch21: 0014-Check-for-plymouth-lib-directories.patch -Patch22: 0015-Fixup-script-permissions.patch -Patch23: 0016-Remove-shebang-from-shell-completion-files.patch - +Patch1: dracut_git_v034_to_head.patch +Patch10: 0006-Install-bin-mount.patch +Patch11: 0013-Correct-paths-for-openSUSE.patch +Patch12: 0014-Check-for-plymouth-lib-directories.patch +Patch13: dracut_do_not_update_booloader_if_no_kernel_is_found.patch BuildRequires: bash BuildRoot: %{_tmppath}/%{name}-%{version}-build @@ -81,6 +66,8 @@ Requires: systemd >= 200 Requires: udev > 166 Requires: util-linux >= 2.21 Requires: xz +# systemd-sysvinit provides: poweroff, reboot, halt +Requires: systemd-sysvinit Recommends: binutils Recommends: logrotate Requires: pigz @@ -125,23 +112,11 @@ This package contains tools to assemble the local initrd and host configuration. %prep %setup -q -%patch0 -p1 %patch1 -p1 -%patch2 -p1 -%patch3 -p1 -%patch4 -p1 -%patch5 -p1 -%patch6 -p1 -%patch7 -p1 -%patch8 -p1 -%patch9 -p1 %patch10 -p1 %patch11 -p1 %patch12 -p1 -%patch20 -p1 -%patch21 -p1 -%patch22 -p1 -%patch23 -p1 +%patch13 -p1 %build %configure\ @@ -215,7 +190,6 @@ rm -rf %{buildroot} %doc README HACKING TODO COPYING AUTHORS NEWS dracut.html dracut.png dracut.svg %{_bindir}/dracut /sbin/purge-kernels -%{_unitdir}/purge-kernels.service /sbin/mkinitrd /sbin/mkinitrd_setup %{_bindir}/lsinitrd @@ -337,6 +311,8 @@ rm -rf %{buildroot} %{dracutlibdir}/modules.d/95ssh-client %{dracutlibdir}/modules.d/45ifcfg %{dracutlibdir}/modules.d/95znet +%{dracutlibdir}/modules.d/95fcoe-uefi +%{dracutlibdir}/modules.d/99uefi-lib %files caps %defattr(-,root,root,0755) diff --git a/dracut_do_not_update_booloader_if_no_kernel_is_found.patch b/dracut_do_not_update_booloader_if_no_kernel_is_found.patch new file mode 100644 index 0000000..e5b416f --- /dev/null +++ b/dracut_do_not_update_booloader_if_no_kernel_is_found.patch @@ -0,0 +1,13 @@ +Index: dracut-034/mkinitrd-suse.sh +=================================================================== +--- dracut-034.orig/mkinitrd-suse.sh ++++ dracut-034/mkinitrd-suse.sh +@@ -291,7 +291,7 @@ while (($# > 0)); do + done + + [[ $targets && $kernels ]] || default_kernel_images +-[[ $targets && $kernels ]] || (error "No kernel found in $boot_dir" && usage) ++[[ $targets && $kernels ]] || error "No kernel found in $boot_dir" && usage -n + + # We can have several targets/kernels, transform the list to an array + targets=( $targets ) diff --git a/dracut-git-update.patch b/dracut_git_v034_to_head.patch similarity index 59% rename from dracut-git-update.patch rename to dracut_git_v034_to_head.patch index e0e987c..e79df79 100644 --- a/dracut-git-update.patch +++ b/dracut_git_v034_to_head.patch @@ -1,16 +1,8 @@ -From: Hannes Reinecke -Subject: Dracut git update - -This patch updates dracut 034 to -git commit 28609baf6e9581ea97c4550340e2a6031c1b6fbd - -Signed-off-by: Hannes Reinecke - diff --git a/Makefile b/Makefile -index 124a41b..e7da948 100644 +index 124a41b..fed5f48 100644 --- a/Makefile +++ b/Makefile -@@ -21,7 +21,8 @@ man1pages = lsinitrd.1 +@@ -21,11 +21,13 @@ man1pages = lsinitrd.1 man5pages = dracut.conf.5 man7pages = dracut.cmdline.7 \ @@ -20,7 +12,12 @@ index 124a41b..e7da948 100644 man8pages = dracut.8 \ dracut-catimages.8 \ -@@ -37,7 +38,6 @@ man8pages = dracut.8 \ + mkinitrd.8 \ ++ mkinitrd-suse.8 \ + modules.d/98systemd/dracut-cmdline.service.8 \ + modules.d/98systemd/dracut-initqueue.service.8 \ + modules.d/98systemd/dracut-mount.service.8 \ +@@ -37,7 +39,6 @@ man8pages = dracut.8 \ manpages = $(man1pages) $(man5pages) $(man7pages) $(man8pages) @@ -28,7 +25,23 @@ index 124a41b..e7da948 100644 .PHONY: install clean archive rpm testimage test all check AUTHORS doc dracut-version.sh all: dracut-version.sh dracut-install -@@ -76,7 +76,9 @@ endif +@@ -46,6 +47,7 @@ DRACUT_INSTALL_OBJECTS = \ + install/dracut-install.o \ + install/hashmap.o\ + install/log.o \ ++ install/strv.o \ + install/util.o + + # deps generated with gcc -MM +@@ -55,6 +57,7 @@ install/hashmap.o: install/hashmap.c install/util.h install/macro.h install/log. + install/hashmap.h + install/log.o: install/log.c install/log.h install/macro.h install/util.h + install/util.o: install/util.c install/util.h install/macro.h install/log.h ++install/strv.o: install/strv.c install/strv.h install/util.h install/macro.h install/log.h + + install/dracut-install: $(DRACUT_INSTALL_OBJECTS) + +@@ -76,7 +79,9 @@ endif %.xml: %.asc asciidoc -d manpage -b docbook -o $@ $< @@ -39,8 +52,30 @@ index 124a41b..e7da948 100644 asciidoc -a numbered -d book -b docbook -o dracut.xml dracut.asc xsltproc -o dracut.html --xinclude -nonet \ --stringparam custom.css.source dracut.css \ +diff --git a/TODO b/TODO +index 4e52fbf..875541d 100644 +--- a/TODO ++++ b/TODO +@@ -22,6 +22,7 @@ INITRAMFS TODO + + GENERATOR TODO + ++- report errors on missing files in check() + - remove wait for swap devs, if no "resume=" is given on the kernel command line + - add presets (predefined set of modules) + - add interpreter/plugin-scripts to be sourced at the beginning or end (can use dracut-functions) +diff --git a/dracut-bash-completion.sh b/dracut-bash-completion.sh +index d796c35..9f359c6 100644 +--- a/dracut-bash-completion.sh ++++ b/dracut-bash-completion.sh +@@ -1,4 +1,4 @@ +-#!/bin/bash ++# + # -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*- + # ex: ts=8 sw=4 sts=4 et filetype=sh + # diff --git a/dracut-functions.sh b/dracut-functions.sh -index 45e0911..2872516 100755 +index 45e0911..7cfa097 100755 --- a/dracut-functions.sh +++ b/dracut-functions.sh @@ -65,6 +65,7 @@ ldconfig_paths() @@ -78,7 +113,56 @@ index 45e0911..2872516 100755 _ret=0 fi check_vol_slaves "$@" && return 0 -@@ -1480,7 +1481,7 @@ dracut_kernel_post() { +@@ -898,6 +899,34 @@ inst_rules() { + 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 ++ if [[ -e $_rule ]]; then ++ inst_rule_programs "$_rule" ++ inst_rule_group_owner "$_rule" ++ inst_rule_initqueue "$_rule" ++ inst_simple "$_rule" ++ _found=$_rule ++ fi ++ done ++ if [ -n ${hostonly} ] ; then ++ for _rule in ${_target}/$1 ; do ++ if [[ -f $_rule ]]; then ++ inst_rule_programs "$_rule" ++ inst_rule_group_owner "$_rule" ++ inst_rule_initqueue "$_rule" ++ inst_simple "$_rule" ++ _found=$_rule ++ fi ++ done ++ fi ++ [[ $_found ]] || dinfo "Skipping udev rule: $_rule" ++} ++ + prepare_udev_rules() { + [ -z "$UDEVVERSION" ] && export UDEVVERSION=$(udevadm --version) + +@@ -1455,13 +1484,6 @@ dracut_kernel_post() { + wait $_pid + fi + +- for _f in modules.builtin.bin modules.builtin; do +- [[ $srcmods/$_f ]] && break +- done || { +- dfatal "No modules.builtin.bin and modules.builtin found!" +- return 1 +- } +- + for _f in modules.builtin.bin modules.builtin modules.order; do + [[ $srcmods/$_f ]] && inst_simple "$srcmods/$_f" "/lib/modules/$kernel/$_f" + done +@@ -1480,7 +1502,7 @@ dracut_kernel_post() { module_is_host_only() { local _mod=$1 @@ -87,7 +171,7 @@ index 45e0911..2872516 100755 _mod=${_mod##*/} _mod=${_mod%.ko} _modenc=${_mod//-/_} -@@ -1497,19 +1498,25 @@ module_is_host_only() { +@@ -1497,19 +1519,25 @@ module_is_host_only() { # this covers the case, where a new module is introduced # or a module was renamed # or a module changed from builtin to a module @@ -116,7 +200,7 @@ index 45e0911..2872516 100755 fi return 1 -@@ -1672,3 +1679,15 @@ get_ucode_file () +@@ -1672,3 +1700,15 @@ get_ucode_file () printf "%02x-%02x-%02x" ${family} ${model} ${stepping} fi } @@ -133,7 +217,7 @@ index 45e0911..2872516 100755 +} + diff --git a/dracut.8.asc b/dracut.8.asc -index 76fc75c..2ea6744 100644 +index 76fc75c..d381dcf 100644 --- a/dracut.8.asc +++ b/dracut.8.asc @@ -10,7 +10,7 @@ dracut - low-level tool for generating an initramfs image @@ -202,7 +286,20 @@ index 76fc75c..2ea6744 100644 OPTIONS ------- -@@ -337,7 +294,7 @@ provide a valid _/etc/fstab_. +@@ -318,6 +275,12 @@ Default: + + **--sshkey** __:: ssh key file used with ssh-client module. + ++**--logfile** __:: logfile to use; overrides any setting from ++ the configuration files. +++ ++Default: ++ _/var/log/dracut.log_ ++ + **-l, --local**:: + activates the local mode. dracut will use modules from the current working + directory instead of the system-wide installed modules in +@@ -337,7 +300,7 @@ provide a valid _/etc/fstab_. **-N, --no-hostonly**:: Disable Host-Only mode @@ -211,7 +308,7 @@ index 76fc75c..2ea6744 100644 Use __ to address disks and partitions. __ can be any directory name found in /dev/disk. E.g. "by-uuid", "by-label" -@@ -345,7 +302,7 @@ provide a valid _/etc/fstab_. +@@ -345,7 +308,7 @@ provide a valid _/etc/fstab_. **--fstab**:: Use _/etc/fstab_ instead of _/proc/self/mountinfo_. @@ -220,7 +317,7 @@ index 76fc75c..2ea6744 100644 Add entries of __ to the initramfs /etc/fstab. **--mount** "__ __ __ __":: -@@ -358,13 +315,13 @@ provide a valid _/etc/fstab_. +@@ -358,13 +321,13 @@ provide a valid _/etc/fstab_. LVM or an encrypted partition. [NB --device can be used for compatibility with earlier releases] @@ -236,7 +333,7 @@ index 76fc75c..2ea6744 100644 install the space separated list of files into the initramfs. + [NOTE] -@@ -408,6 +365,22 @@ Make sure your kernel has xz decompression support compiled in, otherwise you +@@ -408,6 +371,22 @@ Make sure your kernel has xz decompression support compiled in, otherwise you will not be able to boot. Equivalent to "lzma --compress=xz --check=crc32 --lzma2=dict=1MiB" ==== @@ -259,7 +356,7 @@ index 76fc75c..2ea6744 100644 **--compress** __:: Compress the generated initramfs using the passed compression program. If you pass it just the name of a compression program, it will call that -@@ -481,7 +454,7 @@ _/etc/conf.d/_:: +@@ -481,7 +460,7 @@ _/etc/conf.d/_:: _/etc/cmdline_:: Can contain additional command line options. Deprecated, better use /etc/cmdline.d/*.conf. @@ -1185,7 +1282,7 @@ index c011658..031b201 100644 [appendix] License diff --git a/dracut.cmdline.7.asc b/dracut.cmdline.7.asc -index 4b2ab03..19bfb93 100644 +index 4b2ab03..6a5fc8f 100644 --- a/dracut.cmdline.7.asc +++ b/dracut.cmdline.7.asc @@ -31,16 +31,16 @@ line is the value, which is honored. @@ -1598,7 +1695,7 @@ index 4b2ab03..19bfb93 100644 This parameter can be specified multiple times. + ===================== -@@ -370,16 +444,7 @@ cannot be used in conjunction with the **ifname** argument for the +@@ -370,19 +444,12 @@ cannot be used in conjunction with the **ifname** argument for the same . ===================== @@ -1612,11 +1709,17 @@ index 4b2ab03..19bfb93 100644 -===================== - -**ip=**__:__:__:__:__:__:_{none|off|dhcp|on|any|dhcp6|auto6|ibft}_[:[__][:__]]:: -+**ip=**____:____:____:____:____:____:__{none|off|dhcp|on|any|dhcp6|auto6|ibft}__:[:[____][:____]]:: ++**ip=**____:[____]:____:____:____:____:__{none|off|dhcp|on|any|dhcp6|auto6|ibft}__:[:[____][:____]]:: explicit network configuration. If you want do define a IPv6 address, put it in brackets (e.g. [2001:DB8::1]). This parameter can be specified multiple - times. -@@ -390,25 +455,14 @@ cannot be used in conjunction with the **ifname** argument for the +- times. ++ times. ____ is optional and is the address of the remote endpoint ++ for pointopoint interfaces and it may be followed by a slash and a decimal number, ++ encoding the network prefix length. + + + ===================== + ::: optionally **set** on the . This +@@ -390,25 +457,14 @@ cannot be used in conjunction with the **ifname** argument for the same . ===================== @@ -1645,7 +1748,7 @@ index 4b2ab03..19bfb93 100644 specify network interface to use routing and netroot information from. Required if multiple ip= lines are used. -@@ -421,12 +475,12 @@ interface name. Better name it "bootnet" or "bluesocket". +@@ -421,12 +477,12 @@ interface name. Better name it "bootnet" or "bluesocket". **rd.neednet=1**:: boolean, bring up network even without netroot set @@ -1660,7 +1763,7 @@ index 4b2ab03..19bfb93 100644 Setup bonding device on top of . is a comma-separated list of physical (ethernet) interfaces. is a comma-separated list on bonding options (modinfo bonding for details) -@@ -434,68 +488,63 @@ interface name. Better name it "bootnet" or "bluesocket". +@@ -434,68 +490,63 @@ interface name. Better name it "bootnet" or "bluesocket". then its values should be separated by semicolon. Bond without parameters assumes bond=bond0:eth0,eth1:mode=balance-rr @@ -1745,7 +1848,7 @@ index 4b2ab03..19bfb93 100644 protocol defaults to "6", LUN defaults to "0". If the "servername" field is provided by BOOTP or DHCP, then that field is used in conjunction with other associated fields to contact the boot server in the Boot stage. However, if -@@ -503,85 +552,84 @@ iSCSI +@@ -503,85 +554,84 @@ iSCSI used in the Discovery Service stage in conjunction with other associated fields. See link:$$http://tools.ietf.org/html/rfc4173#section-5$$[rfc4173]. @@ -1868,7 +1971,7 @@ index 4b2ab03..19bfb93 100644 root=dhcp alone directs initrd to look at the DHCP root-path where NBD options can be specified. This syntax is only usable in cases where you are directly mounting the volume as the rootfs. -@@ -593,25 +641,29 @@ DASD +@@ -593,25 +643,29 @@ DASD ZFCP ~~~~ @@ -1906,7 +2009,7 @@ index 4b2ab03..19bfb93 100644 Plymouth Boot Splash ~~~~~~~~~~~~~~~~~~~~ -@@ -623,33 +675,41 @@ Plymouth Boot Splash +@@ -623,33 +677,41 @@ Plymouth Boot Splash Kernel keys ~~~~~~~~~~~ @@ -1964,6 +2067,52 @@ index 4b2ab03..19bfb93 100644 Deprecated, renamed Options ~~~~~~~~~~~~~~~~~~~~~~~~~~~ +diff --git a/dracut.conf.5.asc b/dracut.conf.5.asc +index c9c854a..30b7e03 100644 +--- a/dracut.conf.5.asc ++++ b/dracut.conf.5.asc +@@ -122,10 +122,10 @@ If chrooted to another root other than the real root device, use --fstab and pro + *kernel_only=*"__{yes|no}__":: + Only install kernel drivers and firmware files. (default=no) + +-*no_kernel=*"{yes|no}":: ++*no_kernel=*"__{yes|no}__":: + Do not install kernel drivers and firmware files (default=no) + +-*acpi_override=*"{yes|no}":: ++*acpi_override=*"__{yes|no}__":: + [WARNING] ONLY USE THIS IF YOU KNOW WHAT YOU ARE DOING! + + Override BIOS provided ACPI tables. For further documentation read + Documentation/acpi/initrd_table_override.txt in the kernel sources. +@@ -158,6 +158,16 @@ If chrooted to another root other than the real root device, use --fstab and pro + *show_modules=*"__{yes|no}__":: + Print the name of the included modules to standard output during build. + ++*i18n_vars="____":: ++ Distribution specific variable mapping. ++ See dracut/modules.d/10i18n/README for a detailed description. ++ ++*i18n_default_font=*"____":: ++ The font to install, if not specified otherwise. Default is "LatArCyrHeb-16". ++ ++*i18n_install_all=*"__{yes|no}__":: ++ Install everything regardless of generic or hostonly mode. ++ + Files + ----- + _/etc/dracut.conf_:: +diff --git a/dracut.conf.d/fedora.conf.example b/dracut.conf.d/fedora.conf.example +index 1a56a86..495e8fb 100644 +--- a/dracut.conf.d/fedora.conf.example ++++ b/dracut.conf.d/fedora.conf.example +@@ -3,6 +3,7 @@ + # i18n + i18n_vars="/etc/sysconfig/keyboard:KEYTABLE-KEYMAP /etc/sysconfig/i18n:SYSFONT-FONT,FONTACM-FONT_MAP,FONT_UNIMAP" + i18n_default_font="latarcyrheb-sun16" ++i18n_install_all="yes" + stdloglvl=3 + sysloglvl=5 + install_items+=" vi /etc/virc ps grep cat rm " diff --git a/dracut.css b/dracut.css index e419a06..357ede1 100644 --- a/dracut.css @@ -2772,7 +2921,7 @@ index 0000000..17acdb4 +-------- +*dracut*(8) diff --git a/dracut.sh b/dracut.sh -index e135dfc..bce2662 100755 +index e135dfc..11dcd0e 100755 --- a/dracut.sh +++ b/dracut.sh @@ -165,6 +165,12 @@ Creates initial ramdisk images for preloading modules @@ -2788,7 +2937,23 @@ index e135dfc..bce2662 100755 --compress [COMPRESSION] Compress the generated initramfs with the passed compression program. Make sure your kernel knows how to decompress the generated initramfs, -@@ -342,6 +348,8 @@ TEMP=$(unset POSIXLY_CORRECT; getopt \ +@@ -177,6 +183,7 @@ Creates initial ramdisk images for preloading modules + --keep Keep the temporary initramfs for debugging purposes + --printsize Print out the module install size + --sshkey [SSHKEY] Add ssh key to initramfs (use with ssh-client module) ++ --logfile [FILE] Logfile to use (overrides configuration setting) + + If [LIST] has multiple arguments, then you have to put these in quotes. + +@@ -329,6 +336,7 @@ TEMP=$(unset POSIXLY_CORRECT; getopt \ + --long debug \ + --long profile \ + --long sshkey: \ ++ --long logfile: \ + --long verbose \ + --long quiet \ + --long local \ +@@ -342,6 +350,8 @@ TEMP=$(unset POSIXLY_CORRECT; getopt \ --long bzip2 \ --long lzma \ --long xz \ @@ -2797,7 +2962,15 @@ index e135dfc..bce2662 100755 --long no-compress \ --long gzip \ --long list-modules \ -@@ -430,6 +438,8 @@ while :; do +@@ -410,6 +420,7 @@ while :; do + --debug) debug="yes";; + --profile) profile="yes";; + --sshkey) sshkey="$2"; shift;; ++ --logfile) logfile_l="$2"; shift;; + -v|--verbose) ((verbosity_mod_l++));; + -q|--quiet) ((verbosity_mod_l--));; + -l|--local) +@@ -430,6 +441,8 @@ while :; do --bzip2) compress_l="bzip2";; --lzma) compress_l="lzma";; --xz) compress_l="xz";; @@ -2806,7 +2979,13 @@ index e135dfc..bce2662 100755 --no-compress) _no_compress_l="cat";; --gzip) compress_l="gzip";; --list-modules) do_list="yes";; -@@ -496,17 +506,18 @@ if [[ $regenerate_all == "yes" ]]; then +@@ -491,22 +504,23 @@ if [[ $regenerate_all == "yes" ]]; then + + cd /lib/modules + for i in *; do +- [[ -f $i/modules.builtin ]] || continue ++ [[ -f $i/modules.dep ]] || [[ -f $i/modules.dep.bin ]] || continue + dracut --kver="$i" "${dracut_args[@]}" ((ret+=$?)) done exit $ret @@ -2830,7 +3009,7 @@ index e135dfc..bce2662 100755 if ! [[ $outfile ]]; then [[ -f /etc/machine-id ]] && read MACHINE_ID < /etc/machine-id -@@ -522,7 +533,7 @@ for i in /usr/sbin /sbin /usr/bin /bin; do +@@ -522,7 +536,7 @@ for i in /usr/sbin /sbin /usr/bin /bin; do if [ -L "$i" ]; then rl=$(readlink -f $i) fi @@ -2839,7 +3018,7 @@ index e135dfc..bce2662 100755 NPATH+=":$rl" fi done -@@ -672,6 +683,7 @@ stdloglvl=$((stdloglvl + verbosity_mod_l)) +@@ -672,22 +686,28 @@ stdloglvl=$((stdloglvl + verbosity_mod_l)) [[ $fw_dir ]] || fw_dir="/lib/firmware/updates /lib/firmware" [[ $tmpdir_l ]] && tmpdir="$tmpdir_l" [[ $tmpdir ]] || tmpdir=/var/tmp @@ -2847,7 +3026,10 @@ index e135dfc..bce2662 100755 [[ $compress_l ]] && compress=$compress_l [[ $show_modules_l ]] && show_modules=$show_modules_l [[ $nofscks_l ]] && nofscks="yes" -@@ -681,13 +693,17 @@ stdloglvl=$((stdloglvl + verbosity_mod_l)) + [[ $ro_mnt_l ]] && ro_mnt="yes" + [[ $early_microcode_l ]] && early_microcode=$early_microcode_l + [[ $early_microcode ]] || early_microcode=no ++[[ $logfile_l ]] && logfile="$logfile_l" # eliminate IFS hackery when messing with fw_dir fw_dir=${fw_dir//:/ } @@ -2867,7 +3049,16 @@ index e135dfc..bce2662 100755 esac if [[ $_no_compress_l = "cat" ]]; then compress="cat" -@@ -954,6 +970,11 @@ if [[ $hostonly ]]; then +@@ -931,6 +951,8 @@ if [[ $hostonly ]]; then + [[ $_mapper = \#* ]] && continue + [[ "$_d" -ef /dev/mapper/"$_mapper" ]] || continue + [[ "$_o" ]] || _o="$_p" ++ # skip entries with password files ++ [[ "$_p" == /* ]] && [[ -f $_p ]] && continue 2 + # skip mkswap swap + [[ $_o == *swap* ]] && continue 2 + done < /etc/crypttab +@@ -954,6 +976,11 @@ if [[ $hostonly ]]; then rm -f -- "$initdir/.modalias" @@ -2879,7 +3070,24 @@ index e135dfc..bce2662 100755 # check /proc/modules declare -A host_modules while read m rest; do -@@ -1080,7 +1101,7 @@ if [[ $kernel_only != yes ]]; then +@@ -966,12 +993,12 @@ unset rest + + _get_fs_type() { + [[ $1 ]] || return +- if [[ -b /dev/block/$1 ]] && ID_FS_TYPE=$(get_fs_env "/dev/block/$1"); then +- host_fs_types["$(readlink -f "/dev/block/$1")"]="$ID_FS_TYPE" ++ if [[ -b /dev/block/$1 ]]; then ++ ID_FS_TYPE=$(get_fs_env "/dev/block/$1") && host_fs_types["$(readlink -f "/dev/block/$1")"]="$ID_FS_TYPE" + return 1 + fi +- if [[ -b $1 ]] && ID_FS_TYPE=$(get_fs_env "$1"); then +- host_fs_types["$(readlink -f "$1")"]="$ID_FS_TYPE" ++ if [[ -b $1 ]]; then ++ ID_FS_TYPE=$(get_fs_env "$1") && host_fs_types["$(readlink -f "$1")"]="$ID_FS_TYPE" + return 1 + fi + if fstype=$(find_dev_fstype "$1"); then +@@ -1080,7 +1107,7 @@ if [[ $kernel_only != yes ]]; then fi done @@ -2889,10 +3097,32 @@ index e135dfc..bce2662 100755 inst_symlink "/$d" else diff --git a/dracut.spec b/dracut.spec -index 44fff00..44171d8 100644 +index 44fff00..6cc60e1 100644 --- a/dracut.spec +++ b/dracut.spec -@@ -274,8 +274,8 @@ echo 'dracut_rescue_image="yes"' > $RPM_BUILD_ROOT%{dracutlibdir}/dracut.conf.d/ +@@ -246,15 +246,18 @@ mkdir -p $RPM_BUILD_ROOT%{_localstatedir}/log + touch $RPM_BUILD_ROOT%{_localstatedir}/log/dracut.log + mkdir -p $RPM_BUILD_ROOT%{_sharedstatedir}/initramfs + +-%if 0%{?fedora} || 0%{?rhel} || 0%{?suse_version} ++%if 0%{?fedora} || 0%{?rhel} + install -m 0644 dracut.conf.d/fedora.conf.example $RPM_BUILD_ROOT%{dracutlibdir}/dracut.conf.d/01-dist.conf +-install -m 0644 dracut.conf.d/fips.conf.example $RPM_BUILD_ROOT%{dracutlibdir}/dracut.conf.d/40-fips.conf ++rm -f $RPM_BUILD_ROOT%{_mandir}/man?/*suse* + %endif +- + %if 0%{?suse_version} + install -m 0644 dracut.conf.d/suse.conf.example $RPM_BUILD_ROOT%{dracutlibdir}/dracut.conf.d/01-dist.conf + %endif + ++%if 0%{?fedora} || 0%{?rhel} || 0%{?suse_version} ++install -m 0644 dracut.conf.d/fips.conf.example $RPM_BUILD_ROOT%{dracutlibdir}/dracut.conf.d/40-fips.conf ++%endif ++ + %if 0%{?fedora} <= 12 && 0%{?rhel} < 6 && 0%{?suse_version} <= 9999 + rm -f -- $RPM_BUILD_ROOT%{_bindir}/mkinitrd + rm -f -- $RPM_BUILD_ROOT%{_bindir}/lsinitrd +@@ -274,8 +277,8 @@ echo 'dracut_rescue_image="yes"' > $RPM_BUILD_ROOT%{dracutlibdir}/dracut.conf.d/ %endif # create compat symlink @@ -2903,7 +3133,7 @@ index 44fff00..44171d8 100644 %clean rm -rf -- $RPM_BUILD_ROOT -@@ -285,7 +285,7 @@ rm -rf -- $RPM_BUILD_ROOT +@@ -285,7 +288,7 @@ rm -rf -- $RPM_BUILD_ROOT %doc README HACKING TODO COPYING AUTHORS NEWS dracut.html dracut.png dracut.svg %{_bindir}/dracut # compat symlink @@ -2912,7 +3142,7 @@ index 44fff00..44171d8 100644 %{_datadir}/bash-completion/completions/dracut %{_datadir}/bash-completion/completions/lsinitrd %if 0%{?fedora} > 12 || 0%{?rhel} >= 6 || 0%{?suse_version} > 9999 -@@ -314,6 +314,7 @@ rm -rf -- $RPM_BUILD_ROOT +@@ -314,6 +317,7 @@ rm -rf -- $RPM_BUILD_ROOT %endif %{_mandir}/man7/dracut.kernel.7* %{_mandir}/man7/dracut.cmdline.7* @@ -2920,6 +3150,26 @@ index 44fff00..44171d8 100644 %{_mandir}/man7/dracut.bootup.7* %{_mandir}/man5/dracut.conf.5* %if %{defined _unitdir} +@@ -349,8 +353,10 @@ rm -rf -- $RPM_BUILD_ROOT + %{dracutlibdir}/modules.d/95rootfs-block + %{dracutlibdir}/modules.d/95dasd + %{dracutlibdir}/modules.d/95dasd_mod ++%{dracutlibdir}/modules.d/95dasd_rules + %{dracutlibdir}/modules.d/95fstab-sys + %{dracutlibdir}/modules.d/95zfcp ++%{dracutlibdir}/modules.d/95zfcp_rules + %{dracutlibdir}/modules.d/95terminfo + %{dracutlibdir}/modules.d/95udev-rules + %{dracutlibdir}/modules.d/95virtfs +@@ -408,6 +414,8 @@ rm -rf -- $RPM_BUILD_ROOT + %{dracutlibdir}/modules.d/95ssh-client + %{dracutlibdir}/modules.d/45ifcfg + %{dracutlibdir}/modules.d/95znet ++%{dracutlibdir}/modules.d/95fcoe-uefi ++%{dracutlibdir}/modules.d/99uefi-lib + + %if 0%{?fedora} || 0%{?rhel} || 0%{?suse_version} + %files fips diff --git a/dracut.usage.asc b/dracut.usage.asc new file mode 100644 index 0000000..6d37920 @@ -3452,6 +3702,1640 @@ index 0000000..6d37920 + +This will give you a dracut shell after the system pivot'ed back in the initramfs. + +diff --git a/install/dracut-install.c b/install/dracut-install.c +index 6b9c613..397aa62 100644 +--- a/install/dracut-install.c ++++ b/install/dracut-install.c +@@ -44,6 +44,7 @@ + #include "log.h" + #include "hashmap.h" + #include "util.h" ++#include "strv.h" + + static bool arg_hmac = false; + static bool arg_createdir = false; +@@ -784,13 +785,13 @@ static int resolve_lazy(int argc, char **argv) + return ret; + } + +-static char *find_binary(const char *src) ++static char **find_binary(const char *src) + { +- _cleanup_free_ char *path = NULL; +- char *p, *q; +- bool end = false; ++ char *path = NULL; ++ _cleanup_strv_free_ char **p = NULL; ++ char **ret = NULL; ++ char **q; + char *newsrc = NULL; +- int ret; + + path = getenv("PATH"); + +@@ -798,34 +799,21 @@ static char *find_binary(const char *src) + log_error("PATH is not set"); + exit(EXIT_FAILURE); + } +- path = strdup(path); +- p = path; +- +- if (path == NULL) { +- log_error("Out of memory!"); +- exit(EXIT_FAILURE); +- } + + log_debug("PATH=%s", path); + +- do { +- struct stat sb; +- +- for (q = p; *q && *q != ':'; q++) ; ++ p = strv_split(path, ":"); + +- if (*q == '\0') +- end = true; +- else +- *q = '\0'; ++ STRV_FOREACH(q, p) { ++ struct stat sb; ++ int r; + +- ret = asprintf(&newsrc, "%s/%s", p, src); +- if (ret < 0) { ++ r = asprintf(&newsrc, "%s/%s", *q, src); ++ if (r < 0) { + log_error("Out of memory!"); + exit(EXIT_FAILURE); + } + +- p = q + 1; +- + if (stat(newsrc, &sb) != 0) { + log_debug("stat(%s) != 0", newsrc); + free(newsrc); +@@ -833,30 +821,37 @@ static char *find_binary(const char *src) + continue; + } + +- end = true; ++ strv_push(&ret, newsrc); + +- } while (!end); ++ }; + +- if (newsrc) +- log_debug("find_binary(%s) == %s", src, newsrc); ++ if (ret) { ++ STRV_FOREACH(q, ret) { ++ log_debug("find_binary(%s) == %s", src, *q); ++ } ++ } + +- return newsrc; ++ return ret; + } + + static int install_one(const char *src, const char *dst) + { + int r = EXIT_SUCCESS; +- int ret; ++ int ret = 0; + + if (strchr(src, '/') == NULL) { +- char *newsrc = find_binary(src); +- if (newsrc) { +- log_debug("dracut_install '%s' '%s'", newsrc, dst); +- ret = dracut_install(newsrc, dst, arg_createdir, arg_resolvedeps, true); +- if (ret == 0) { +- log_debug("dracut_install '%s' '%s' OK", newsrc, dst); ++ char **q = NULL; ++ char **p = find_binary(src); ++ if (p) { ++ STRV_FOREACH(q, p) { ++ char *newsrc = *q; ++ log_debug("dracut_install '%s' '%s'", newsrc, dst); ++ ret = dracut_install(newsrc, dst, arg_createdir, arg_resolvedeps, true); ++ if (ret == 0) { ++ log_debug("dracut_install '%s' '%s' OK", newsrc, dst); ++ } + } +- free(newsrc); ++ strv_free(p); + } else { + ret = -1; + } +@@ -877,17 +872,22 @@ static int install_all(int argc, char **argv) + int r = EXIT_SUCCESS; + int i; + for (i = 0; i < argc; i++) { +- int ret; ++ int ret = 0; + log_debug("Handle '%s'", argv[i]); + + if (strchr(argv[i], '/') == NULL) { +- _cleanup_free_ char *newsrc = find_binary(argv[i]); +- if (newsrc) { +- log_debug("dracut_install '%s'", newsrc); +- ret = dracut_install(newsrc, newsrc, arg_createdir, arg_resolvedeps, true); +- if (ret == 0) { +- log_debug("dracut_install '%s' OK", newsrc); ++ char **q = NULL; ++ char **p = find_binary(argv[i]); ++ if (p) { ++ STRV_FOREACH(q, p) { ++ char *newsrc = *q; ++ log_debug("dracut_install '%s'", newsrc); ++ ret = dracut_install(newsrc, newsrc, arg_createdir, arg_resolvedeps, true); ++ if (ret == 0) { ++ log_debug("dracut_install '%s' OK", newsrc); ++ } + } ++ strv_free(p); + } else { + ret = -1; + } +diff --git a/install/strv.c b/install/strv.c +new file mode 100644 +index 0000000..152b70c +--- /dev/null ++++ b/install/strv.c +@@ -0,0 +1,587 @@ ++/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/ ++ ++/*** ++ This file is part of systemd. ++ ++ Copyright 2010 Lennart Poettering ++ ++ systemd is free software; you can redistribute it and/or modify it ++ under the terms of the GNU Lesser General Public License as published by ++ the Free Software Foundation; either version 2.1 of the License, or ++ (at your option) any later version. ++ ++ systemd is distributed in the hope that it will be useful, but ++ WITHOUT ANY WARRANTY; without even the implied warranty of ++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ++ Lesser General Public License for more details. ++ ++ You should have received a copy of the GNU Lesser General Public License ++ along with systemd; If not, see . ++***/ ++ ++#include ++#include ++#include ++#include ++#include ++ ++#include "util.h" ++#include "strv.h" ++ ++char *strv_find(char **l, const char *name) { ++ char **i; ++ ++ assert(name); ++ ++ STRV_FOREACH(i, l) ++ if (streq(*i, name)) ++ return *i; ++ ++ return NULL; ++} ++ ++char *strv_find_prefix(char **l, const char *name) { ++ char **i; ++ ++ assert(name); ++ ++ STRV_FOREACH(i, l) ++ if (startswith(*i, name)) ++ return *i; ++ ++ return NULL; ++} ++ ++void strv_free(char **l) { ++ char **k; ++ ++ if (!l) ++ return; ++ ++ for (k = l; *k; k++) ++ free(*k); ++ ++ free(l); ++} ++ ++char **strv_copy(char * const *l) { ++ char **r, **k; ++ ++ k = r = new(char*, strv_length(l) + 1); ++ if (!r) ++ return NULL; ++ ++ if (l) ++ for (; *l; k++, l++) { ++ *k = strdup(*l); ++ if (!*k) { ++ strv_free(r); ++ return NULL; ++ } ++ } ++ ++ *k = NULL; ++ return r; ++} ++ ++unsigned strv_length(char * const *l) { ++ unsigned n = 0; ++ ++ if (!l) ++ return 0; ++ ++ for (; *l; l++) ++ n++; ++ ++ return n; ++} ++ ++char **strv_new_ap(const char *x, va_list ap) { ++ const char *s; ++ char **a; ++ unsigned n = 0, i = 0; ++ va_list aq; ++ ++ /* As a special trick we ignore all listed strings that equal ++ * (const char*) -1. This is supposed to be used with the ++ * STRV_IFNOTNULL() macro to include possibly NULL strings in ++ * the string list. */ ++ ++ if (x) { ++ n = x == (const char*) -1 ? 0 : 1; ++ ++ va_copy(aq, ap); ++ while ((s = va_arg(aq, const char*))) { ++ if (s == (const char*) -1) ++ continue; ++ ++ n++; ++ } ++ ++ va_end(aq); ++ } ++ ++ a = new(char*, n+1); ++ if (!a) ++ return NULL; ++ ++ if (x) { ++ if (x != (const char*) -1) { ++ a[i] = strdup(x); ++ if (!a[i]) ++ goto fail; ++ i++; ++ } ++ ++ while ((s = va_arg(ap, const char*))) { ++ ++ if (s == (const char*) -1) ++ continue; ++ ++ a[i] = strdup(s); ++ if (!a[i]) ++ goto fail; ++ ++ i++; ++ } ++ } ++ ++ a[i] = NULL; ++ ++ return a; ++ ++fail: ++ strv_free(a); ++ return NULL; ++} ++ ++char **strv_new(const char *x, ...) { ++ char **r; ++ va_list ap; ++ ++ va_start(ap, x); ++ r = strv_new_ap(x, ap); ++ va_end(ap); ++ ++ return r; ++} ++ ++char **strv_merge(char **a, char **b) { ++ char **r, **k; ++ ++ if (!a) ++ return strv_copy(b); ++ ++ if (!b) ++ return strv_copy(a); ++ ++ r = new(char*, strv_length(a) + strv_length(b) + 1); ++ if (!r) ++ return NULL; ++ ++ for (k = r; *a; k++, a++) { ++ *k = strdup(*a); ++ if (!*k) ++ goto fail; ++ } ++ ++ for (; *b; k++, b++) { ++ *k = strdup(*b); ++ if (!*k) ++ goto fail; ++ } ++ ++ *k = NULL; ++ return r; ++ ++fail: ++ strv_free(r); ++ return NULL; ++} ++ ++char **strv_merge_concat(char **a, char **b, const char *suffix) { ++ char **r, **k; ++ ++ /* Like strv_merge(), but appends suffix to all strings in b, before adding */ ++ ++ if (!b) ++ return strv_copy(a); ++ ++ r = new(char*, strv_length(a) + strv_length(b) + 1); ++ if (!r) ++ return NULL; ++ ++ k = r; ++ if (a) ++ for (; *a; k++, a++) { ++ *k = strdup(*a); ++ if (!*k) ++ goto fail; ++ } ++ ++ for (; *b; k++, b++) { ++ *k = strappend(*b, suffix); ++ if (!*k) ++ goto fail; ++ } ++ ++ *k = NULL; ++ return r; ++ ++fail: ++ strv_free(r); ++ return NULL; ++ ++} ++ ++char **strv_split(const char *s, const char *separator) { ++ char *state; ++ char *w; ++ size_t l; ++ unsigned n, i; ++ char **r; ++ ++ assert(s); ++ ++ n = 0; ++ FOREACH_WORD_SEPARATOR(w, l, s, separator, state) ++ n++; ++ ++ r = new(char*, n+1); ++ if (!r) ++ return NULL; ++ ++ i = 0; ++ FOREACH_WORD_SEPARATOR(w, l, s, separator, state) { ++ r[i] = strndup(w, l); ++ if (!r[i]) { ++ strv_free(r); ++ return NULL; ++ } ++ ++ i++; ++ } ++ ++ r[i] = NULL; ++ return r; ++} ++ ++char **strv_split_quoted(const char *s) { ++ char *state; ++ char *w; ++ size_t l; ++ unsigned n, i; ++ char **r; ++ ++ assert(s); ++ ++ n = 0; ++ FOREACH_WORD_QUOTED(w, l, s, state) ++ n++; ++ ++ r = new(char*, n+1); ++ if (!r) ++ return NULL; ++ ++ i = 0; ++ FOREACH_WORD_QUOTED(w, l, s, state) { ++ r[i] = cunescape_length(w, l); ++ if (!r[i]) { ++ strv_free(r); ++ return NULL; ++ } ++ i++; ++ } ++ ++ r[i] = NULL; ++ return r; ++} ++ ++char **strv_split_newlines(const char *s) { ++ char **l; ++ unsigned n; ++ ++ assert(s); ++ ++ /* Special version of strv_split() that splits on newlines and ++ * suppresses an empty string at the end */ ++ ++ l = strv_split(s, NEWLINE); ++ if (!l) ++ return NULL; ++ ++ n = strv_length(l); ++ if (n <= 0) ++ return l; ++ ++ if (isempty(l[n-1])) { ++ free(l[n-1]); ++ l[n-1] = NULL; ++ } ++ ++ return l; ++} ++ ++char *strv_join(char **l, const char *separator) { ++ char *r, *e; ++ char **s; ++ size_t n, k; ++ ++ if (!separator) ++ separator = " "; ++ ++ k = strlen(separator); ++ ++ n = 0; ++ STRV_FOREACH(s, l) { ++ if (n != 0) ++ n += k; ++ n += strlen(*s); ++ } ++ ++ r = new(char, n+1); ++ if (!r) ++ return NULL; ++ ++ e = r; ++ STRV_FOREACH(s, l) { ++ if (e != r) ++ e = stpcpy(e, separator); ++ ++ e = stpcpy(e, *s); ++ } ++ ++ *e = 0; ++ ++ return r; ++} ++ ++char **strv_append(char **l, const char *s) { ++ char **r, **k; ++ ++ if (!l) ++ return strv_new(s, NULL); ++ ++ if (!s) ++ return strv_copy(l); ++ ++ r = new(char*, strv_length(l)+2); ++ if (!r) ++ return NULL; ++ ++ for (k = r; *l; k++, l++) { ++ *k = strdup(*l); ++ if (!*k) ++ goto fail; ++ } ++ ++ k[0] = strdup(s); ++ if (!k[0]) ++ goto fail; ++ ++ k[1] = NULL; ++ return r; ++ ++fail: ++ strv_free(r); ++ return NULL; ++} ++ ++int strv_push(char ***l, char *value) { ++ char **c; ++ unsigned n; ++ ++ if (!value) ++ return 0; ++ ++ n = strv_length(*l); ++ c = realloc(*l, sizeof(char*) * (n + 2)); ++ if (!c) ++ return -ENOMEM; ++ ++ c[n] = value; ++ c[n+1] = NULL; ++ ++ *l = c; ++ return 0; ++} ++ ++int strv_extend(char ***l, const char *value) { ++ char *v; ++ int r; ++ ++ if (!value) ++ return 0; ++ ++ v = strdup(value); ++ if (!v) ++ return -ENOMEM; ++ ++ r = strv_push(l, v); ++ if (r < 0) ++ free(v); ++ ++ return r; ++} ++ ++char **strv_uniq(char **l) { ++ char **i; ++ ++ /* Drops duplicate entries. The first identical string will be ++ * kept, the others dropped */ ++ ++ STRV_FOREACH(i, l) ++ strv_remove(i+1, *i); ++ ++ return l; ++} ++ ++char **strv_remove(char **l, const char *s) { ++ char **f, **t; ++ ++ if (!l) ++ return NULL; ++ ++ assert(s); ++ ++ /* Drops every occurrence of s in the string list, edits ++ * in-place. */ ++ ++ for (f = t = l; *f; f++) { ++ ++ if (streq(*f, s)) { ++ free(*f); ++ continue; ++ } ++ ++ *(t++) = *f; ++ } ++ ++ *t = NULL; ++ return l; ++} ++ ++char **strv_remove_prefix(char **l, const char *s) { ++ char **f, **t; ++ ++ if (!l) ++ return NULL; ++ ++ assert(s); ++ ++ /* Drops every occurrence of a string prefixed with s in the ++ * string list, edits in-place. */ ++ ++ for (f = t = l; *f; f++) { ++ ++ if (startswith(*f, s)) { ++ free(*f); ++ continue; ++ } ++ ++ *(t++) = *f; ++ } ++ ++ *t = NULL; ++ return l; ++} ++ ++char **strv_parse_nulstr(const char *s, size_t l) { ++ const char *p; ++ unsigned c = 0, i = 0; ++ char **v; ++ ++ assert(s || l <= 0); ++ ++ if (l <= 0) ++ return new0(char*, 1); ++ ++ for (p = s; p < s + l; p++) ++ if (*p == 0) ++ c++; ++ ++ if (s[l-1] != 0) ++ c++; ++ ++ v = new0(char*, c+1); ++ if (!v) ++ return NULL; ++ ++ p = s; ++ while (p < s + l) { ++ const char *e; ++ ++ e = memchr(p, 0, s + l - p); ++ ++ v[i] = strndup(p, e ? e - p : s + l - p); ++ if (!v[i]) { ++ strv_free(v); ++ return NULL; ++ } ++ ++ i++; ++ ++ if (!e) ++ break; ++ ++ p = e + 1; ++ } ++ ++ assert(i == c); ++ ++ return v; ++} ++ ++char **strv_split_nulstr(const char *s) { ++ const char *i; ++ char **r = NULL; ++ ++ NULSTR_FOREACH(i, s) ++ if (strv_extend(&r, i) < 0) { ++ strv_free(r); ++ return NULL; ++ } ++ ++ if (!r) ++ return strv_new(NULL, NULL); ++ ++ return r; ++} ++ ++bool strv_overlap(char **a, char **b) { ++ char **i, **j; ++ ++ STRV_FOREACH(i, a) { ++ STRV_FOREACH(j, b) { ++ if (streq(*i, *j)) ++ return true; ++ } ++ } ++ ++ return false; ++} ++ ++static int str_compare(const void *_a, const void *_b) { ++ const char **a = (const char**) _a, **b = (const char**) _b; ++ ++ return strcmp(*a, *b); ++} ++ ++char **strv_sort(char **l) { ++ ++ if (strv_isempty(l)) ++ return l; ++ ++ qsort(l, strv_length(l), sizeof(char*), str_compare); ++ return l; ++} ++ ++void strv_print(char **l) { ++ char **s; ++ ++ if (!l) ++ return; ++ ++ STRV_FOREACH(s, l) ++ puts(*s); ++} +diff --git a/install/strv.h b/install/strv.h +new file mode 100644 +index 0000000..193f1dd +--- /dev/null ++++ b/install/strv.h +@@ -0,0 +1,118 @@ ++/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/ ++ ++#pragma once ++ ++/*** ++ This file is part of systemd. ++ ++ Copyright 2010 Lennart Poettering ++ ++ systemd is free software; you can redistribute it and/or modify it ++ under the terms of the GNU Lesser General Public License as published by ++ the Free Software Foundation; either version 2.1 of the License, or ++ (at your option) any later version. ++ ++ systemd is distributed in the hope that it will be useful, but ++ WITHOUT ANY WARRANTY; without even the implied warranty of ++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ++ Lesser General Public License for more details. ++ ++ You should have received a copy of the GNU Lesser General Public License ++ along with systemd; If not, see . ++***/ ++ ++#include ++#include ++ ++#include "util.h" ++ ++char *strv_find(char **l, const char *name) _pure_; ++char *strv_find_prefix(char **l, const char *name) _pure_; ++ ++void strv_free(char **l); ++DEFINE_TRIVIAL_CLEANUP_FUNC(char**, strv_free); ++#define _cleanup_strv_free_ _cleanup_(strv_freep) ++ ++char **strv_copy(char * const *l); ++unsigned strv_length(char * const *l) _pure_; ++ ++char **strv_merge(char **a, char **b); ++char **strv_merge_concat(char **a, char **b, const char *suffix); ++char **strv_append(char **l, const char *s); ++int strv_extend(char ***l, const char *value); ++int strv_push(char ***l, char *value); ++ ++char **strv_remove(char **l, const char *s); ++char **strv_remove_prefix(char **l, const char *s); ++char **strv_uniq(char **l); ++ ++#define strv_contains(l, s) (!!strv_find((l), (s))) ++ ++char **strv_new(const char *x, ...) _sentinel_; ++char **strv_new_ap(const char *x, va_list ap); ++ ++static inline const char* STRV_IFNOTNULL(const char *x) { ++ return x ? x : (const char *) -1; ++} ++ ++static inline bool strv_isempty(char * const *l) { ++ return !l || !*l; ++} ++ ++char **strv_split(const char *s, const char *separator); ++char **strv_split_quoted(const char *s); ++char **strv_split_newlines(const char *s); ++ ++char *strv_join(char **l, const char *separator); ++ ++char **strv_parse_nulstr(const char *s, size_t l); ++char **strv_split_nulstr(const char *s); ++ ++bool strv_overlap(char **a, char **b) _pure_; ++ ++#define STRV_FOREACH(s, l) \ ++ for ((s) = (l); (s) && *(s); (s)++) ++ ++#define STRV_FOREACH_BACKWARDS(s, l) \ ++ STRV_FOREACH(s, l) \ ++ ; \ ++ for ((s)--; (l) && ((s) >= (l)); (s)--) ++ ++#define STRV_FOREACH_PAIR(x, y, l) \ ++ for ((x) = (l), (y) = (x+1); (x) && *(x) && *(y); (x) += 2, (y) = (x + 1)) ++ ++char **strv_sort(char **l); ++void strv_print(char **l); ++ ++#define STRV_MAKE(...) ((char**) ((const char*[]) { __VA_ARGS__, NULL })) ++ ++#define STRV_MAKE_EMPTY ((char*[1]) { NULL }) ++ ++#define strv_from_stdarg_alloca(first) \ ++ ({ \ ++ char **_l; \ ++ \ ++ if (!first) \ ++ _l = (char**) &first; \ ++ else { \ ++ unsigned _n; \ ++ va_list _ap; \ ++ \ ++ _n = 1; \ ++ va_start(_ap, first); \ ++ while (va_arg(_ap, char*)) \ ++ _n++; \ ++ va_end(_ap); \ ++ \ ++ _l = newa(char*, _n+1); \ ++ _l[_n = 0] = (char*) first; \ ++ va_start(_ap, first); \ ++ for (;;) { \ ++ _l[++_n] = va_arg(_ap, char*); \ ++ if (!_l[_n]) \ ++ break; \ ++ } \ ++ va_end(_ap); \ ++ } \ ++ _l; \ ++ }) +diff --git a/install/util.c b/install/util.c +index 9aa131f..c28db76 100644 +--- a/install/util.c ++++ b/install/util.c +@@ -277,3 +277,238 @@ char *strjoin(const char *x, ...) { + + return r; + } ++ ++char *cunescape_length_with_prefix(const char *s, size_t length, const char *prefix) { ++ char *r, *t; ++ const char *f; ++ size_t pl; ++ ++ assert(s); ++ ++ /* Undoes C style string escaping, and optionally prefixes it. */ ++ ++ pl = prefix ? strlen(prefix) : 0; ++ ++ r = new(char, pl+length+1); ++ if (!r) ++ return r; ++ ++ if (prefix) ++ memcpy(r, prefix, pl); ++ ++ for (f = s, t = r + pl; f < s + length; f++) { ++ ++ if (*f != '\\') { ++ *(t++) = *f; ++ continue; ++ } ++ ++ f++; ++ ++ switch (*f) { ++ ++ case 'a': ++ *(t++) = '\a'; ++ break; ++ case 'b': ++ *(t++) = '\b'; ++ break; ++ case 'f': ++ *(t++) = '\f'; ++ break; ++ case 'n': ++ *(t++) = '\n'; ++ break; ++ case 'r': ++ *(t++) = '\r'; ++ break; ++ case 't': ++ *(t++) = '\t'; ++ break; ++ case 'v': ++ *(t++) = '\v'; ++ break; ++ case '\\': ++ *(t++) = '\\'; ++ break; ++ case '"': ++ *(t++) = '"'; ++ break; ++ case '\'': ++ *(t++) = '\''; ++ break; ++ ++ case 's': ++ /* This is an extension of the XDG syntax files */ ++ *(t++) = ' '; ++ break; ++ ++ case 'x': { ++ /* hexadecimal encoding */ ++ int a, b; ++ ++ a = unhexchar(f[1]); ++ b = unhexchar(f[2]); ++ ++ if (a < 0 || b < 0) { ++ /* Invalid escape code, let's take it literal then */ ++ *(t++) = '\\'; ++ *(t++) = 'x'; ++ } else { ++ *(t++) = (char) ((a << 4) | b); ++ f += 2; ++ } ++ ++ break; ++ } ++ ++ case '0': ++ case '1': ++ case '2': ++ case '3': ++ case '4': ++ case '5': ++ case '6': ++ case '7': { ++ /* octal encoding */ ++ int a, b, c; ++ ++ a = unoctchar(f[0]); ++ b = unoctchar(f[1]); ++ c = unoctchar(f[2]); ++ ++ if (a < 0 || b < 0 || c < 0) { ++ /* Invalid escape code, let's take it literal then */ ++ *(t++) = '\\'; ++ *(t++) = f[0]; ++ } else { ++ *(t++) = (char) ((a << 6) | (b << 3) | c); ++ f += 2; ++ } ++ ++ break; ++ } ++ ++ case 0: ++ /* premature end of string.*/ ++ *(t++) = '\\'; ++ goto finish; ++ ++ default: ++ /* Invalid escape code, let's take it literal then */ ++ *(t++) = '\\'; ++ *(t++) = *f; ++ break; ++ } ++ } ++ ++finish: ++ *t = 0; ++ return r; ++} ++ ++char *cunescape_length(const char *s, size_t length) { ++ return cunescape_length_with_prefix(s, length, NULL); ++} ++ ++ ++/* Split a string into words, but consider strings enclosed in '' and ++ * "" as words even if they include spaces. */ ++char *split_quoted(const char *c, size_t *l, char **state) { ++ const char *current, *e; ++ bool escaped = false; ++ ++ assert(c); ++ assert(l); ++ assert(state); ++ ++ current = *state ? *state : c; ++ ++ current += strspn(current, WHITESPACE); ++ ++ if (*current == 0) ++ return NULL; ++ ++ else if (*current == '\'') { ++ current ++; ++ ++ for (e = current; *e; e++) { ++ if (escaped) ++ escaped = false; ++ else if (*e == '\\') ++ escaped = true; ++ else if (*e == '\'') ++ break; ++ } ++ ++ *l = e-current; ++ *state = (char*) (*e == 0 ? e : e+1); ++ ++ } else if (*current == '\"') { ++ current ++; ++ ++ for (e = current; *e; e++) { ++ if (escaped) ++ escaped = false; ++ else if (*e == '\\') ++ escaped = true; ++ else if (*e == '\"') ++ break; ++ } ++ ++ *l = e-current; ++ *state = (char*) (*e == 0 ? e : e+1); ++ ++ } else { ++ for (e = current; *e; e++) { ++ if (escaped) ++ escaped = false; ++ else if (*e == '\\') ++ escaped = true; ++ else if (strchr(WHITESPACE, *e)) ++ break; ++ } ++ *l = e-current; ++ *state = (char*) e; ++ } ++ ++ return (char*) current; ++} ++ ++/* Split a string into words. */ ++char *split(const char *c, size_t *l, const char *separator, char **state) { ++ char *current; ++ ++ current = *state ? *state : (char*) c; ++ ++ if (!*current || *c == 0) ++ return NULL; ++ ++ current += strspn(current, separator); ++ *l = strcspn(current, separator); ++ *state = current+*l; ++ ++ return (char*) current; ++} ++ ++int unhexchar(char c) { ++ ++ if (c >= '0' && c <= '9') ++ return c - '0'; ++ ++ if (c >= 'a' && c <= 'f') ++ return c - 'a' + 10; ++ ++ if (c >= 'A' && c <= 'F') ++ return c - 'A' + 10; ++ ++ return -1; ++} ++ ++int unoctchar(char c) { ++ ++ if (c >= '0' && c <= '7') ++ return c - '0'; ++ ++ return -1; ++} +diff --git a/install/util.h b/install/util.h +index 3d7c232..4820842 100644 +--- a/install/util.h ++++ b/install/util.h +@@ -134,8 +134,16 @@ static inline bool isempty(const char *p) { + return !p || !p[0]; + } + ++ ++static inline const char *startswith(const char *s, const char *prefix) { ++ if (strncmp(s, prefix, strlen(prefix)) == 0) ++ return s + strlen(prefix); ++ return NULL; ++} ++ + bool endswith(const char *s, const char *postfix); +-bool startswith(const char *s, const char *prefix); ++ ++ + bool startswith_no_case(const char *s, const char *prefix); + + bool first_word(const char *s, const char *word); +@@ -562,4 +570,16 @@ void warn_melody(void); + + char *strjoin(const char *x, ...) _sentinel_; + ++#define DEFINE_TRIVIAL_CLEANUP_FUNC(type, func) \ ++ static inline void func##p(type *p) { \ ++ if (*p) \ ++ func(*p); \ ++ } \ ++ struct __useless_struct_to_allow_trailing_semicolon__ ++ ++char *split_quoted(const char *c, size_t *l, char **state); ++char *cunescape_length(const char *s, size_t length); ++int unhexchar(char c) _const_; ++int unoctchar(char c) _const_; ++ + #endif +diff --git a/lsinitrd-bash-completion.sh b/lsinitrd-bash-completion.sh +index 78ab165..3df2965 100644 +--- a/lsinitrd-bash-completion.sh ++++ b/lsinitrd-bash-completion.sh +@@ -1,4 +1,4 @@ +-#!/bin/bash ++# + # -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*- + # ex: ts=8 sw=4 sts=4 et filetype=sh + # +diff --git a/mkinitrd-suse.8.asc b/mkinitrd-suse.8.asc +new file mode 100644 +index 0000000..9eb8fc9 +--- /dev/null ++++ b/mkinitrd-suse.8.asc +@@ -0,0 +1,106 @@ ++MKINITRD(8) ++=========== ++:doctype: manpage ++:man source: dracut ++:man manual: dracut ++ ++NAME ++---- ++mkinitrd-suse - is a compat wrapper, which calls dracut to generate an initramfs ++ ++SYNOPSIS ++-------- ++*mkinitrd* ['OPTION...'] ++ ++DESCRIPTION ++----------- ++*mkinitrd* creates an initramfs image for the kernel with ++version by calling *dracut*. ++ ++[IMPORTANT] ++This version of mkinitrd is provided for compability with older ++versions of mkinitrd. If a more fine grained control over the ++resulting image is needed, *dracut* should be called directly. ++ ++OPTIONS ++------- ++**-R, --version**:: ++ print info about the version ++ ++**-k** __:: ++ List of kernel images for which initrd files are created (relative ++ to _boot_dir_), defaults to _vmlinux_ on ppc/ppc64, _image_ on s390/s390x ++ and _vmlinuz_ for everything else. ++ ++**-i** __:: ++ List of file names (relative to _boot_dir_) for the initrd; positions ++ have to match the _kernel_list_. Defaults to _initrd_. ++ ++**-m** __:: ++ Modules to include in initrd, defaults to _INITRD_MODULES_ variable ++ in */etc/sysconfig/kernel*. ++ ++**-f** __:: ++ Features to be enabled for the initrd. In general mkinitrd ++ configures the initrd for the root device it is started from. With ++ this option additional feature can be enabled. ++ ++**-b** __:: ++ Boot directory, defaults to */boot*, where the initrd is created. ++ ++**-d** __:: ++ Root device, defaults to the device from which the root_dir is ++ mounted; overwrites the rootdev enviroment variable if set ++ ++**-s** __:: ++ Add splash animation and bootscreen to initrd. ++ ++**-D** _:: ++ Run dhcp on the specified interface (for example "eth0"). ++ ++**-I** _:: ++ Configure the specified interface statically. ++ ++**-a** _:: ++ Attach compiled ACPI DSDT (Differentiated System Description Table) ++ to initrd. This replaces the DSDT of the BIOS. Defaults to the ++ _ACPI_DSDT_ variable in */etc/sysconfig/kernel*. ++ ++**-M** _:: ++ System.map file to use. ++ ++**-B**:: ++ Don’t run the *update-bootloader(8)* script after the initrd(s) have ++ been created. This is useful if you call mkinitrd(8) for anything ++ else than the running system. ++ ++**-A**:: ++ Create a so called "monster initrd" which includes all available ++ features and modules. ++ ++**-v, --verbose**:: ++ increase verbosity level ++ ++**-L**:: ++ Disable logging to _/var/log/YaST2/mkinitrd.log_. This is useful for ++ testing if you don’t want to clutter the system log. ++ ++**--force**:: ++ overwrite existing initramfs file. ++ ++**--help**:: ++ print a help message and exit. ++ ++AVAILABILITY ++------------ ++The mkinitrd command is part of the dracut package and is available from ++link:$$https://dracut.wiki.kernel.org$$[https://dracut.wiki.kernel.org] ++ ++AUTHORS ++------- ++Harald Hoyer, Hannes Reinecke ++ ++SEE ALSO ++-------- ++*dracut*(8) ++*update-bootloader*(8) +diff --git a/mkinitrd-suse.sh b/mkinitrd-suse.sh +new file mode 100755 +index 0000000..d20270a +--- /dev/null ++++ b/mkinitrd-suse.sh +@@ -0,0 +1,354 @@ ++#!/bin/bash --norc ++# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*- ++# ex: ts=8 sw=4 sts=4 et filetype=sh ++# ++# mkinitrd compability wrapper for SUSE. ++# ++# Copyright (c) 2013 SUSE Linux Products GmbH. All rights reserved. ++# ++# This program is free software; you can redistribute it and/or modify ++# it under the terms of the GNU General Public License as published by ++# the Free Software Foundation; either version 2 of the License, or ++# (at your option) any later version. ++# ++# This program is distributed in the hope that it will be useful, ++# but WITHOUT ANY WARRANTY; without even the implied warranty of ++# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++# GNU General Public License for more details. ++# ++# You should have received a copy of the GNU General Public License ++# along with this program. If not, see . ++# ++ ++boot_dir="/boot" ++quiet=0 ++host_only=1 ++force=0 ++logfile=/var/log/YaST2/mkinitrd.log ++dracut_cmd=dracut ++ ++error() { echo "$@" >&2; } ++ ++usage () { ++ [[ $1 = '-n' ]] && cmd=echo || cmd=error ++ ++ $cmd "usage: ${0##*/} [options]" ++ $cmd "" ++ $cmd " Create initial ramdisk images that contain all kernel modules needed" ++ $cmd " in the early boot process, before the root file system becomes" ++ $cmd " available." ++ $cmd " This usually includes SCSI and/or RAID modules, a file system module" ++ $cmd " for the root file system, or a network interface driver module for dhcp." ++ $cmd "" ++ $cmd " options:" ++ $cmd " -f \"feature list\" Features to be enabled when generating initrd." ++ $cmd " Available features are:" ++ $cmd " iscsi, md, multipath, lvm, lvm2," ++ $cmd " ifup, fcoe, dcbd" ++ $cmd " -k \"kernel list\" List of kernel images for which initrd files are" ++ $cmd " created. Defaults to all kernels found in /boot." ++ $cmd " -i \"initrd list\" List of file names for the initrd; position have" ++ $cmd " match to \"kernel list\". Defaults to all kernels" ++ $cmd " found in /boot." ++ $cmd " -b boot_dir Boot directory. Defaults to /boot." ++ $cmd " -t tmp_dir Temporary directory. Defaults to /var/tmp." ++ $cmd " -M map System.map file to use." ++ $cmd " -A Create a so called \"monster initrd\" which" ++ $cmd " includes all features and modules possible." ++ $cmd " -B Do not update bootloader configuration." ++ $cmd " -v Verbose mode." ++ $cmd " -L Disable logging." ++ $cmd " -h This help screen." ++ $cmd " -m \"module list\" Modules to include in initrd. Defaults to the" ++ $cmd " INITRD_MODULES variable in /etc/sysconfig/kernel" ++ $cmd " -u \"DomU module list\" Modules to include in initrd. Defaults to the" ++ $cmd " DOMU_INITRD_MODULES variable in" ++ $cmd " /etc/sysconfig/kernel." ++ $cmd " -d root_device Root device. Defaults to the device from" ++ $cmd " which / is mounted. Overrides the rootdev" ++ $cmd " enviroment variable if set." ++ $cmd " -j device Journal device" ++ $cmd " -D interface Run dhcp on the specified interface." ++ $cmd " -I interface Configure the specified interface statically." ++ $cmd " -a acpi_dsdt Attach compiled ACPI DSDT (Differentiated" ++ $cmd " System Description Table) to initrd. This" ++ $cmd " replaces the DSDT of the BIOS. Defaults to" ++ $cmd " the ACPI_DSDT variable in /etc/sysconfig/kernel." ++ $cmd " -s size Add splash animation and bootscreen to initrd." ++ ++ [[ $1 = '-n' ]] && exit 0 ++ exit 1 ++} ++ ++# Little helper function for reading args from the commandline. ++# it automatically handles -a b and -a=b variants, and returns 1 if ++# we need to shift $3. ++read_arg() { ++ # $1 = arg name ++ # $2 = arg value ++ # $3 = arg parameter ++ param="$1" ++ local rematch='^[^=]*=(.*)$' result ++ if [[ $2 =~ $rematch ]]; then ++ read "$param" <<< "${BASH_REMATCH[1]}" ++ else ++ for ((i=3; $i <= $#; i++)); do ++ # Only read next arg if it not an arg itself. ++ if [[ ${@:$i:1} = -* ]];then ++ break ++ fi ++ result="$result ${@:$i:1}" ++ # There is no way to shift our callers args, so ++ # return "no of args" to indicate they should do it instead. ++ done ++ read "$1" <<< "$result" ++ return $(($i - 3)) ++ fi ++} ++ ++# Helper functions to calculate ipconfig command line ++calc_netmask() { ++ local prefix=$1 ++ ++ [ -z "$prefix" ] && return ++ mask=$(echo "(2 ^ 32) - (2 ^ $prefix)" | bc -l) ++ byte1=$(( mask >> 24 )) ++ byte2=$(( mask >> 16 )) ++ byte3=$(( mask >> 8 )) ++ byte4=$(( mask & 0xff )) ++ netmask=$(printf "%d.%d.%d.%d" $(( byte1 & 0xff )) $(( byte2 & 0xff )) $(( byte3 & 0xff )) $byte4); ++ ++ echo $netmask ++} ++ ++ipconfig() { ++ local interface=$1 ++ local iplink macaddr broadcast gateway ipaddr prefix netmask ++ ++ iplink=$(ip addr show dev $interface | sed -n 's/ *inet \(.*\) brd.*/\1/p') ++ macaddr=$(ip addr show dev $interface | sed -n 's/.*ether \(.*\) brd.*/\1/p') ++ broadcast=$(ip addr show dev $interface | sed -n 's/.*brd \(.*\) scope.*/\1/p') ++ gateway=$(ip route show dev $interface | sed -n 's/default via \([0-9\.]*\).*/\1/p') ++ ++ ipaddr=${iplink%%/*} ++ prefix=${iplink##*/} ++ netmask=$(calc_netmask $prefix) ++ ++ echo "${ipaddr}:${serveraddr}:${gateway}:${netmask}:${hostname}:${interface}:none::${macaddr}" ++} ++ ++is_xen_kernel() { ++ local kversion=$1 ++ local root_dir=$2 ++ local cfg ++ ++ for cfg in ${root_dir}/boot/config-$kversion $root_dir/lib/modules/$kversion/build/.config ++ do ++ test -r $cfg || continue ++ grep -q "^CONFIG_XEN=y\$" $cfg ++ return ++ done ++ test $kversion != "${kversion%-xen*}" ++ return ++} ++ ++ ++# Taken over from SUSE mkinitrd ++default_kernel_images() { ++ local regex kernel_image kernel_version version_version initrd_image ++ local qf='%{NAME}-%{VERSION}-%{RELEASE}\n' ++ ++ case "$(uname -m)" in ++ s390|s390x) ++ regex='image' ++ ;; ++ ppc|ppc64) ++ regex='vmlinux' ++ ;; ++ i386|x86_64) ++ regex='vmlinuz' ++ ;; ++ arm*) ++ regex='[uz]Image' ++ ;; ++ aarch64) ++ regex='Image' ++ ;; ++ *) regex='vmlinu.' ++ ;; ++ esac ++ ++ kernel_images="" ++ initrd_images="" ++ for kernel_image in $(ls $boot_dir \ ++ | sed -ne "\|^$regex\(-[0-9.]\+-[0-9]\+-[a-z0-9]\+$\)\?|p" \ ++ | grep -v kdump$ ) ; do ++ ++ # Note that we cannot check the RPM database here -- this ++ # script is itself called from within the binary kernel ++ # packages, and rpm does not allow recursive calls. ++ ++ [ -L "$boot_dir/$kernel_image" ] && continue ++ [ "${kernel_image%%.gz}" != "$kernel_image" ] && continue ++ kernel_version=$(/usr/bin/get_kernel_version \ ++ $boot_dir/$kernel_image 2> /dev/null) ++ initrd_image=$(echo $kernel_image | sed -e "s|${regex}|initrd|") ++ if [ "$kernel_image" != "$initrd_image" -a \ ++ -n "$kernel_version" -a \ ++ -d "/lib/modules/$kernel_version" ]; then ++ kernel_images="$kernel_images $boot_dir/$kernel_image" ++ initrd_images="$initrd_images $boot_dir/$initrd_image" ++ fi ++ done ++ for kernel_image in $kernel_images;do ++ kernels="$kernels ${kernel_image#*-}" ++ done ++ for initrd_image in $initrd_images;do ++ targets="$targets $initrd_image" ++ done ++ host_only=1 ++ force=1 ++} ++ ++while (($# > 0)); do ++ case ${1%%=*} in ++ -f) read_arg feature_list "$@" || shift $? ++ # Could be several features ++ ;; ++ -k) # Would be nice to get a list of images here ++ read_arg kernel_images "$@" || shift $? ++ for kernel_image in $kernel_images;do ++ kernels="$kernels ${kernel_image#*-}" ++ done ++ host_only=1 ++ force=1 ++ ;; ++ -i) read_arg initrd_images "$@" || shift $? ++ for initrd_image in $initrd_images;do ++ # Check if the initrd_image contains a path. ++ # if not, then add the default boot_dir ++ dname=`dirname $initrd_image` ++ if [ "$dname" == "." ]; then ++ targets="$targets $boot_dir/$initrd_image"; ++ else ++ targets="$targets $initrd_image"; ++ fi ++ done ++ ;; ++ -b) read_arg boot_dir "$@" || shift $? ++ if [ ! -d $boot_dir ];then ++ error "Boot directory $boot_dir does not exist" ++ exit 1 ++ fi ++ ;; ++ -t) read_arg tmp_dir "$@" || shift $? ++ dracut_args="${dracut_args} --tmpdir $tmp_dir" ++ ;; ++ -M) read_arg map_file "$@" || shift $? ++ ;; ++ -A) host_only=0;; ++ -B) skip_update_bootloader=1;; ++ -v|--verbose) dracut_args="${dracut_args} -v";; ++ -L) logfile=;; ++ -h|--help) usage -n;; ++ -m) read_arg module_list "$@" || shift $? ;; ++ -u) read_arg domu_module_list "$@" || shift $? ++ echo "mkinitrd: DomU modules not yet supported" ;; ++ -d) read_arg rootfs "$@" || shift $? ++ dracut_args="${dracut_args} --filesystems $rootfs" ;; ++ -D) read_arg dhcp_if "$@" || shift $? ++ dracut_cmdline="${dracut_cmdline} ip=${dhcp_if}:dhcp" ++ ;; ++ -I) read_arg static_if "$@" || shift $? ++ dracut_cmdline="${dracut_cmdline} ip=$(ipconfig $static_if)": ++ ;; ++ -a) read_arg acpi_dsdt "$@" || shift $? ++ echo "mkinitrd: custom DSDT not yet supported" ++ exit 1 ++ ;; ++ -s) read_arg boot_splash "$@" || shift $? ++ echo "mkinitrd: boot splash not yet supported" ++ exit 1 ++ ;; ++ -V) echo "mkinitrd: vendor scipts are no longer supported" ++ exit 1;; ++ --dracut) ++ read_arg dracut_cmd "$@" || shift $? ;; ++ --version|-R) ++ echo "mkinitrd: dracut compatibility wrapper" ++ exit 0;; ++ --force) force=1;; ++ --quiet|-q) quiet=1;; ++ *) if [[ ! $targets ]]; then ++ targets=$1 ++ elif [[ ! $kernels ]]; then ++ kernels=$1 ++ else ++ usage ++ fi;; ++ esac ++ shift ++done ++ ++[[ $targets && $kernels ]] || default_kernel_images ++[[ $targets && $kernels ]] || (error "No kernel found in $boot_dir" && usage) ++ ++# We can have several targets/kernels, transform the list to an array ++targets=( $targets ) ++[[ $kernels ]] && kernels=( $kernels ) ++ ++[[ $logfile ]] && dracut_args="${dracut_args} --logfile $logfile" ++[[ $host_only == 1 ]] && dracut_args="${dracut_args} --hostonly" ++[[ $force == 1 ]] && dracut_args="${dracut_args} --force" ++[[ $dracut_cmdline ]] && dracut_args="${dracut_args} --kernel-cmdline ${dracut_cmdline}" ++[ -z "$(type -p update-bootloader)" ] && skip_update_bootloader=1 ++ ++# Update defaults from /etc/sysconfig/kernel ++if [ -f /etc/sysconfig/kernel ] ; then ++ . /etc/sysconfig/kernel ++fi ++[[ $module_list ]] || module_list="${INITRD_MODULES}" ++basicmodules="$basicmodules ${module_list}" ++[[ $domu_module_list ]] || domu_module_list="${DOMU_INITRD_MODULES}" ++[[ $acpi_dsdt ]] || acpi_dsdt="${ACPI_DSDT}" ++ ++echo "Creating: target|kernel|dracut args|basicmodules " ++for ((i=0 ; $i<${#targets[@]} ; i++)); do ++ ++ if [[ $img_vers ]];then ++ target="${targets[$i]}-${kernels[$i]}" ++ else ++ target="${targets[$i]}" ++ fi ++ kernel="${kernels[$i]}" ++ ++ # Duplicate code: No way found how to redirect output based on $quiet ++ if [[ $quiet == 1 ]];then ++ echo "$target|$kernel|$dracut_args|$basicmodules" ++ if is_xen_kernel $kernel $rootfs ; then ++ basicmodules="$basicmodules ${domu_module_list}" ++ fi ++ if [[ $basicmodules ]]; then ++ $dracut_cmd $dracut_args --add-drivers "$basicmodules" "$target" \ ++ "$kernel" &>/dev/null ++ else ++ $dracut_cmd $dracut_args "$target" "$kernel" &>/dev/null ++ fi ++ else ++ if is_xen_kernel $kernel $rootfs ; then ++ basicmodules="$basicmodules ${domu_module_list}" ++ fi ++ if [[ $basicmodules ]]; then ++ $dracut_cmd $dracut_args --add-drivers "$basicmodules" "$target" \ ++ "$kernel" ++ else ++ $dracut_cmd $dracut_args "$target" "$kernel" ++ fi ++ fi ++done ++ ++if [ "$skip_update_bootloader" ] ; then ++ echo 2>&1 "Did not refresh the bootloader. You might need to refresh it manually." ++else ++ update-bootloader --refresh ++fi diff --git a/modules.d/00bash/module-setup.sh b/modules.d/00bash/module-setup.sh index e874e73..f599940 100755 --- a/modules.d/00bash/module-setup.sh @@ -3545,9 +5429,20 @@ index 3eb4de1..a897cef 100755 inst_symlink /init /sbin/init inst_multiple $systemdutildir/systemd-bootchart diff --git a/modules.d/01fips/fips.sh b/modules.d/01fips/fips.sh -index f0a4c5c..98dd1c2 100755 +index f0a4c5c..7fa48f1 100755 --- a/modules.d/01fips/fips.sh +++ b/modules.d/01fips/fips.sh +@@ -60,8 +60,8 @@ do_rhevh_check() + KERNEL=$(uname -r) + kpath=${1} + +- # If we're on RHEV-H, the kernel is in /dev/.initramfs/live/vmlinuz0 +- HMAC_SUM_ORIG=$(cat /boot/.vmlinuz-${KERNEL}.hmac | while read a b; do printf "%s\n" $a; done) ++ # If we're on RHEV-H, the kernel is in /run/initramfs/live/vmlinuz0 ++ HMAC_SUM_ORIG=$(cat $NEWROOT/boot/.vmlinuz-${KERNEL}.hmac | while read a b; do printf "%s\n" $a; done) + HMAC_SUM_CALC=$(sha512hmac $kpath | while read a b; do printf "%s\n" $a; done || return 1) + if [ -z "$HMAC_SUM_ORIG" ] || [ -z "$HMAC_SUM_CALC" ] || [ "${HMAC_SUM_ORIG}" != "${HMAC_SUM_CALC}" ]; then + warn "HMAC sum mismatch" @@ -96,7 +96,6 @@ do_fips() _found=0 while read _k _s _v; do @@ -3556,6 +5451,21 @@ index f0a4c5c..98dd1c2 100755 [ "$_v" != "$_module" ] && continue _found=1 break +@@ -112,10 +111,10 @@ do_fips() + rmmod tcrypt + + info "Checking integrity of kernel" +- if [ -e "$NEWROOT/dev/.initramfs/live/vmlinuz0" ]; then +- do_rhevh_check "$NEWROOT/dev/.initramfs/live/vmlinuz0" || return 1 +- elif [ -e "$NEWROOT/dev/.initramfs/live/isolinux/vmlinuz0" ]; then +- do_rhevh_check "$NEWROOT/dev/.initramfs/live/isolinux/vmlinuz0" || return 1 ++ if [ -e "/run/initramfs/live/vmlinuz0" ]; then ++ do_rhevh_check /run/initramfs/live/vmlinuz0 || return 1 ++ elif [ -e "/run/initramfs/live/isolinux/vmlinuz0" ]; then ++ do_rhevh_check /run/initramfs/live/isolinux/vmlinuz0 || return 1 + else + sha512hmac -c "/boot/.vmlinuz-${KERNEL}.hmac" || return 1 + fi diff --git a/modules.d/01fips/module-setup.sh b/modules.d/01fips/module-setup.sh index d08e3f7..a4081dc 100755 --- a/modules.d/01fips/module-setup.sh @@ -3650,8 +5560,13 @@ index fb4010d..002b7d4 100755 install() { return 0 } +diff --git a/modules.d/03modsign/load-modsign-keys.sh b/modules.d/03modsign/load-modsign-keys.sh +old mode 100644 +new mode 100755 diff --git a/modules.d/03modsign/module-setup.sh b/modules.d/03modsign/module-setup.sh -index 730cd86..5dfd90c 100644 +old mode 100644 +new mode 100755 +index 730cd86..5dfd90c --- a/modules.d/03modsign/module-setup.sh +++ b/modules.d/03modsign/module-setup.sh @@ -7,6 +7,7 @@ @@ -3745,7 +5660,7 @@ index edcc8da..6e508a6 100755 local _i _progs _path _busybox _busybox=$(type -P busybox) diff --git a/modules.d/10i18n/module-setup.sh b/modules.d/10i18n/module-setup.sh -index 2a83728..0741c64 100755 +index 2a83728..fcb18d1 100755 --- a/modules.d/10i18n/module-setup.sh +++ b/modules.d/10i18n/module-setup.sh @@ -2,6 +2,7 @@ @@ -3756,7 +5671,7 @@ index 2a83728..0741c64 100755 check() { [[ "$mount_needs" ]] && return 1 -@@ -12,10 +13,12 @@ check() { +@@ -12,21 +13,19 @@ check() { return 0 } @@ -3768,12 +5683,96 @@ index 2a83728..0741c64 100755 +# called by dracut install() { if dracut_module_included "systemd"; then - [[ -f /etc/vconsole.conf ]] || return 0 +- [[ -f /etc/vconsole.conf ]] || return 0 + unset FONT + unset KEYMAP +- . /etc/vconsole.conf +- # if vconsole.conf has no settings, do not include anything +- [[ $FONT ]] || [[ $KEYMAP ]] || return 0 ++ [[ -f /etc/vconsole.conf ]] && . /etc/vconsole.conf + fi + +- inst_multiple -o $systemdutildir/systemd-vconsole-setup + KBDSUBDIRS=consolefonts,consoletrans,keymaps,unimaps + DEFAULT_FONT="${i18n_default_font:-LatArCyrHeb-16}" + I18N_CONF="/etc/locale.conf" +@@ -158,6 +157,9 @@ install() { + # Gentoo user may have KEYMAP set to something like "-u pl2", + KEYMAP=${KEYMAP#-* } + ++ # openSUSE user may have KEYMAP set to something like ".gz" ++ KEYMAP=${KEYMAP/.gz/} ++ + # KEYTABLE is a bit special - it defines base keymap name and UNICODE + # determines whether non-UNICODE or UNICODE version is used + +@@ -207,10 +209,20 @@ install() { + inst_simple ${kbddir}/unimaps/${FONT_UNIMAP}.uni + fi + +- mksubdirs ${initdir}${I18N_CONF} +- mksubdirs ${initdir}${VCONFIG_CONF} +- print_vars LC_ALL LANG >> ${initdir}${I18N_CONF} +- print_vars KEYMAP EXT_KEYMAPS UNICODE FONT FONT_MAP FONT_UNIMAP >> ${initdir}${VCONFIG_CONF} ++ if dracut_module_included "systemd" && [[ -f ${I18N_CONF} ]]; then ++ inst_simple ${I18N_CONF} ++ else ++ mksubdirs ${initdir}${I18N_CONF} ++ print_vars LC_ALL LANG >> ${initdir}${I18N_CONF} ++ fi ++ ++ if dracut_module_included "systemd" && [[ -f ${VCONFIG_CONF} ]]; then ++ inst_simple ${VCONFIG_CONF} ++ else ++ mksubdirs ${initdir}${VCONFIG_CONF} ++ print_vars KEYMAP EXT_KEYMAPS UNICODE FONT FONT_MAP FONT_UNIMAP >> ${initdir}${VCONFIG_CONF} ++ fi ++ + return 0 + } + +@@ -234,16 +246,13 @@ install() { + return 0 + } + +- if checks +- then ++ if checks; then + install_base + +- if [[ ${hostonly} ]] +- then ++ if [[ ${hostonly} ]] && ! [[ ${i18n_install_all} ]]; then + install_local_i18n || install_all_kbd + else + install_all_kbd + fi + fi + } +- diff --git a/modules.d/10i18n/parse-i18n.sh b/modules.d/10i18n/parse-i18n.sh -index 348c5bc..416a746 100755 +index 348c5bc..135c57b 100755 --- a/modules.d/10i18n/parse-i18n.sh +++ b/modules.d/10i18n/parse-i18n.sh -@@ -19,24 +19,18 @@ inst_key_val() { +@@ -6,37 +6,30 @@ inst_key_val() { + local _value + local _file + local _default +- _default=$1 +- shift +- _file=$1 +- shift +- _value=$(getarg $@) ++ _file="$1"; shift ++ _key="$1"; shift ++ _default="$1"; shift ++ _value="$(getarg $@)" + [ -z "${_value}" ] && _value=$_default + if [ -n "${_value}" ]; then +- printf '%s="%s"\n' $2 ${_value} >> $_file ++ printf '%s="%s"\n' $key ${_value} >> $_file + fi + unset _file unset _value } @@ -3783,17 +5782,17 @@ index 348c5bc..416a746 100755 -inst_key_val '' /etc/vconsole.conf vconsole.font.unimap FONT_UNIMAP -d UNIMAP -inst_key_val 1 /etc/vconsole.conf vconsole.font.unicode UNICODE vconsole.unicode -inst_key_val '' /etc/vconsole.conf vconsole.keymap.ext EXT_KEYMAP -+inst_key_val '' /etc/vconsole.conf rd.vconsole.keymap vconsole.keymap KEYMAP -d KEYTABLE -+inst_key_val '' /etc/vconsole.conf rd.vconsole.font vconsole.font FONT -d SYSFONT -+inst_key_val '' /etc/vconsole.conf rd.vconsole.font.map vconsole.font.map FONT_MAP -d CONTRANS -+inst_key_val '' /etc/vconsole.conf rd.vconsole.font.unimap vconsole.font.unimap FONT_UNIMAP -d UNIMAP -+inst_key_val 1 /etc/vconsole.conf rd.vconsole.font.unicode vconsole.font.unicode UNICODE vconsole.unicode -+inst_key_val '' /etc/vconsole.conf rd.vconsole.keymap.ext vconsole.keymap.ext EXT_KEYMAP ++inst_key_val /etc/vconsole.conf KEYMAP '' rd.vconsole.keymap KEYMAP -d KEYTABLE ++inst_key_val /etc/vconsole.conf FONT '' rd.vconsole.font FONT -d SYSFONT ++inst_key_val /etc/vconsole.conf FONT_MAP '' rd.vconsole.font.map FONT_MAP -d CONTRANS ++inst_key_val /etc/vconsole.conf FONT_UNIMAP '' rd.vconsole.font.unimap FONT_UNIMAP -d UNIMAP ++inst_key_val /etc/vconsole.conf UNICODE 1 rd.vconsole.font.unicode UNICODE vconsole.unicode ++inst_key_val /etc/vconsole.conf EXT_KEYMAP '' rd.vconsole.keymap.ext EXT_KEYMAP -inst_key_val '' /etc/locale.conf locale.LANG LANG -inst_key_val '' /etc/locale.conf locale.LC_ALL LC_ALL -+inst_key_val '' /etc/locale.conf rd.locale.LANG locale.LANG LANG -+inst_key_val '' /etc/locale.conf rd.locale.LC_ALL locale.LC_ALL LC_ALL ++inst_key_val /etc/locale.conf LANG '' rd.locale.LANG LANG ++inst_key_val /etc/locale.conf LC_ALL '' rd.locale.LC_ALL LC_ALL if [ -f /etc/locale.conf ]; then . /etc/locale.conf @@ -3842,8 +5841,23 @@ index 07c3d9b..af483ac 100755 type getarg >/dev/null 2>&1 || . /lib/dracut-lib.sh type ip_to_var >/dev/null 2>&1 || . /lib/net-lib.sh +diff --git a/modules.d/40network/ifup.sh b/modules.d/40network/ifup.sh +index 9f6f449..2edcfe6 100755 +--- a/modules.d/40network/ifup.sh ++++ b/modules.d/40network/ifup.sh +@@ -87,6 +87,10 @@ do_dhcp() { + # dhclient-script will mark the netif up and generate the online + # event for nfsroot + # XXX add -V vendor class and option parsing per kernel ++ if ! iface_has_link $netif; then ++ echo "No carrier detected" ++ 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" diff --git a/modules.d/40network/module-setup.sh b/modules.d/40network/module-setup.sh -index d2833d0..8a2898c 100755 +index d2833d0..547ad16 100755 --- a/modules.d/40network/module-setup.sh +++ b/modules.d/40network/module-setup.sh @@ -2,6 +2,7 @@ @@ -3854,7 +5868,7 @@ index d2833d0..8a2898c 100755 check() { local _program -@@ -15,10 +16,12 @@ check() { +@@ -15,15 +16,17 @@ check() { return 255 } @@ -3867,6 +5881,12 @@ index d2833d0..8a2898c 100755 installkernel() { # Include wired net drivers, excluding wireless + net_module_filter() { +- local _net_drivers='eth_type_trans|register_virtio_device' ++ local _net_drivers='eth_type_trans|register_virtio_device|usbnet_open' + local _unwanted_drivers='/(wireless|isdn|uwb)/' + local _ret + # subfunctions inherit following FDs @@ -67,6 +70,7 @@ installkernel() { instmods =drivers/net/phy ecb arc4 bridge stp llc ipv6 bonding 8021q af_packet virtio_net =drivers/net/team } @@ -3875,6 +5895,82 @@ index d2833d0..8a2898c 100755 install() { local _arch _i _dir inst_multiple ip arping dhclient sed +diff --git a/modules.d/40network/net-lib.sh b/modules.d/40network/net-lib.sh +old mode 100644 +new mode 100755 +index 88e72ec..7544401 +--- a/modules.d/40network/net-lib.sh ++++ b/modules.d/40network/net-lib.sh +@@ -28,30 +28,6 @@ iface_for_mac() { + done + } + +-iface_has_link() { +- local interface="$1" flags="" +- [ -n "$interface" ] || return 2 +- interface="/sys/class/net/$interface" +- [ -d "$interface" ] || return 2 +- flags=$(cat $interface/flags) +- echo $(($flags|0x41)) > $interface/flags # 0x41: IFF_UP|IFF_RUNNING +- [ "$(cat $interface/carrier)" = 1 ] || return 1 +- # XXX Do we need to reset the flags here? anaconda never bothered.. +-} +- +-find_iface_with_link() { +- local iface_path="" iface="" +- for iface_path in /sys/class/net/*; do +- iface=${iface_path##*/} +- str_starts "$iface" "lo" && continue +- if iface_has_link $iface; then +- echo "$iface" +- return 0 +- fi +- done +- return 1 +-} +- + # get the iface name for the given identifier - either a MAC, IP, or iface name + iface_name() { + case $1 in +@@ -443,7 +419,7 @@ wait_for_if_up() { + local li + while [ $cnt -lt 200 ]; do + li=$(ip -o link show up dev $1) +- [ -n "$li" ] && return 0 ++ [ -n "$li" ] && [ -z "${li##*state UP*}" ] && return 0 + sleep 0.1 + cnt=$(($cnt+1)) + done +@@ -483,3 +459,26 @@ type hostname >/dev/null 2>&1 || \ + hostname() { + cat /proc/sys/kernel/hostname + } ++ ++iface_has_link() { ++ local interface="$1" flags="" ++ [ -n "$interface" ] || return 2 ++ interface="/sys/class/net/$interface" ++ [ -d "$interface" ] || return 2 ++ linkup "$1" ++ [ "$(cat $interface/carrier)" = 1 ] || return 1 ++ # XXX Do we need to reset the flags here? anaconda never bothered.. ++} ++ ++find_iface_with_link() { ++ local iface_path="" iface="" ++ for iface_path in /sys/class/net/*; do ++ iface=${iface_path##*/} ++ str_starts "$iface" "lo" && continue ++ if iface_has_link $iface; then ++ echo "$iface" ++ return 0 ++ fi ++ done ++ return 1 ++} +diff --git a/modules.d/40network/parse-vlan.sh b/modules.d/40network/parse-vlan.sh +old mode 100644 +new mode 100755 diff --git a/modules.d/45ifcfg/module-setup.sh b/modules.d/45ifcfg/module-setup.sh index ce53e5e..c407f45 100755 --- a/modules.d/45ifcfg/module-setup.sh @@ -3923,7 +6019,9 @@ index b5cf36f..1ed97ac 100755 local _dir _crt _found _lib inst_simple "$moddir/url-lib.sh" "/lib/url-lib.sh" diff --git a/modules.d/50drm/module-setup.sh b/modules.d/50drm/module-setup.sh -index bf33c5b..e25fc9f 100644 +old mode 100644 +new mode 100755 +index bf33c5b..e25fc9f --- a/modules.d/50drm/module-setup.sh +++ b/modules.d/50drm/module-setup.sh @@ -2,14 +2,17 @@ @@ -4213,10 +6311,10 @@ index c6d1f9d..851fd1a 100755 inst_multiple umount dmsetup blkid dd losetup grep blockdev inst_multiple -o checkisomd5 diff --git a/modules.d/90kernel-modules/module-setup.sh b/modules.d/90kernel-modules/module-setup.sh -index e7e2ca0..d65e92b 100755 +index e7e2ca0..62e8c39 100755 --- a/modules.d/90kernel-modules/module-setup.sh +++ b/modules.d/90kernel-modules/module-setup.sh -@@ -2,6 +2,7 @@ +@@ -2,10 +2,11 @@ # -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*- # ex: ts=8 sw=4 sts=4 et filetype=sh @@ -4224,6 +6322,11 @@ index e7e2ca0..d65e92b 100755 installkernel() { if [[ -z $drivers ]]; then block_module_filter() { +- local _blockfuncs='ahci_init_controller|ata_scsi_ioctl|scsi_add_host|blk_init_queue|register_mtd_blktrans|scsi_esp_register|register_virtio_device|usb_stor_disconnect' ++ local _blockfuncs='ahci_init_controller|ata_scsi_ioctl|scsi_add_host|blk_cleanup_queue|register_mtd_blktrans|scsi_esp_register|register_virtio_device|usb_stor_disconnect' + # subfunctions inherit following FDs + local _merge=8 _side2=9 + function bmf1() { @@ -35,9 +36,12 @@ installkernel() { return 0 } @@ -4281,7 +6384,7 @@ index be7832b..f1e757e 100755 inst_hook cmdline 29 "$moddir/parse-livenet.sh" inst_hook initqueue/online 95 "$moddir/fetch-liveupdate.sh" diff --git a/modules.d/90lvm/module-setup.sh b/modules.d/90lvm/module-setup.sh -index f98ffff..87374da 100755 +index f98ffff..a64e5d6 100755 --- a/modules.d/90lvm/module-setup.sh +++ b/modules.d/90lvm/module-setup.sh @@ -2,6 +2,7 @@ @@ -4343,17 +6446,45 @@ index f98ffff..87374da 100755 echo >> "${initdir}/etc/cmdline.d/90lvm.conf" inst_rules "$moddir/64-lvm.rules" -@@ -94,9 +87,6 @@ install() { +@@ -83,6 +76,16 @@ install() { + fi + + inst_rules 11-dm-lvm.rules 69-dm-lvm-metad.rules ++ ++ # Do not run lvmetad update via pvscan in udev rule - lvmetad is not running yet in dracut! ++ if grep -q SYSTEMD_WANTS ${initdir}/lib/udev/rules.d/69-dm-lvm-metad.rules; then ++ sed -i -e 's/^ENV{SYSTEMD_ALIAS}=.*/# No LVM pvscan in dracut - lvmetad is not running yet/' ${initdir}/lib/udev/rules.d/69-dm-lvm-metad.rules ++ sed -i -e 's/^ENV{ID_MODEL}=.*//' ${initdir}/lib/udev/rules.d/69-dm-lvm-metad.rules ++ sed -i -e 's/^ENV{SYSTEMD_WANTS}=.*//' ${initdir}/lib/udev/rules.d/69-dm-lvm-metad.rules ++ else ++ sed -i -e 's/.*lvm pvscan.*/# No LVM pvscan for in dracut - lvmetad is not running yet/' ${initdir}/lib/udev/rules.d/69-dm-lvm-metad.rules ++ fi ++ + # Gentoo ebuild for LVM2 prior to 2.02.63-r1 doesn't install above rules + # files, but provides the one below: + inst_rules 64-device-mapper.rules +@@ -94,9 +97,18 @@ install() { inst_libdir_file "libdevmapper-event-lvm*.so" - if [[ $_needthin ]]; then -- inst_multiple -o thin_dump thin_restore thin_check thin_repair -- fi ++ if [[ $hostonly ]] && type -P lvs &>/dev/null; then ++ for dev in "${!host_fs_types[@]}"; do ++ [ -e /sys/block/${dev#/dev/}/dm/name ] || continue ++ dev=$(/dev/null) ++ [[ ${DM_VG_NAME} ]] && [[ ${DM_LV_NAME} ]] || continue ++ if [[ "$(lvs --noheadings -o segtype ${DM_VG_NAME} 2>/dev/null)" == *thin* ]] ; then ++ inst_multiple -o thin_dump thin_restore thin_check thin_repair ++ break ++ fi ++ done ++ else + inst_multiple -o thin_dump thin_restore thin_check thin_repair + fi - -+ inst_multiple -o thin_dump thin_restore thin_check thin_repair } - +- diff --git a/modules.d/90mdraid/module-setup.sh b/modules.d/90mdraid/module-setup.sh index 34aae1e..61483f2 100755 --- a/modules.d/90mdraid/module-setup.sh @@ -4492,6 +6623,9 @@ index 43a5a00..90c7bc2 100755 install() { inst_multiple gpg inst "$moddir/crypt-gpg-lib.sh" "/lib/dracut-crypt-gpg-lib.sh" +diff --git a/modules.d/91crypt-loop/crypt-loop-lib.sh b/modules.d/91crypt-loop/crypt-loop-lib.sh +old mode 100644 +new mode 100755 diff --git a/modules.d/91crypt-loop/module-setup.sh b/modules.d/91crypt-loop/module-setup.sh index c14fd45..00052d3 100644 --- a/modules.d/91crypt-loop/module-setup.sh @@ -4550,36 +6684,37 @@ index c17b973..546d2ff 100755 local _i local _nsslibs diff --git a/modules.d/95dasd/module-setup.sh b/modules.d/95dasd/module-setup.sh -index 3b8396d..861df29 100755 +index 3b8396d..9c93d40 100755 --- a/modules.d/95dasd/module-setup.sh +++ b/modules.d/95dasd/module-setup.sh -@@ -2,20 +2,24 @@ +@@ -2,20 +2,21 @@ # -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*- # ex: ts=8 sw=4 sts=4 et filetype=sh +# called by dracut check() { local _arch=$(uname -m) ++ [ -x /sbin/normalize_dasd_arg ] || return 1 [ "$_arch" = "s390" -o "$_arch" = "s390x" ] || return 1 return 0 } +# called by dracut depends() { ++ echo "dasd_mod" return 0 } -+# called by dracut - installkernel() { - instmods dasd_mod dasd_eckd_mod dasd_fba_mod dasd_diag_mod - } - +-installkernel() { +- instmods dasd_mod dasd_eckd_mod dasd_fba_mod dasd_diag_mod +-} +- +# called by dracut install() { inst_hook cmdline 30 "$moddir/parse-dasd.sh" inst_multiple dasdinfo dasdconf.sh normalize_dasd_arg diff --git a/modules.d/95dasd_mod/module-setup.sh b/modules.d/95dasd_mod/module-setup.sh -index 9c9eeea..011010d 100755 +index 9c9eeea..8fde525 100755 --- a/modules.d/95dasd_mod/module-setup.sh +++ b/modules.d/95dasd_mod/module-setup.sh @@ -2,6 +2,7 @@ @@ -4590,7 +6725,7 @@ index 9c9eeea..011010d 100755 check() { local _arch=$(uname -m) [ "$_arch" = "s390" -o "$_arch" = "s390x" ] || return 1 -@@ -9,14 +10,17 @@ check() { +@@ -9,16 +10,20 @@ check() { return 0 } @@ -4607,7 +6742,118 @@ index 9c9eeea..011010d 100755 +# called by dracut install() { inst_hook cmdline 31 "$moddir/parse-dasd-mod.sh" - inst_multiple dasd_cio_free grep sed seq +- inst_multiple dasd_cio_free grep sed seq ++ inst_multiple grep sed seq ++ inst_multiple -o dasd_cio_free + } + +diff --git a/modules.d/95dasd_mod/parse-dasd-mod.sh b/modules.d/95dasd_mod/parse-dasd-mod.sh +index 87c88ed..0236d12 100755 +--- a/modules.d/95dasd_mod/parse-dasd-mod.sh ++++ b/modules.d/95dasd_mod/parse-dasd-mod.sh +@@ -15,4 +15,6 @@ if [ -n "$mod_args" ]; then + fi + + unset dasd_arg +-dasd_cio_free ++if [ -x /sbin/dasd_cio_free ] ; then ++ dasd_cio_free ++fi +diff --git a/modules.d/95dasd_rules/module-setup.sh b/modules.d/95dasd_rules/module-setup.sh +new file mode 100755 +index 0000000..d313171 +--- /dev/null ++++ b/modules.d/95dasd_rules/module-setup.sh +@@ -0,0 +1,27 @@ ++#!/bin/bash ++# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*- ++# ex: ts=8 sw=4 sts=4 et filetype=sh ++ ++# called by dracut ++check() { ++ local _arch=$(uname -m) ++ [ -x /sbin/dasd_configure ] || return 1 ++ [ "$_arch" = "s390" -o "$_arch" = "s390x" ] || return 1 ++ return 0 ++} ++ ++# called by dracut ++depends() { ++ echo 'dasd_mod' ++ return 0 ++} ++ ++# called by dracut ++install() { ++ inst_multiple /usr/lib/udev/collect ++ inst_hook cmdline 30 "$moddir/parse-dasd.sh" ++ if [[ $hostonly ]] ; then ++ inst_rules_wildcard 51-dasd-*.rules ++ fi ++ inst_rules 59-dasd.rules ++} +diff --git a/modules.d/95dasd_rules/parse-dasd.sh b/modules.d/95dasd_rules/parse-dasd.sh +new file mode 100755 +index 0000000..9389c44 +--- /dev/null ++++ b/modules.d/95dasd_rules/parse-dasd.sh +@@ -0,0 +1,56 @@ ++#!/bin/sh ++# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*- ++# ex: ts=8 sw=4 sts=4 et filetype=sh ++ ++create_udev_rule() { ++ local ccw=$1 ++ local _drv _cu_type _dev_type ++ local _rule=/etc/udev/rules.d/51-dasd-${ccw}.rules ++ ++ if [ -e /sys/bus/ccw/devices/${ccw} ] ; then ++ read _cu_type < /sys/bus/ccw/devices/${ccw}/cutype ++ read _dev_type < /sys/bus/ccw/devices/${ccw}/devtype ++ fi ++ case "$_cu_type" in ++ 3990/*|2105/*|2107/*|1750/*|9343/*) ++ _drv=dasd-eckd ++ ;; ++ 6310/*) ++ _drv=dasd-fba ++ ;; ++ 3880/*) ++ case "$_dev_type" in ++ 3380/*) ++ _drv=dasd_eckd ++ ;; ++ 3370/*) ++ _drv=dasd-fba ++ ;; ++ esac ++ ;; ++ esac ++ [ -z "${_drv}" ] && return 0 ++ ++ [ -e ${_rule} ] && return 0 ++ ++ cat > $_rule </dev/null || . /lib/dracut-lib.sh ++command -v get_fcoe_boot_mac >/dev/null || . /lib/uefi-lib.sh ++command -v set_ifname >/dev/null || . /lib/net-lib.sh ++ ++print_fcoe_uefi_conf() ++{ ++ local mac dev vlan ++ mac=$(get_fcoe_boot_mac) ++ [ -z "$mac" ] && continue ++ dev=$(set_ifname fcoe $mac) ++ vlan=$(get_fcoe_boot_vlan) ++ if [ "$vlan" -ne "0" ]; then ++ case "$vlan" in ++ [0-9]*) ++ printf "%s\n" "vlan=$dev.$vlan:$dev" ++ dev="$dev.$vlan" ++ ;; ++ *) ++ printf "%s\n" "vlan=$vlan:$dev" ++ dev="$vlan" ++ ;; ++ esac ++ fi ++ # fcoe=eth0:nodcb ++ printf "%s\n" "$dev:nodcb" ++} ++ ++ ++if [ -e /sys/firmware/efi/vars/FcoeBootDevice-a0ebca23-5f9c-447a-a268-22b6c158c2ac/data ]; then ++ print_fcoe_uefi_conf > /etc/cmdline.d/40-fcoe-uefi.conf ++fi diff --git a/modules.d/95fcoe/fcoe-up.sh b/modules.d/95fcoe/fcoe-up.sh index ecb1593..8cf39ec 100755 --- a/modules.d/95fcoe/fcoe-up.sh @@ -4645,18 +6958,24 @@ index ecb1593..8cf39ec 100755 type ip_to_var >/dev/null 2>&1 || . /lib/net-lib.sh diff --git a/modules.d/95fcoe/module-setup.sh b/modules.d/95fcoe/module-setup.sh -index 08ba4ea..7ada2ee 100755 +index 08ba4ea..539c464 100755 --- a/modules.d/95fcoe/module-setup.sh +++ b/modules.d/95fcoe/module-setup.sh -@@ -2,6 +2,7 @@ +@@ -2,12 +2,8 @@ # -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*- # ex: ts=8 sw=4 sts=4 et filetype=sh +# called by dracut check() { - # FIXME - # If hostonly was requested, fail the check until we have some way of -@@ -15,15 +16,18 @@ check() { +- # FIXME +- # If hostonly was requested, fail the check until we have some way of +- # knowing we are booting from FCoE +- [[ $hostonly ]] || [[ $mount_needs ]] && return 1 +- + for i in dcbtool fipvlan lldpad ip readlink; do + type -P $i >/dev/null || return 1 + done +@@ -15,15 +11,18 @@ check() { return 0 } @@ -4675,6 +6994,55 @@ index 08ba4ea..7ada2ee 100755 install() { inst_multiple ip dcbtool fipvlan lldpad readlink +@@ -32,7 +31,6 @@ install() { + inst "$moddir/fcoe-up.sh" "/sbin/fcoe-up" + inst "$moddir/fcoe-edd.sh" "/sbin/fcoe-edd" + inst "$moddir/fcoe-genrules.sh" "/sbin/fcoe-genrules.sh" +- inst_hook cmdline 20 "$moddir/parse-uefifcoe.sh" + inst_hook cmdline 99 "$moddir/parse-fcoe.sh" + dracut_need_initqueue + } +diff --git a/modules.d/95fcoe/parse-uefifcoe.sh b/modules.d/95fcoe/parse-uefifcoe.sh +deleted file mode 100755 +index e03bcb3..0000000 +--- a/modules.d/95fcoe/parse-uefifcoe.sh ++++ /dev/null +@@ -1,35 +0,0 @@ +-#!/bin/bash +-# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*- +-# ex: ts=8 sw=4 sts=4 et filetype=sh +- +-command -v getarg >/dev/null || . /lib/dracut-lib.sh +-command -v get_fcoe_boot_mac >/dev/null || . /lib/uefi-lib.sh +-command -v set_ifname >/dev/null || . /lib/net-lib.sh +- +-print_fcoe_uefi_conf() +-{ +- local mac dev vlan +- mac=$(get_fcoe_boot_mac) +- [ -z "$mac" ] && continue +- dev=$(set_ifname fcoe $mac) +- vlan=$(get_fcoe_boot_vlan) +- if [ "$vlan" -ne "0" ]; then +- case "$vlan" in +- [0-9]*) +- printf "%s\n" "vlan=$dev.$vlan:$dev" +- dev="$dev.$vlan" +- ;; +- *) +- printf "%s\n" "vlan=$vlan:$dev" +- dev="$vlan" +- ;; +- esac +- fi +- # fcoe=eth0:nodcb +- printf "%s\n" "$dev:nodcb" +-} +- +- +-if [ -e /sys/firmware/efi/vars/FcoeBootDevice-a0ebca23-5f9c-447a-a268-22b6c158c2ac/data ]; then +- print_fcoe_uefi_conf > /etc/cmdline.d/40-fcoe-uefi.conf +-fi diff --git a/modules.d/95fstab-sys/module-setup.sh b/modules.d/95fstab-sys/module-setup.sh index ca66005..c31358c 100755 --- a/modules.d/95fstab-sys/module-setup.sh @@ -4698,10 +7066,10 @@ index ca66005..c31358c 100755 [ -f /etc/fstab.sys ] && inst_simple /etc/fstab.sys inst_hook pre-pivot 00 "$moddir/mount-sys.sh" diff --git a/modules.d/95iscsi/iscsiroot.sh b/modules.d/95iscsi/iscsiroot.sh -index 5181f52..738fff4 100755 +index 5181f52..ef090f7 100755 --- a/modules.d/95iscsi/iscsiroot.sh +++ b/modules.d/95iscsi/iscsiroot.sh -@@ -40,14 +40,6 @@ modprobe crc32c 2>/dev/null +@@ -40,24 +40,19 @@ modprobe crc32c 2>/dev/null [ -e /sys/module/bnx2i ] && iscsiuio if getargbool 0 rd.iscsi.firmware -d -y iscsi_firmware ; then @@ -4716,15 +7084,24 @@ index 5181f52..738fff4 100755 for p in $(getargs rd.iscsi.param -d iscsi_param); do iscsi_param="$iscsi_param --param $p" done -@@ -55,6 +47,7 @@ if getargbool 0 rd.iscsi.firmware -d -y iscsi_firmware ; then - iscsistart -b $iscsi_param - echo 'started' > "/tmp/iscsistarted-iscsi" - echo 'started' > "/tmp/iscsistarted-firmware" -+ need_shutdown - exit 0 + +- iscsistart -b $iscsi_param +- echo 'started' > "/tmp/iscsistarted-iscsi" +- echo 'started' > "/tmp/iscsistarted-firmware" +- exit 0 ++ if ! [ -e /tmp/iscsistarted-firmware ] && iscsistart -b $iscsi_param; then ++ echo 'started' > "/tmp/iscsistarted-iscsi" ++ echo 'started' > "/tmp/iscsistarted-firmware" ++ need_shutdown ++ fi ++ [ "$netif" = dummy ] && exit 0 fi -@@ -137,7 +130,7 @@ handle_netroot() ++ + handle_netroot() + { + local iscsi_initiator iscsi_target_name iscsi_target_ip iscsi_target_port +@@ -137,7 +132,7 @@ handle_netroot() # FIXME $iscsi_protocol?? @@ -4773,6 +7150,19 @@ index 502e834..8379f4b 100755 install() { inst_multiple umount iscsistart hostname iscsi-iname inst_multiple -o iscsiuio +diff --git a/modules.d/95iscsi/parse-iscsiroot.sh b/modules.d/95iscsi/parse-iscsiroot.sh +index 0c8b524..77bd991 100755 +--- a/modules.d/95iscsi/parse-iscsiroot.sh ++++ b/modules.d/95iscsi/parse-iscsiroot.sh +@@ -64,7 +64,7 @@ if [ -n "$iscsi_firmware" ] ; then + netroot=${netroot:-iscsi} + modprobe -q iscsi_boot_sysfs 2>/dev/null + modprobe -q iscsi_ibft +- echo "[ -f '/tmp/iscsistarted-firmware' ]" > $hookdir/initqueue/finished/iscsi_firmware_started.sh ++ initqueue --onetime --settled /sbin/iscsiroot dummy "$netroot" "$NEWROOT" + fi + + # If it's not iscsi we don't continue diff --git a/modules.d/95nbd/module-setup.sh b/modules.d/95nbd/module-setup.sh index 7b78180..37ace21 100755 --- a/modules.d/95nbd/module-setup.sh @@ -4856,7 +7246,7 @@ index 75beb74..345810a 100755 local _i local _nsslibs diff --git a/modules.d/95resume/module-setup.sh b/modules.d/95resume/module-setup.sh -index 518ebf0..a172c27 100755 +index 518ebf0..ceb7855 100755 --- a/modules.d/95resume/module-setup.sh +++ b/modules.d/95resume/module-setup.sh @@ -2,11 +2,12 @@ @@ -4873,15 +7263,32 @@ index 518ebf0..a172c27 100755 done return 255 } -@@ -14,6 +15,7 @@ check() { +@@ -14,8 +15,24 @@ check() { return 0 } ++# called by dracut ++cmdline() { ++ local _activated ++ declare -A _activated ++ ++ for dev in "${!host_fs_types[@]}"; do ++ [[ ${host_fs_types[$dev]} =~ ^(swap|swsuspend|swsupend)$ ]] || continue ++ printf "resume=%s " "$(shorten_persistent_dev "$(get_persistent_dev "$dev")")" ++ done ++} ++ +# called by dracut install() { local _bin ++ ++ cmdline >> "${initdir}/etc/cmdline.d/95resume.conf" ++ echo >> "${initdir}/etc/cmdline.d/95resume.conf" ++ # Optional uswsusp support -@@ -30,7 +32,6 @@ install() { + for _bin in /usr/sbin/resume /usr/lib/suspend/resume /usr/lib/uswsusp/resume + do +@@ -30,7 +47,6 @@ install() { inst_hook cmdline 10 "$moddir/parse-resume.sh" else inst_script "$moddir/parse-resume.sh" /lib/dracut/parse-resume.sh @@ -4889,6 +7296,95 @@ index 518ebf0..a172c27 100755 fi inst_script "$moddir/resume.sh" /lib/dracut/resume.sh +diff --git a/modules.d/95resume/parse-resume.sh b/modules.d/95resume/parse-resume.sh +index bd4bcd3..8682a03 100755 +--- a/modules.d/95resume/parse-resume.sh ++++ b/modules.d/95resume/parse-resume.sh +@@ -36,41 +36,51 @@ case "$splash" in + ;; + esac + +-if [ -n "$resume" ]; then +- { +- printf "KERNEL==\"%s\", ACTION==\"add|change\", SYMLINK+=\"/dev/resume\"\n" \ +- ${resume#/dev/}; +- printf "SYMLINK==\"%s\", ACTION==\"add|change\", SYMLINK+=\"/dev/resume\"\n" \ +- ${resume#/dev/}; +- } >> /etc/udev/rules.d/99-resume-link.rules + +- { +- if [ -x /usr/sbin/resume ]; then +- printf "KERNEL==\"%s\", ACTION==\"add|change\", ENV{ID_FS_TYPE}==\"suspend|swsuspend|swsupend\", RUN+=\"/sbin/initqueue --finished --unique --name 00resume /usr/sbin/resume %s \'%s\'\"\n" \ +- ${resume#/dev/} "$a_splash" "$resume"; +- printf "SYMLINK==\"%s\", ACTION==\"add|change\", ENV{ID_FS_TYPE}==\"suspend|swsuspend|swsupend\", RUN+=\"/sbin/initqueue --finished --unique --name 00resume /usr/sbin/resume %s \'%s\'\"\n" \ +- ${resume#/dev/} "$a_splash" "$resume"; +- fi +- printf "KERNEL==\"%s\", ACTION==\"add|change\", ENV{ID_FS_TYPE}==\"suspend|swsuspend|swsupend\", RUN+=\"/sbin/initqueue --finished --unique --name 00resume echo %%M:%%m > /sys/power/resume\"\n" \ +- ${resume#/dev/}; +- printf "SYMLINK==\"%s\", ACTION==\"add|change\", ENV{ID_FS_TYPE}==\"suspend|swsuspend|swsupend\", RUN+=\"/sbin/initqueue --finished --unique --name 00resume echo %%M:%%m > /sys/power/resume\"\n" \ +- ${resume#/dev/}; +- } >> /etc/udev/rules.d/99-resume.rules ++if ! getarg noresume; then ++ if [ -n "$resume" ]; then ++ { ++ printf "KERNEL==\"%s\", ACTION==\"add|change\", SYMLINK+=\"resume\"\n" \ ++ ${resume#/dev/}; ++ printf "SYMLINK==\"%s\", ACTION==\"add|change\", SYMLINK+=\"resume\"\n" \ ++ ${resume#/dev/}; ++ } >> /etc/udev/rules.d/99-resume-link.rules + +- printf '[ -e "%s" ] && { ln -s "%s" /dev/resume; rm -f -- "$job" "%s/initqueue/timeout/resume.sh"; }\n' \ +- "$resume" "$resume" "$hookdir" >> $hookdir/initqueue/settled/resume.sh ++ { ++ if [ -x /usr/sbin/resume ]; then ++ printf -- "KERNEL==\"%s\", " "${resume#/dev/}" ++ printf -- "ACTION==\"add|change\", ENV{ID_FS_TYPE}==\"suspend|swsuspend|swsupend\"," ++ printf -- " RUN+=\"/sbin/initqueue --finished --unique --name 00resume /usr/sbin/resume %s \'%s\'\"\n" \ ++ "$a_splash" "$resume"; ++ printf -- "SYMLINK==\"%s\", " "${resume#/dev/}" ++ printf -- "ACTION==\"add|change\", ENV{ID_FS_TYPE}==\"suspend|swsuspend|swsupend\"," ++ printf -- " RUN+=\"/sbin/initqueue --finished --unique --name 00resume /usr/sbin/resume %s \'%s\'\"\n" \ ++ "$a_splash" "$resume"; ++ fi ++ printf -- "KERNEL==\"%s\", " ${resume#/dev/}; ++ printf -- "ACTION==\"add|change\", ENV{ID_FS_TYPE}==\"suspend|swsuspend|swsupend\"," ++ printf -- "%s" " RUN+=\"/sbin/initqueue --finished --unique --name 00resume echo %%M:%%m > /sys/power/resume\"\n" ++ printf -- "SYMLINK==\"%s\", " ${resume#/dev/}; ++ printf -- "%s" "ACTION==\"add|change\", ENV{ID_FS_TYPE}==\"suspend|swsuspend|swsupend\"," ++ printf -- "%s" " RUN+=\"/sbin/initqueue --finished --unique --name 00resume echo %%M:%%m > /sys/power/resume\"\n" ++ } >> /etc/udev/rules.d/99-resume.rules + +- printf 'warn "Cancelling resume operation. Device not found."; cancel_wait_for_dev /dev/resume; rm -f -- "$job" "%s/initqueue/settled/resume.sh";' \ +- "$hookdir" >> $hookdir/initqueue/timeout/resume.sh ++ printf '[ -e "%s" ] && { ln -s "%s" /dev/resume; rm -f -- "$job" "%s/initqueue/timeout/resume.sh"; }\n' \ ++ "$resume" "$resume" "$hookdir" >> $hookdir/initqueue/settled/resume.sh + +- wait_for_dev "/dev/resume" +- mv /lib/dracut/resume.sh /lib/dracut/hooks/pre-mount/10-resume.sh +-elif ! getarg noresume; then +- { +- if [ -x /usr/sbin/resume ]; then +- printf "SUBSYSTEM==\"block\", ACTION==\"add|change\", ENV{ID_FS_TYPE}==\"suspend|swsuspend|swsupend\", RUN+=\"/sbin/initqueue --finished --unique --name 00resume /usr/sbin/resume %s \$tempnode\"\n" "$a_splash" +- fi +- echo "SUBSYSTEM==\"block\", ACTION==\"add|change\", ENV{ID_FS_TYPE}==\"suspend|swsuspend|swsupend\"," \ +- " RUN+=\"/sbin/initqueue --finished --unique --name 00resume echo %M:%m > /sys/power/resume\""; +- } >> /etc/udev/rules.d/99-resume.rules ++ printf -- "%s" 'warn "Cancelling resume operation. Device not found.";' ++ printf -- ' cancel_wait_for_dev /dev/resume; rm -f -- "$job" "%s/initqueue/settled/resume.sh";' \ ++ "$hookdir" >> $hookdir/initqueue/timeout/resume.sh ++ ++ mv /lib/dracut/resume.sh /lib/dracut/hooks/pre-mount/10-resume.sh ++ else ++ { ++ if [ -x /usr/sbin/resume ]; then ++ printf "SUBSYSTEM==\"block\", ACTION==\"add|change\", ENV{ID_FS_TYPE}==\"suspend|swsuspend|swsupend\"," ++ printf -- " RUN+=\"/sbin/initqueue --finished --unique --name 00resume /usr/sbin/resume %s \$tempnode\"\n" "$a_splash" ++ fi ++ printf -- "%s" "SUBSYSTEM==\"block\", ACTION==\"add|change\", ENV{ID_FS_TYPE}==\"suspend|swsuspend|swsupend\"," ++ printf -- "%s" " RUN+=\"/sbin/initqueue --finished --unique --name 00resume echo %M:%m > /sys/power/resume\""; ++ } >> /etc/udev/rules.d/99-resume.rules ++ fi + fi diff --git a/modules.d/95resume/resume-genrules.sh b/modules.d/95resume/resume-genrules.sh deleted file mode 100755 index c542c71..0000000 @@ -5059,26 +7555,27 @@ index 12bd354..7d6d0f1 100755 inst_hook cmdline 95 "$moddir/parse-virtfs.sh" inst_hook mount 99 "$moddir/mount-virtfs.sh" diff --git a/modules.d/95zfcp/module-setup.sh b/modules.d/95zfcp/module-setup.sh -index 9906695..5d9b506 100755 +index 9906695..dfbeed5 100755 --- a/modules.d/95zfcp/module-setup.sh +++ b/modules.d/95zfcp/module-setup.sh -@@ -2,6 +2,7 @@ +@@ -2,24 +2,26 @@ # -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*- # ex: ts=8 sw=4 sts=4 et filetype=sh +# called by dracut check() { arch=$(uname -m) ++ [ -x /sbin/zfcp_cio_free ] || return 1 [ "$arch" = "s390" -o "$arch" = "s390x" ] || return 1 -@@ -9,6 +10,7 @@ check() { + return 0 } +# called by dracut depends() { - arch=$(uname -m) - [ "$arch" = "s390" -o "$arch" = "s390x" ] || return 1 -@@ -16,10 +18,12 @@ depends() { +- arch=$(uname -m) +- [ "$arch" = "s390" -o "$arch" = "s390x" ] || return 1 +- return 0 } @@ -5091,19 +7588,122 @@ index 9906695..5d9b506 100755 install() { inst_hook cmdline 30 "$moddir/parse-zfcp.sh" inst_multiple zfcp_cio_free grep sed seq +diff --git a/modules.d/95zfcp_rules/module-setup.sh b/modules.d/95zfcp_rules/module-setup.sh +new file mode 100755 +index 0000000..9a1ab20 +--- /dev/null ++++ b/modules.d/95zfcp_rules/module-setup.sh +@@ -0,0 +1,25 @@ ++#!/bin/bash ++# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*- ++# ex: ts=8 sw=4 sts=4 et filetype=sh ++ ++# called by dracut ++check() { ++ local _arch=$(uname -m) ++ [ -x /sbin/zfcp_disk_configure ] || return 1 ++ [ "$_arch" = "s390" -o "$_arch" = "s390x" ] || return 1 ++ return 0 ++} ++ ++# called by dracut ++depends() { ++ return 0 ++} ++ ++# called by dracut ++install() { ++ inst_multiple /usr/lib/udev/collect ++ inst_hook cmdline 30 "$moddir/parse-zfcp.sh" ++ if [[ $hostonly ]] ; then ++ inst_rules_wildcard 51-zfcp-*.rules ++ fi ++} +diff --git a/modules.d/95zfcp_rules/parse-zfcp.sh b/modules.d/95zfcp_rules/parse-zfcp.sh +new file mode 100755 +index 0000000..24dbdd3 +--- /dev/null ++++ b/modules.d/95zfcp_rules/parse-zfcp.sh +@@ -0,0 +1,65 @@ ++#!/bin/sh ++# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*- ++# ex: ts=8 sw=4 sts=4 et filetype=sh ++ ++create_udev_rule() { ++ local ccw=$1 ++ local wwpn=$2 ++ local lun=$3 ++ local _rule=/etc/udev/rules.d/51-zfcp-${ccw}.rules ++ ++ local _cu_type _dev_type ++ local _rule=/etc/udev/rules.d/51-zfcp-${ccw}.rules ++ ++ if [ -e /sys/bus/ccw/devices/${ccw} ] ; then ++ read _cu_type < /sys/bus/ccw/devices/${ccw}/cutype ++ read _dev_type < /sys/bus/ccw/devices/${ccw}/devtype ++ fi ++ if [ "$_cu_type" != "1731/03" ] ; then ++ return 0; ++ fi ++ if [ "$_dev_type" != "1732/03" ] && [ "$_dev_type" != "1732/04" ] ; then ++ return 0; ++ fi ++ ++ [ -e ${_rule} ] && return 0 ++ ++ if [ ! -f "$_rule" ] ; then ++ cat > $_rule <> $_rule </dev/null fi +@@ -66,8 +61,6 @@ case "$root" in + rootok=1 ;; + esac + +-[ "${root%%:*}" = "block" ] && wait_for_dev "${root#block:}" +- + [ -z "$root" ] && die "No or empty root= argument" + [ -z "$rootok" ] && die "Don't know how to handle 'root=$root'" + diff --git a/modules.d/98systemd/dracut-initqueue.sh b/modules.d/98systemd/dracut-initqueue.sh -index d7ebf2b..64e8154 100755 +index d7ebf2b..1e05dcd 100755 --- a/modules.d/98systemd/dracut-initqueue.sh +++ b/modules.d/98systemd/dracut-initqueue.sh @@ -52,6 +52,10 @@ while :; do @@ -5340,14 +7952,14 @@ index d7ebf2b..64e8154 100755 sleep 0.5 + for i in /run/systemd/ask-password/ask.*; do -+ [ -e "$i" ] && continue ++ [ -e "$i" ] && continue 2 + done + if [ $main_loop -gt $((2*$RDRETRY/3)) ]; then for job in $hookdir/initqueue/timeout/*.sh; do [ -e "$job" ] || break diff --git a/modules.d/98systemd/module-setup.sh b/modules.d/98systemd/module-setup.sh -index a5ac2a5..748e25b 100755 +index a5ac2a5..74ce5f9 100755 --- a/modules.d/98systemd/module-setup.sh +++ b/modules.d/98systemd/module-setup.sh @@ -2,6 +2,7 @@ @@ -5371,21 +7983,65 @@ index a5ac2a5..748e25b 100755 install() { local _mods +@@ -178,6 +181,8 @@ install() { + inst_script "$moddir/dracut-mount.sh" /bin/dracut-mount + inst_script "$moddir/dracut-pre-pivot.sh" /bin/dracut-pre-pivot + ++ inst_script "$moddir/rootfs-generator.sh" /lib/systemd/system-generators/dracut-rootfs-generator ++ + inst_rules 99-systemd.rules + + for i in \ +diff --git a/modules.d/98systemd/rootfs-generator.sh b/modules.d/98systemd/rootfs-generator.sh +new file mode 100755 +index 0000000..3770c6b +--- /dev/null ++++ b/modules.d/98systemd/rootfs-generator.sh +@@ -0,0 +1,30 @@ ++#!/bin/sh ++# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*- ++# ex: ts=8 sw=4 sts=4 et filetype=sh ++ ++type getarg >/dev/null 2>&1 || . /lib/dracut-lib.sh ++root=$(getarg root=) ++case "$root" in ++ block:LABEL=*|LABEL=*) ++ root="${root#block:}" ++ root="$(echo $root | sed 's,/,\\x2f,g')" ++ root="block:/dev/disk/by-label/${root#LABEL=}" ++ rootok=1 ;; ++ block:UUID=*|UUID=*) ++ root="${root#block:}" ++ root="block:/dev/disk/by-uuid/${root#UUID=}" ++ rootok=1 ;; ++ block:PARTUUID=*|PARTUUID=*) ++ root="${root#block:}" ++ root="block:/dev/disk/by-partuuid/${root#PARTUUID=}" ++ rootok=1 ;; ++ block:PARTLABEL=*|PARTLABEL=*) ++ root="${root#block:}" ++ root="block:/dev/disk/by-partlabel/${root#PARTLABEL=}" ++ rootok=1 ;; ++ /dev/*) ++ root="block:${root}" ++ rootok=1 ;; ++esac ++ ++[ "${root%%:*}" = "block" ] && wait_for_dev -n "${root#block:}" diff --git a/modules.d/98usrmount/module-setup.sh b/modules.d/98usrmount/module-setup.sh -index a668069..d8a0ec2 100755 +index a668069..31a6229 100755 --- a/modules.d/98usrmount/module-setup.sh +++ b/modules.d/98usrmount/module-setup.sh -@@ -2,18 +2,21 @@ +@@ -2,18 +2,18 @@ # -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*- # ex: ts=8 sw=4 sts=4 et filetype=sh +# called by dracut check() { - local _init +- local _init [[ $mount_needs ]] && return 1 - _init=$(readlink -f /sbin/init) +- _init=$(readlink -f /sbin/init) - [[ "$init" == "${init##/usr}" ]] && return 255 -+ [[ "$_init" == "${_init##/usr}" ]] && return 255 return 0 } @@ -5399,7 +8055,7 @@ index a668069..d8a0ec2 100755 if ! dracut_module_included "systemd"; then inst_hook pre-pivot 50 "$moddir/mount-usr.sh" diff --git a/modules.d/99base/dracut-lib.sh b/modules.d/99base/dracut-lib.sh -index 74d7d35..0670cf2 100755 +index 74d7d35..85f7cdf 100755 --- a/modules.d/99base/dracut-lib.sh +++ b/modules.d/99base/dracut-lib.sh @@ -4,6 +4,13 @@ @@ -5416,6 +8072,68 @@ index 74d7d35..0670cf2 100755 debug_off() { set +x +@@ -846,7 +853,18 @@ dev_unit_name() + wait_for_dev() + { + local _name ++ local _needreload ++ local _noreload ++ ++ if [ "$1" = "-n" ]; then ++ _noreload=1 ++ shift ++ fi ++ + _name="$(str_replace "$1" '/' '\x2f')" ++ ++ [ -e "${PREFIX}$hookdir/initqueue/finished/devexists-${_name}.sh" ] && return 0 ++ + printf '[ -e "%s" ]\n' $1 \ + >> "${PREFIX}$hookdir/initqueue/finished/devexists-${_name}.sh" + { +@@ -856,17 +874,24 @@ wait_for_dev() + + if [ -n "$DRACUT_SYSTEMD" ]; then + _name=$(dev_unit_name "$1") +- if ! [ -L ${PREFIX}/etc/systemd/system/initrd.target.requires/${_name}.device ]; then +- [ -d ${PREFIX}/etc/systemd/system/initrd.target.requires ] || mkdir -p ${PREFIX}/etc/systemd/system/initrd.target.requires +- ln -s ../${_name}.device ${PREFIX}/etc/systemd/system/initrd.target.requires/${_name}.device ++ if ! [ -L ${PREFIX}/etc/systemd/system/initrd.target.wants/${_name}.device ]; then ++ [ -d ${PREFIX}/etc/systemd/system/initrd.target.wants ] || mkdir -p ${PREFIX}/etc/systemd/system/initrd.target.wants ++ ln -s ../${_name}.device ${PREFIX}/etc/systemd/system/initrd.target.wants/${_name}.device ++ _needreload=1 + fi + +- mkdir -p ${PREFIX}/etc/systemd/system/${_name}.device.d +- { +- echo "[Unit]" +- echo "JobTimeoutSec=3600" +- } > ${PREFIX}/etc/systemd/system/${_name}.device.d/timeout.conf +- [ -z "$PREFIX" ] && /sbin/initqueue --onetime --unique --name daemon-reload systemctl daemon-reload ++ if ! [ -f ${PREFIX}/etc/systemd/system/${_name}.device.d/timeout.conf ]; then ++ mkdir -p ${PREFIX}/etc/systemd/system/${_name}.device.d ++ { ++ echo "[Unit]" ++ echo "JobTimeoutSec=3600" ++ } > ${PREFIX}/etc/systemd/system/${_name}.device.d/timeout.conf ++ _needreload=1 ++ fi ++ ++ if [ -z "$PREFIX" ] && [ "$_needreload" = 1 ] && [ -z "$_noreload" ]; then ++ /sbin/initqueue --onetime --unique --name daemon-reload systemctl daemon-reload ++ fi + fi + } + +@@ -878,7 +903,7 @@ cancel_wait_for_dev() + rm -f -- "$hookdir/emergency/80-${_name}.sh" + if [ -n "$DRACUT_SYSTEMD" ]; then + _name=$(dev_unit_name "$1") +- rm -f -- ${PREFIX}/etc/systemd/system/initrd.target.requires/${_name}.device ++ rm -f -- ${PREFIX}/etc/systemd/system/initrd.target.wants/${_name}.device + rm -f -- ${PREFIX}/etc/systemd/system/${_name}.device.d/timeout.conf + /sbin/initqueue --onetime --unique --name daemon-reload systemctl daemon-reload + fi diff --git a/modules.d/99base/init.sh b/modules.d/99base/init.sh index ae73fd2..2364f4f 100755 --- a/modules.d/99base/init.sh @@ -5452,7 +8170,7 @@ index ae73fd2..2364f4f 100755 if [ $UDEVVERSION -gt 166 ]; then # newer versions of udev use /run/udev/rules.d diff --git a/modules.d/99base/module-setup.sh b/modules.d/99base/module-setup.sh -index d33a0fb..e53cf2e 100755 +index d33a0fb..d4dbca9 100755 --- a/modules.d/99base/module-setup.sh +++ b/modules.d/99base/module-setup.sh @@ -2,15 +2,18 @@ @@ -5474,6 +8192,188 @@ index d33a0fb..e53cf2e 100755 install() { local _d +@@ -42,7 +45,6 @@ install() { + mkdir -p ${initdir}/tmp + + inst_simple "$moddir/dracut-lib.sh" "/lib/dracut-lib.sh" +- inst_simple "$moddir/uefi-lib.sh" "/lib/uefi-lib.sh" + + if ! dracut_module_included "systemd"; then + inst_multiple switch_root || dfatal "Failed to install switch_root" +diff --git a/modules.d/99base/rdsosreport.sh b/modules.d/99base/rdsosreport.sh +index bfa55bb..5e11166 100755 +--- a/modules.d/99base/rdsosreport.sh ++++ b/modules.d/99base/rdsosreport.sh +@@ -42,6 +42,8 @@ command -v dmsetup >/dev/null 2>/dev/null && dmsetup ls --tree + + cat /proc/mdstat + ++command -v ip >/dev/null 2>/dev/null && ip addr ++ + if command -v journalctl >/dev/null 2>/dev/null; then + journalctl -ab --no-pager -o short-monotonic + else +diff --git a/modules.d/99base/uefi-lib.sh b/modules.d/99base/uefi-lib.sh +deleted file mode 100755 +index faedbac..0000000 +--- a/modules.d/99base/uefi-lib.sh ++++ /dev/null +@@ -1,155 +0,0 @@ +-#!/bin/bash +-# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*- +-# ex: ts=8 sw=4 sts=4 et filetype=sh +-# +-# Copyright 2013 Red Hat, Inc. All rights reserved. +-# Copyright 2013 Harald Hoyer +-# +-# This program is free software; you can redistribute it and/or modify +-# it under the terms of the GNU General Public License as published by +-# the Free Software Foundation; either version 2 of the License, or +-# (at your option) any later version. +-# +-# This program is distributed in the hope that it will be useful, +-# but WITHOUT ANY WARRANTY; without even the implied warranty of +-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +-# GNU General Public License for more details. +-# +-# You should have received a copy of the GNU General Public License +-# along with this program. If not, see . +-# +- +-getbyte () { +- local IFS= LC_CTYPE=C res c +- read -r -n 1 -d '' c +- res=$? +- # the single quote in the argument of the printf +- # yields the numeric value of $c (ASCII since LC_CTYPE=C) +- [[ -n $c ]] && c=$(printf '%u' "'$c") || c=0 +- printf "$c" +- return $res +-} +- +-getword () { +- local b1 b2 val +- b1=$(getbyte) || return 1 +- b2=$(getbyte) || return 1 +- (( val = b2 * 256 + b1 )) +- echo $val +- return 0 +-} +- +-# Acpi(PNP0A08,0x0)/Pci(0x3,0x0)/Pci(0x0,0x0)/MAC(90E2BA265ED4,0x0)/Vlan(172)/Fibre(0x4EA06104A0CC0050,0x0) +-uefi_device_path() +-{ +- local IFS= LC_CTYPE=C res tt len type hextype first +- first=1 +- +- while :; do +- type=$(getbyte) || return 1 +- subtype=$(getbyte) || return 1 +- len=$(getword) || return 1 +- hextype=$(printf "%02x%02x" "$type" "$subtype") +- if [[ $first == 1 ]]; then +- first=0 +- elif [[ $hextype != "7fff" ]]; then +- printf "/" +- fi +- case $hextype in +- 0101) +- # PCI +- tt=$(getword) +- printf "PCI(0x%x,0x%x)" $(($tt / 256)) $(($tt & 255)) +- ;; +- 0201) +- # ACPI +- printf "Acpi(0x%x,0x%x)" $(($(getword) + $(getword) * 65536)) $(($(getword) + $(getword) * 65536)) +- ;; +- 0303) +- # FIBRE +- getword &>/dev/null +- getword &>/dev/null +- printf "Fibre(0x%x%x%x%x%x%x%x%x,0x%x)" \ +- $(getbyte) $(getbyte) $(getbyte) $(getbyte) \ +- $(getbyte) $(getbyte) $(getbyte) $(getbyte) \ +- $(( $(getword) + $(getword) * 65536 + 4294967296 * ( $(getword) + $(getword) * 65536 ) )) +- ;; +- 030b) +- # MAC +- printf "MAC(%02x%02x%02x%02x%02x%02x," $(getbyte) $(getbyte) $(getbyte) $(getbyte) $(getbyte) $(getbyte) +- read -r -N 26 tt || return 1 +- printf "0x%x)" $(getbyte) +- ;; +- 0314) +- # VLAN +- printf "VLAN(%d)" $(getword) +- ;; +- 7fff) +- # END +- printf "\n" +- return 0 +- ;; +- *) +- printf "Unknown(Type:%d SubType:%d len=%d)" "$type" "$subtype" "$len" +- read -r -N $(($len-4)) tt || return 1 +- ;; +- esac +- done +-} +- +-get_fcoe_boot_mac() +-{ +- data=${1:-/sys/firmware/efi/vars/FcoeBootDevice-a0ebca23-5f9c-447a-a268-22b6c158c2ac/data} +- [ -f $data ] || return 1 +- local IFS= LC_CTYPE=C tt len type hextype +- first=1 +- +- while :; do +- type=$(getbyte) || return 1 +- subtype=$(getbyte) || return 1 +- len=$(getword) || return 1 +- hextype=$(printf "%02x%02x" "$type" "$subtype") +- case $hextype in +- 030b) +- # MAC +- printf "%02x:%02x:%02x:%02x:%02x:%02x" $(getbyte) $(getbyte) $(getbyte) $(getbyte) $(getbyte) $(getbyte) +- read -r -N 27 tt || return 1 +- ;; +- 7fff) +- # END +- return 0 +- ;; +- *) +- read -r -N $(($len-4)) tt || return 1 +- ;; +- esac +- done < $data +-} +- +-get_fcoe_boot_vlan() +-{ +- data=${1:-/sys/firmware/efi/vars/FcoeBootDevice-a0ebca23-5f9c-447a-a268-22b6c158c2ac/data} +- [ -f $data ] || return 1 +- local IFS= LC_CTYPE=C tt len type hextype +- first=1 +- +- while :; do +- type=$(getbyte) || return 1 +- subtype=$(getbyte) || return 1 +- len=$(getword) || return 1 +- hextype=$(printf "%02x%02x" "$type" "$subtype") +- case $hextype in +- 0314) +- # VLAN +- printf "%d" $(getword) +- ;; +- 7fff) +- # END +- return 0 +- ;; +- *) +- read -r -N $(($len-4)) tt || return 1 +- ;; +- esac +- done < $data +-} diff --git a/modules.d/99fs-lib/module-setup.sh b/modules.d/99fs-lib/module-setup.sh index c9c88b7..7979bab 100755 --- a/modules.d/99fs-lib/module-setup.sh @@ -5555,3 +8455,403 @@ index 5361936..c09d886 100755 install() { local _d inst_multiple umount poweroff reboot halt losetup +diff --git a/modules.d/99uefi-lib/module-setup.sh b/modules.d/99uefi-lib/module-setup.sh +new file mode 100755 +index 0000000..4a856ea +--- /dev/null ++++ b/modules.d/99uefi-lib/module-setup.sh +@@ -0,0 +1,19 @@ ++#!/bin/bash ++# module-setup for img-lib ++ ++# called by dracut ++check() { ++ return 255 ++} ++ ++# called by dracut ++depends() { ++ echo bash ++ return 0 ++} ++ ++# called by dracut ++install() { ++ inst_simple "$moddir/uefi-lib.sh" "/lib/uefi-lib.sh" ++} ++ +diff --git a/modules.d/99uefi-lib/uefi-lib.sh b/modules.d/99uefi-lib/uefi-lib.sh +new file mode 100755 +index 0000000..faedbac +--- /dev/null ++++ b/modules.d/99uefi-lib/uefi-lib.sh +@@ -0,0 +1,155 @@ ++#!/bin/bash ++# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*- ++# ex: ts=8 sw=4 sts=4 et filetype=sh ++# ++# Copyright 2013 Red Hat, Inc. All rights reserved. ++# Copyright 2013 Harald Hoyer ++# ++# This program is free software; you can redistribute it and/or modify ++# it under the terms of the GNU General Public License as published by ++# the Free Software Foundation; either version 2 of the License, or ++# (at your option) any later version. ++# ++# This program is distributed in the hope that it will be useful, ++# but WITHOUT ANY WARRANTY; without even the implied warranty of ++# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++# GNU General Public License for more details. ++# ++# You should have received a copy of the GNU General Public License ++# along with this program. If not, see . ++# ++ ++getbyte () { ++ local IFS= LC_CTYPE=C res c ++ read -r -n 1 -d '' c ++ res=$? ++ # the single quote in the argument of the printf ++ # yields the numeric value of $c (ASCII since LC_CTYPE=C) ++ [[ -n $c ]] && c=$(printf '%u' "'$c") || c=0 ++ printf "$c" ++ return $res ++} ++ ++getword () { ++ local b1 b2 val ++ b1=$(getbyte) || return 1 ++ b2=$(getbyte) || return 1 ++ (( val = b2 * 256 + b1 )) ++ echo $val ++ return 0 ++} ++ ++# Acpi(PNP0A08,0x0)/Pci(0x3,0x0)/Pci(0x0,0x0)/MAC(90E2BA265ED4,0x0)/Vlan(172)/Fibre(0x4EA06104A0CC0050,0x0) ++uefi_device_path() ++{ ++ local IFS= LC_CTYPE=C res tt len type hextype first ++ first=1 ++ ++ while :; do ++ type=$(getbyte) || return 1 ++ subtype=$(getbyte) || return 1 ++ len=$(getword) || return 1 ++ hextype=$(printf "%02x%02x" "$type" "$subtype") ++ if [[ $first == 1 ]]; then ++ first=0 ++ elif [[ $hextype != "7fff" ]]; then ++ printf "/" ++ fi ++ case $hextype in ++ 0101) ++ # PCI ++ tt=$(getword) ++ printf "PCI(0x%x,0x%x)" $(($tt / 256)) $(($tt & 255)) ++ ;; ++ 0201) ++ # ACPI ++ printf "Acpi(0x%x,0x%x)" $(($(getword) + $(getword) * 65536)) $(($(getword) + $(getword) * 65536)) ++ ;; ++ 0303) ++ # FIBRE ++ getword &>/dev/null ++ getword &>/dev/null ++ printf "Fibre(0x%x%x%x%x%x%x%x%x,0x%x)" \ ++ $(getbyte) $(getbyte) $(getbyte) $(getbyte) \ ++ $(getbyte) $(getbyte) $(getbyte) $(getbyte) \ ++ $(( $(getword) + $(getword) * 65536 + 4294967296 * ( $(getword) + $(getword) * 65536 ) )) ++ ;; ++ 030b) ++ # MAC ++ printf "MAC(%02x%02x%02x%02x%02x%02x," $(getbyte) $(getbyte) $(getbyte) $(getbyte) $(getbyte) $(getbyte) ++ read -r -N 26 tt || return 1 ++ printf "0x%x)" $(getbyte) ++ ;; ++ 0314) ++ # VLAN ++ printf "VLAN(%d)" $(getword) ++ ;; ++ 7fff) ++ # END ++ printf "\n" ++ return 0 ++ ;; ++ *) ++ printf "Unknown(Type:%d SubType:%d len=%d)" "$type" "$subtype" "$len" ++ read -r -N $(($len-4)) tt || return 1 ++ ;; ++ esac ++ done ++} ++ ++get_fcoe_boot_mac() ++{ ++ data=${1:-/sys/firmware/efi/vars/FcoeBootDevice-a0ebca23-5f9c-447a-a268-22b6c158c2ac/data} ++ [ -f $data ] || return 1 ++ local IFS= LC_CTYPE=C tt len type hextype ++ first=1 ++ ++ while :; do ++ type=$(getbyte) || return 1 ++ subtype=$(getbyte) || return 1 ++ len=$(getword) || return 1 ++ hextype=$(printf "%02x%02x" "$type" "$subtype") ++ case $hextype in ++ 030b) ++ # MAC ++ printf "%02x:%02x:%02x:%02x:%02x:%02x" $(getbyte) $(getbyte) $(getbyte) $(getbyte) $(getbyte) $(getbyte) ++ read -r -N 27 tt || return 1 ++ ;; ++ 7fff) ++ # END ++ return 0 ++ ;; ++ *) ++ read -r -N $(($len-4)) tt || return 1 ++ ;; ++ esac ++ done < $data ++} ++ ++get_fcoe_boot_vlan() ++{ ++ data=${1:-/sys/firmware/efi/vars/FcoeBootDevice-a0ebca23-5f9c-447a-a268-22b6c158c2ac/data} ++ [ -f $data ] || return 1 ++ local IFS= LC_CTYPE=C tt len type hextype ++ first=1 ++ ++ while :; do ++ type=$(getbyte) || return 1 ++ subtype=$(getbyte) || return 1 ++ len=$(getword) || return 1 ++ hextype=$(printf "%02x%02x" "$type" "$subtype") ++ case $hextype in ++ 0314) ++ # VLAN ++ printf "%d" $(getword) ++ ;; ++ 7fff) ++ # END ++ return 0 ++ ;; ++ *) ++ read -r -N $(($len-4)) tt || return 1 ++ ;; ++ esac ++ done < $data ++} +diff --git a/test/TEST-17-LVM-THIN/99-idesymlinks.rules b/test/TEST-17-LVM-THIN/99-idesymlinks.rules +new file mode 100644 +index 0000000..d557790 +--- /dev/null ++++ b/test/TEST-17-LVM-THIN/99-idesymlinks.rules +@@ -0,0 +1,8 @@ ++ACTION=="add|change", SUBSYSTEM=="block", ENV{DEVTYPE}=="disk", KERNEL=="hda", SYMLINK+="sda" ++ACTION=="add|change", SUBSYSTEM=="block", ENV{DEVTYPE}=="partition", KERNEL=="hda*", SYMLINK+="sda$env{MINOR}" ++ACTION=="add|change", SUBSYSTEM=="block", ENV{DEVTYPE}=="disk", KERNEL=="hdb", SYMLINK+="sdb" ++ACTION=="add|change", SUBSYSTEM=="block", ENV{DEVTYPE}=="partition", KERNEL=="hdb*", SYMLINK+="sdb$env{MINOR}" ++ACTION=="add|change", SUBSYSTEM=="block", ENV{DEVTYPE}=="disk", KERNEL=="hdc", SYMLINK+="sdc" ++ACTION=="add|change", SUBSYSTEM=="block", ENV{DEVTYPE}=="partition", KERNEL=="hdc*", SYMLINK+="sdc$env{MINOR}" ++ACTION=="add|change", SUBSYSTEM=="block", ENV{DEVTYPE}=="disk", KERNEL=="hdd", SYMLINK+="sdd" ++ACTION=="add|change", SUBSYSTEM=="block", ENV{DEVTYPE}=="partition", KERNEL=="hdd*", SYMLINK+="sdd$env{MINOR}" +diff --git a/test/TEST-17-LVM-THIN/Makefile b/test/TEST-17-LVM-THIN/Makefile +new file mode 100644 +index 0000000..aad2705 +--- /dev/null ++++ b/test/TEST-17-LVM-THIN/Makefile +@@ -0,0 +1,10 @@ ++all: ++ @$(MAKE) -s --no-print-directory -C ../.. all ++ @V=$(V) basedir=../.. testdir=../ ./test.sh --all ++setup: ++ @$(MAKE) --no-print-directory -C ../.. all ++ @basedir=../.. testdir=../ ./test.sh --setup ++clean: ++ @basedir=../.. testdir=../ ./test.sh --clean ++run: ++ @basedir=../.. testdir=../ ./test.sh --run +diff --git a/test/TEST-17-LVM-THIN/create-root.sh b/test/TEST-17-LVM-THIN/create-root.sh +new file mode 100755 +index 0000000..740704f +--- /dev/null ++++ b/test/TEST-17-LVM-THIN/create-root.sh +@@ -0,0 +1,31 @@ ++#!/bin/sh ++# don't let udev and this script step on eachother's toes ++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 ++udevadm control --reload ++# save a partition at the beginning for future flagging purposes ++sfdisk -C 2560 -H 2 -S 32 -L /dev/sda </dev/sda1 ++poweroff -f +diff --git a/test/TEST-17-LVM-THIN/finished-false.sh b/test/TEST-17-LVM-THIN/finished-false.sh +new file mode 100755 +index 0000000..ecdbef9 +--- /dev/null ++++ b/test/TEST-17-LVM-THIN/finished-false.sh +@@ -0,0 +1,2 @@ ++#!/bin/sh ++exit 1 +diff --git a/test/TEST-17-LVM-THIN/hard-off.sh b/test/TEST-17-LVM-THIN/hard-off.sh +new file mode 100755 +index 0000000..12c3d5a +--- /dev/null ++++ b/test/TEST-17-LVM-THIN/hard-off.sh +@@ -0,0 +1,3 @@ ++#!/bin/sh ++getarg rd.shell || poweroff -f ++getarg failme && poweroff -f +diff --git a/test/TEST-17-LVM-THIN/test-init.sh b/test/TEST-17-LVM-THIN/test-init.sh +new file mode 100755 +index 0000000..fd03aa5 +--- /dev/null ++++ b/test/TEST-17-LVM-THIN/test-init.sh +@@ -0,0 +1,17 @@ ++#!/bin/sh ++export PATH=/sbin:/bin:/usr/sbin:/usr/bin ++strstr() { [ "${1#*$2*}" != "$1" ]; } ++CMDLINE=$(while read line; do echo $line;done < /proc/cmdline) ++plymouth --quit ++exec >/dev/console 2>&1 ++echo "dracut-root-block-success" >/dev/sda1 ++export TERM=linux ++export PS1='initramfs-test:\w\$ ' ++[ -f /etc/mtab ] || ln -sfn /proc/mounts /etc/mtab ++[ -f /etc/fstab ] || ln -sfn /proc/mounts /etc/fstab ++stty sane ++echo "made it to the rootfs!" ++strstr "$CMDLINE" "rd.shell" && sh -i ++echo "Powering down." ++mount -n -o remount,ro / ++poweroff -f +diff --git a/test/TEST-17-LVM-THIN/test.sh b/test/TEST-17-LVM-THIN/test.sh +new file mode 100755 +index 0000000..0cfce19 +--- /dev/null ++++ b/test/TEST-17-LVM-THIN/test.sh +@@ -0,0 +1,88 @@ ++#!/bin/bash ++TEST_DESCRIPTION="root filesystem on LVM PV with thin pool" ++ ++KVERSION=${KVERSION-$(uname -r)} ++ ++# Uncomment this to debug failures ++#DEBUGFAIL="rd.break rd.shell" ++ ++test_run() { ++ $testdir/run-qemu \ ++ -hda $TESTDIR/root.ext2 \ ++ -m 256M -smp 2 -nographic \ ++ -net none -kernel /boot/vmlinuz-$KVERSION \ ++ -append "root=/dev/dracut/root rw rd.auto=1 quiet rd.retry=3 rd.info console=ttyS0,115200n81 selinux=0 rd.debug $DEBUGFAIL" \ ++ -initrd $TESTDIR/initramfs.testing ++ grep -F -m 1 -q dracut-root-block-success $TESTDIR/root.ext2 || return 1 ++} ++ ++test_setup() { ++ # Create the blank file to use as a root filesystem ++ dd if=/dev/null of=$TESTDIR/root.ext2 bs=1M seek=80 ++ ++ kernel=$KVERSION ++ # Create what will eventually be our root filesystem onto an overlay ++ ( ++ export initdir=$TESTDIR/overlay/source ++ . $basedir/dracut-functions.sh ++ inst_multiple sh df free ls shutdown poweroff stty cat ps ln ip route \ ++ mount dmesg ifconfig dhclient mkdir cp ping dhclient ++ for _terminfodir in /lib/terminfo /etc/terminfo /usr/share/terminfo; do ++ [ -f ${_terminfodir}/l/linux ] && break ++ done ++ inst_multiple -o ${_terminfodir}/l/linux ++ inst "$basedir/modules.d/40network/dhclient-script.sh" "/sbin/dhclient-script" ++ inst "$basedir/modules.d/40network/ifup.sh" "/sbin/ifup" ++ inst_multiple grep ++ inst_simple /etc/os-release ++ inst ./test-init.sh /sbin/init ++ find_binary plymouth >/dev/null && inst_multiple plymouth ++ (cd "$initdir"; mkdir -p dev sys proc etc var/run tmp ) ++ cp -a /etc/ld.so.conf* $initdir/etc ++ mkdir $initdir/run ++ sudo ldconfig -r "$initdir" ++ ) ++ ++ # second, install the files needed to make the root filesystem ++ ( ++ export initdir=$TESTDIR/overlay ++ . $basedir/dracut-functions.sh ++ inst_multiple sfdisk mke2fs poweroff cp umount ++ inst_hook initqueue 01 ./create-root.sh ++ inst_hook initqueue/finished 01 ./finished-false.sh ++ inst_simple ./99-idesymlinks.rules /etc/udev/rules.d/99-idesymlinks.rules ++ ) ++ ++ # create an initramfs that will create the target root filesystem. ++ # We do it this way so that we do not risk trashing the host mdraid ++ # devices, volume groups, encrypted partitions, etc. ++ $basedir/dracut.sh -l -i $TESTDIR/overlay / \ ++ -m "dash lvm mdraid udev-rules base rootfs-block kernel-modules" \ ++ -d "piix ide-gd_mod ata_piix ext2 sd_mod" \ ++ -f $TESTDIR/initramfs.makeroot $KVERSION || return 1 ++ rm -rf -- $TESTDIR/overlay ++ # Invoke KVM and/or QEMU to actually create the target filesystem. ++ $testdir/run-qemu -hda $TESTDIR/root.ext2 -m 256M -smp 2 -nographic -net none \ ++ -kernel "/boot/vmlinuz-$kernel" \ ++ -append "root=/dev/fakeroot rw rootfstype=ext2 quiet console=ttyS0,115200n81 selinux=0" \ ++ -initrd $TESTDIR/initramfs.makeroot || return 1 ++ grep -F -m 1 -q dracut-root-block-created $TESTDIR/root.ext2 || return 1 ++ ( ++ export initdir=$TESTDIR/overlay ++ . $basedir/dracut-functions.sh ++ inst_multiple poweroff shutdown ++ inst_hook emergency 000 ./hard-off.sh ++ inst_simple ./99-idesymlinks.rules /etc/udev/rules.d/99-idesymlinks.rules ++ ) ++ sudo $basedir/dracut.sh -l -i $TESTDIR/overlay / \ ++ -o "plymouth network" \ ++ -a "debug" -I lvs \ ++ -d "piix ide-gd_mod ata_piix ext2 sd_mod" \ ++ -f $TESTDIR/initramfs.testing $KVERSION || return 1 ++} ++ ++test_cleanup() { ++ return 0 ++} ++ ++. $testdir/test-functions +diff --git a/test/TEST-30-ISCSI/test.sh b/test/TEST-30-ISCSI/test.sh +index 4c29956..f597783 100755 +--- a/test/TEST-30-ISCSI/test.sh ++++ b/test/TEST-30-ISCSI/test.sh +@@ -69,7 +69,7 @@ do_test_run() { + || return 1 + + run_client "netroot=iscsi" \ +- "root=LABEL=sysroot ip=192.168.50.101::192.168.50.1:255.255.255.0:iscsi-1:ens3:off" \ ++ "iscsi_firmware 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" \ + || return 1 + return 0