diff --git a/SOURCES/0085.patch b/SOURCES/0085.patch index 17023c6..48c3511 100644 --- a/SOURCES/0085.patch +++ b/SOURCES/0085.patch @@ -69,3 +69,4 @@ index 0580062f..5ac34ef3 100755 if [[ -d "${BOOT_DIR_ABS%/*}" ]]; then BOOT_DIR="/${MACHINE_ID}/0-rescue" BOOT_ROOT=${BOOT_DIR_ABS%$BOOT_DIR} + diff --git a/SOURCES/0086.patch b/SOURCES/0086.patch new file mode 100644 index 0000000..884e7a5 --- /dev/null +++ b/SOURCES/0086.patch @@ -0,0 +1,79 @@ +From fc05c818dd862de2b6771dabe242bc9d26aa2160 Mon Sep 17 00:00:00 2001 +From: Jan Synacek +Date: Thu, 11 Jun 2020 11:29:41 +0200 +Subject: [PATCH] Adapt to the new udevadm version output + +See https://bugzilla.redhat.com/show_bug.cgi?id=1804252. + +RHEL-only + +Resolves: #1846034 +--- + dracut-init.sh | 2 +- + modules.d/01fips/fips.sh | 2 +- + modules.d/99base/dracut-lib.sh | 4 ++-- + modules.d/99base/init.sh | 2 +- + 4 files changed, 5 insertions(+), 5 deletions(-) + +diff --git a/dracut-init.sh b/dracut-init.sh +index ab07cabf..032c38c2 100644 +--- a/dracut-init.sh ++++ b/dracut-init.sh +@@ -444,7 +444,7 @@ inst_rules_wildcard() { + } + + prepare_udev_rules() { +- [ -z "$UDEVVERSION" ] && export UDEVVERSION=$(udevadm --version) ++ [ -z "$UDEVVERSION" ] && export UDEVVERSION=$(udevadm --version | { read v _ ; echo $v ; }) + + for f in "$@"; do + f="${initdir}/etc/udev/rules.d/$f" +diff --git a/modules.d/01fips/fips.sh b/modules.d/01fips/fips.sh +index 559952ca..03da6861 100755 +--- a/modules.d/01fips/fips.sh ++++ b/modules.d/01fips/fips.sh +@@ -27,7 +27,7 @@ mount_boot() + + if ! [ -e "$boot" ]; then + udevadm trigger --action=add >/dev/null 2>&1 +- [ -z "$UDEVVERSION" ] && UDEVVERSION=$(udevadm --version) ++ [ -z "$UDEVVERSION" ] && UDEVVERSION=$(udevadm --version | { read v _ ; echo $v ; }) + i=0 + while ! [ -e $boot ]; do + if [ $UDEVVERSION -ge 143 ]; then +diff --git a/modules.d/99base/dracut-lib.sh b/modules.d/99base/dracut-lib.sh +index 56dd63ef..96dd55ad 100755 +--- a/modules.d/99base/dracut-lib.sh ++++ b/modules.d/99base/dracut-lib.sh +@@ -531,7 +531,7 @@ incol2() { + } + + udevsettle() { +- [ -z "$UDEVVERSION" ] && export UDEVVERSION=$(udevadm --version) ++ [ -z "$UDEVVERSION" ] && export UDEVVERSION=$(udevadm --version | { read v _ ; echo $v ; }) + + if [ $UDEVVERSION -ge 143 ]; then + udevadm settle --exit-if-exists=$hookdir/initqueue/work $settle_exit_if_exists +@@ -541,7 +541,7 @@ udevsettle() { + } + + udevproperty() { +- [ -z "$UDEVVERSION" ] && export UDEVVERSION=$(udevadm --version) ++ [ -z "$UDEVVERSION" ] && export UDEVVERSION=$(udevadm --version | { read v _ ; echo $v ; }) + + if [ $UDEVVERSION -ge 143 ]; then + for i in "$@"; do udevadm control --property=$i; done +diff --git a/modules.d/99base/init.sh b/modules.d/99base/init.sh +index a5633936..732a7f46 100755 +--- a/modules.d/99base/init.sh ++++ b/modules.d/99base/init.sh +@@ -92,7 +92,7 @@ fi + + trap "emergency_shell Signal caught!" 0 + +-export UDEVVERSION=$(udevadm --version) ++export UDEVVERSION=$(udevadm --version | { read v _ ; echo $v ; }) + if [ $UDEVVERSION -gt 166 ]; then + # newer versions of udev use /run/udev/rules.d + export UDEVRULESD=/run/udev/rules.d + diff --git a/SOURCES/0087.patch b/SOURCES/0087.patch new file mode 100644 index 0000000..bc029da --- /dev/null +++ b/SOURCES/0087.patch @@ -0,0 +1,82 @@ +From 3067edf07449e1dbc2dae0776da9426274b34cba Mon Sep 17 00:00:00 2001 +From: Beniamino Galvani +Date: Wed, 24 Jun 2020 13:06:05 +0200 +Subject: [PATCH] network-manager: move connection generation to a lib file + +Move the connection generation code to a library file so that it can +be reused from other places. + +(cherry picked from commit 6e1e87cd2567801b10b2b4f716436c48688408bf) + +Resolves: #1847518 +--- + modules.d/35network-manager/module-setup.sh | 1 + + modules.d/35network-manager/nm-config.sh | 15 +++------------ + modules.d/35network-manager/nm-lib.sh | 20 ++++++++++++++++++++ + 3 files changed, 24 insertions(+), 12 deletions(-) + +diff --git a/modules.d/35network-manager/module-setup.sh b/modules.d/35network-manager/module-setup.sh +index ad2a1534..ed2f399e 100755 +--- a/modules.d/35network-manager/module-setup.sh ++++ b/modules.d/35network-manager/module-setup.sh +@@ -37,6 +37,7 @@ install() { + inst_hook initqueue/settled 99 "$moddir/nm-run.sh" + inst_rules 85-nm-unmanaged.rules + inst_libdir_file "NetworkManager/$_nm_version/libnm-device-plugin-team.so" ++ inst_simple "$moddir/nm-lib.sh" "/lib/nm-lib.sh" + + if [[ -x "$initdir/usr/sbin/dhclient" ]]; then + inst /usr/libexec/nm-dhcp-helper +diff --git a/modules.d/35network-manager/nm-config.sh b/modules.d/35network-manager/nm-config.sh +index 39a1c8bd..2b9df020 100755 +--- a/modules.d/35network-manager/nm-config.sh ++++ b/modules.d/35network-manager/nm-config.sh +@@ -1,18 +1,9 @@ + #!/bin/sh + ++type nm_generate_connections >/dev/null 2>&1 || . /lib/nm-lib.sh ++ + if [ -n "$netroot" ] || [ -e /tmp/net.ifaces ]; then + echo rd.neednet >> /etc/cmdline.d/35-neednet.conf + fi + +-/usr/libexec/nm-initrd-generator -- $(getcmdline) +- +-if getargbool 0 rd.neednet; then +- for i in /usr/lib/NetworkManager/system-connections/* \ +- /run/NetworkManager/system-connections/* \ +- /etc/NetworkManager/system-connections/* \ +- /etc/sysconfig/network-scripts/ifcfg-*; do +- [ -f "$i" ] || continue +- echo '[ -f /tmp/nm.done ]' >$hookdir/initqueue/finished/nm.sh +- break +- done +-fi ++nm_generate_connections +diff --git a/modules.d/35network-manager/nm-lib.sh b/modules.d/35network-manager/nm-lib.sh +new file mode 100644 +index 00000000..fe053cfa +--- /dev/null ++++ b/modules.d/35network-manager/nm-lib.sh +@@ -0,0 +1,20 @@ ++#!/bin/bash ++ ++type getcmdline >/dev/null 2>&1 || . /lib/dracut-lib.sh ++ ++nm_generate_connections() ++{ ++ rm -f /run/NetworkManager/system-connections/* ++ /usr/libexec/nm-initrd-generator -- $(getcmdline) ++ ++ if getargbool 0 rd.neednet; then ++ for i in /usr/lib/NetworkManager/system-connections/* \ ++ /run/NetworkManager/system-connections/* \ ++ /etc/NetworkManager/system-connections/* \ ++ /etc/sysconfig/network-scripts/ifcfg-*; do ++ [ -f "$i" ] || continue ++ echo '[ -f /tmp/nm.done ]' >$hookdir/initqueue/finished/nm.sh ++ break ++ done ++ fi ++} + diff --git a/SOURCES/0088.patch b/SOURCES/0088.patch new file mode 100644 index 0000000..0bc04d2 --- /dev/null +++ b/SOURCES/0088.patch @@ -0,0 +1,34 @@ +From 7143750cf2e37f9c14ec47a8170b9186136874d7 Mon Sep 17 00:00:00 2001 +From: Beniamino Galvani +Date: Wed, 24 Jun 2020 13:09:04 +0200 +Subject: [PATCH] cms: regenerate NetworkManager connections + +After changing the kernel command line, the cmsifup script calls ifup +to activate the interface. However, ifup is only available in the +network-legacy module; when using the network-manager module, we +should regenerate connections according to the command line; then +later NM will be run and will activate the device. + +(cherry picked from commit 5c3d0a96473ac339fa2d1b25213b8f301c1cfd0d) + +Resolves: #1847518 +--- + modules.d/80cms/cmsifup.sh | 7 ++++++- + 1 file changed, 6 insertions(+), 1 deletion(-) + +diff --git a/modules.d/80cms/cmsifup.sh b/modules.d/80cms/cmsifup.sh +index 902df8d8..77c18452 100755 +--- a/modules.d/80cms/cmsifup.sh ++++ b/modules.d/80cms/cmsifup.sh +@@ -35,4 +35,9 @@ fi + IFACES="$IFACES $DEVICE" + echo "$IFACES" >> /tmp/net.ifaces + +-exec ifup "$DEVICE" ++if [ -x /usr/libexec/nm-initrd-generator ]; then ++ type nm_generate_connections >/dev/null 2>&1 || . /lib/nm-lib.sh ++ nm_generate_connections ++else ++ exec ifup "$DEVICE" ++fi + diff --git a/SOURCES/0089.patch b/SOURCES/0089.patch new file mode 100644 index 0000000..497a94c --- /dev/null +++ b/SOURCES/0089.patch @@ -0,0 +1,25 @@ +From 6c0071bc72dbbdd2a958277618a9b2c64c6ee460 Mon Sep 17 00:00:00 2001 +From: Lukas Nykryn +Date: Thu, 2 Jul 2020 14:33:20 +0200 +Subject: [PATCH] spec: don't use NM on existing installations + +Resolves: #1839706 +--- + dracut.spec | 5 +++++ + 1 file changed, 5 insertions(+) + +diff --git a/dracut.spec b/dracut.spec +index c82c24f6..a8076c18 100644 +--- a/dracut.spec ++++ b/dracut.spec +@@ -481,4 +481,9 @@ install -m 0755 51-dracut-rescue-postinst.sh $RPM_BUILD_ROOT%{_sysconfdir}/kerne + %{_sysconfdir}/kernel/postinst.d/51-dracut-rescue-postinst.sh + %endif + ++%triggerin network -- dracut-network < 049-83.git20200525 ++echo '# Since rhel-8.3 dracut moved to use NetworkManager ++# On existing installations we want to preserve the old scripts ++add_dracutmodules+=" network-legacy "' > /etc/dracut.conf.d/50-network-legacy.conf ++ + %changelog + diff --git a/SOURCES/0090.patch b/SOURCES/0090.patch new file mode 100644 index 0000000..e9ac5b7 --- /dev/null +++ b/SOURCES/0090.patch @@ -0,0 +1,79 @@ +From 73242b75af92bc86c26cfbe2954b7ecb9aaaf765 Mon Sep 17 00:00:00 2001 +From: Harald Hoyer +Date: Tue, 4 Dec 2018 10:02:45 +0100 +Subject: [PATCH] install/dracut-install.c: install module dependencies of + dependencies + +(cherry picked from commit c38f9e980c1ee03151dd1c6602907c6228b78d30) + +Resolves: #1846343 +--- + install/dracut-install.c | 28 +++++++++++++++++++++++++--- + 1 file changed, 25 insertions(+), 3 deletions(-) + +diff --git a/install/dracut-install.c b/install/dracut-install.c +index 88bca1d4..253ae194 100644 +--- a/install/dracut-install.c ++++ b/install/dracut-install.c +@@ -84,6 +84,11 @@ static bool arg_mod_filter_noname = false; + static int dracut_install(const char *src, const char *dst, bool isdir, bool resolvedeps, bool hashdst); + + ++static inline void kmod_module_unrefp(struct kmod_module **p) { ++ if (*p) ++ kmod_module_unref(*p); ++} ++#define _cleanup_kmod_module_unref_ _cleanup_(kmod_module_unrefp) + + static inline void kmod_module_unref_listp(struct kmod_list **p) { + if (*p) +@@ -1234,28 +1239,45 @@ static bool check_module_path(const char *path) + static int install_dependent_modules(struct kmod_list *modlist) + { + struct kmod_list *itr; +- struct kmod_module *mod; + const char *path = NULL; + const char *name = NULL; + int ret = 0; + + kmod_list_foreach(itr, modlist) { ++ _cleanup_kmod_module_unref_ struct kmod_module *mod = NULL; + mod = kmod_module_get_module(itr); + path = kmod_module_get_path(mod); + ++ if (check_hashmap(items_failed, path)) ++ return -1; ++ ++ if (check_hashmap(items, path)) { ++ continue; ++ } ++ + name = kmod_module_get_name(mod); ++ + if ((path == NULL) || (arg_mod_filter_noname && (regexec(&mod_filter_noname, name, 0, NULL, 0) == 0))) { +- kmod_module_unref(mod); + continue; + } ++ + ret = dracut_install(path, &path[kerneldirlen], false, false, true); + if (ret == 0) { ++ _cleanup_kmod_module_unref_list_ struct kmod_list *modlist = NULL; ++ _cleanup_kmod_module_unref_list_ struct kmod_list *modpre = NULL; ++ _cleanup_kmod_module_unref_list_ struct kmod_list *modpost = NULL; + log_debug("dracut_install '%s' '%s' OK", path, &path[kerneldirlen]); + install_firmware(mod); ++ modlist = kmod_module_get_dependencies(mod); ++ ret = install_dependent_modules(modlist); ++ if (ret == 0) { ++ ret = kmod_module_get_softdeps(mod, &modpre, &modpost); ++ if (ret == 0) ++ ret = install_dependent_modules(modpre); ++ } + } else { + log_error("dracut_install '%s' '%s' ERROR", path, &path[kerneldirlen]); + } +- kmod_module_unref(mod); + } + + return ret; + diff --git a/SOURCES/0091.patch b/SOURCES/0091.patch new file mode 100644 index 0000000..bced4a8 --- /dev/null +++ b/SOURCES/0091.patch @@ -0,0 +1,49 @@ +From e4e1ab4e129fa17c5e90a2144e15096b0267c22a Mon Sep 17 00:00:00 2001 +From: Lukas Nykryn +Date: Thu, 2 Jul 2020 09:08:03 +0200 +Subject: [PATCH] install: also install post weak dependencies of kernel + modules + +(cherry picked from commit 6dafdda4a6bdb8721133e4267553c5d86564f9e8) + +Resolves: #1846343 +--- + install/dracut-install.c | 18 +++++++++++++----- + 1 file changed, 13 insertions(+), 5 deletions(-) + +diff --git a/install/dracut-install.c b/install/dracut-install.c +index 253ae194..51f79422 100644 +--- a/install/dracut-install.c ++++ b/install/dracut-install.c +@@ -1272,9 +1272,13 @@ static int install_dependent_modules(struct kmod_list *modlist) + ret = install_dependent_modules(modlist); + if (ret == 0) { + ret = kmod_module_get_softdeps(mod, &modpre, &modpost); +- if (ret == 0) +- ret = install_dependent_modules(modpre); +- } ++ if (ret == 0) { ++ int r; ++ ret = install_dependent_modules(modpre); ++ r = install_dependent_modules(modpost); ++ ret = ret ? : r; ++ } ++ } + } else { + log_error("dracut_install '%s' '%s' ERROR", path, &path[kerneldirlen]); + } +@@ -1335,8 +1339,12 @@ static int install_module(struct kmod_module *mod) + + if (ret == 0) { + ret = kmod_module_get_softdeps(mod, &modpre, &modpost); +- if (ret == 0) +- ret = install_dependent_modules(modpre); ++ if (ret == 0) { ++ int r; ++ ret = install_dependent_modules(modpre); ++ r = install_dependent_modules(modpost); ++ ret = ret ? : r; ++ } + } + + return ret; diff --git a/SPECS/dracut.spec b/SPECS/dracut.spec index a27d9b1..8e19cf9 100644 --- a/SPECS/dracut.spec +++ b/SPECS/dracut.spec @@ -5,7 +5,7 @@ # strip the automatically generated dep here and instead co-own the # directory. %global __requires_exclude pkg-config -%define dist_free_release 86.git20200602 +%define dist_free_release 92.git20200702 Name: dracut Version: 049 @@ -113,6 +113,12 @@ Patch82: 0082.patch Patch83: 0083.patch Patch84: 0084.patch Patch85: 0085.patch +Patch86: 0086.patch +Patch87: 0087.patch +Patch88: 0088.patch +Patch89: 0089.patch +Patch90: 0090.patch +Patch91: 0091.patch Source1: https://www.gnu.org/licenses/lgpl-2.1.txt @@ -567,7 +573,24 @@ install -m 0755 51-dracut-rescue-postinst.sh $RPM_BUILD_ROOT%{_sysconfdir}/kerne %{_sysconfdir}/kernel/postinst.d/51-dracut-rescue-postinst.sh %endif +%triggerin network -- dracut-network < 049-83.git20200525 +echo '# Since rhel-8.3 dracut moved to use NetworkManager +# On existing installations we want to preserve the old scripts +add_dracutmodules+=" network-legacy "' > /etc/dracut.conf.d/50-network-legacy.conf + %changelog +* Thu Jul 02 2020 Lukas Nykryn - 049-92.git20200702 +- install/dracut-install.c: install module dependencies of +- install: also install post weak dependencies of kernel + +* Thu Jul 02 2020 Lukas Nykryn - 049-90.git20200702 +- spec: don't use NM on existing installations + +* Thu Jun 25 2020 Lukas Nykryn - 049-89.git20200625 +- Adapt to the new udevadm version output +- network-manager: move connection generation to a lib file +- cms: regenerate NetworkManager connections + * Tue Jun 02 2020 Lukas Nykryn - 049-86.git20200602 - Do not require non-empty kernel cmdline