dracut-057-51.git20231114

Resolves: RHEL-12409,RHEL-14251,RHEL-15012,RHEL-5732,RHEL-9479
This commit is contained in:
Pavel Valena 2023-11-14 21:48:56 +01:00
parent bb4193a909
commit 15a6a8179e
7 changed files with 530 additions and 2 deletions

180
0044.patch Normal file
View File

@ -0,0 +1,180 @@
From 410d8fc37f1ce5fc5a6f66eda3d3280a6fa0023c Mon Sep 17 00:00:00 2001
From: Antonio Alvarez Feijoo <antonio.feijoo@suse.com>
Date: Mon, 11 Jul 2022 12:52:58 +0200
Subject: [PATCH] fix(dracut.sh): correct wrong systemd variable paths
systemdsystemconfdir usually expands to /etc/systemd/system, but the local
configuration of systemd-networkd, systemd-timesyncd, portablectl and systemd
users is saved into directories whose parent is /etc/systemd
(systemdutilconfdir).
Also add missing exports.
fix(network-legacy): correct wrong local network configuration path
fix(network-manager): correct wrong local network configuration path
refactor(systemd-networkd): use more precise global variables
refactor(systemd-timesyncd): use more precise global variables
refactor(network-legacy): use more precise global variables
refactor(network-manager): use more precise global variables
(Cherry-picked commits:
ae4c8744dc3dbceb142c6eb88fd69bc6aaf29e20
a60543bf9746022e4430d310892ee03bb837b6a2
cb39aec479bdabfa7b1af5168c14ca5683905a7d
5781b6e7ab8c2f176331c960c677de1fe8a39592
3866ebc601bff71996c7e0892392332577e2a9c7
7fa66e106af021dd24fca8e76893c422775a6b61
c8adc9f72fef906b5706fa6d0e788564a508f4ee)
Resolves: RHEL-9479
---
dracut.sh | 14 ++++++++------
modules.d/01systemd-networkd/module-setup.sh | 14 +++++++-------
modules.d/01systemd-timesyncd/module-setup.sh | 4 ++--
modules.d/35network-legacy/module-setup.sh | 4 ++--
modules.d/35network-manager/module-setup.sh | 4 ++--
5 files changed, 21 insertions(+), 19 deletions(-)
diff --git a/dracut.sh b/dracut.sh
index 30dfb229..8c757b14 100755
--- a/dracut.sh
+++ b/dracut.sh
@@ -1830,7 +1830,7 @@ fi
[[ -d $dracutsysrootdir$systemdnetworkconfdir ]] \
|| systemdnetworkconfdir=$(pkg-config systemd --variable=systemdnetworkconfdir 2> /dev/null)
-[[ -d $dracutsysrootdir$systemdnetworkconfdir ]] || systemdnetworkconfdir=${systemdsystemconfdir}/network
+[[ -d $dracutsysrootdir$systemdnetworkconfdir ]] || systemdnetworkconfdir=${systemdutilconfdir}/network
[[ -d $dracutsysrootdir$systemdntpunits ]] \
|| systemdntpunits=$(pkg-config systemd --variable=systemdntpunits 2> /dev/null)
@@ -1840,7 +1840,7 @@ fi
[[ -d $dracutsysrootdir$systemdntpunitsconfdir ]] \
|| systemdntpunitsconfdir=$(pkg-config systemd --variable=systemdntpunitsconfdir 2> /dev/null)
-[[ -d $dracutsysrootdir$systemdntpunitsconfdir ]] || systemdntpunitsconfdir=${systemdsystemconfdir}/ntp-units.d
+[[ -d $dracutsysrootdir$systemdntpunitsconfdir ]] || systemdntpunitsconfdir=${systemdutilconfdir}/ntp-units.d
[[ -d $dracutsysrootdir$systemdportable ]] \
|| systemdportable=$(pkg-config systemd --variable=systemdportable 2> /dev/null)
@@ -1850,7 +1850,7 @@ fi
[[ -d $dracutsysrootdir$systemdportableconfdir ]] \
|| systemdportableconfdir=$(pkg-config systemd --variable=systemdportableconfdir 2> /dev/null)
-[[ -d "$dracutsysrootdir$systemdportableconfdir" ]] || systemdportableconfdir=${systemdsystemconfdir}/portable
+[[ -d "$dracutsysrootdir$systemdportableconfdir" ]] || systemdportableconfdir=${systemdutilconfdir}/portable
[[ -d $dracutsysrootdir$systemdsystemunitdir ]] \
|| systemdsystemunitdir=$(pkg-config systemd --variable=systemdsystemunitdir 2> /dev/null)
@@ -1865,7 +1865,7 @@ fi
[[ -d $dracutsysrootdir$systemduserconfdir ]] \
|| systemduserconfdir=$(pkg-config systemd --variable=systemduserconfdir 2> /dev/null)
-[[ -d $dracutsysrootdir$systemduserconfdir ]] || systemduserconfdir=${systemdsystemconfdir}/user
+[[ -d $dracutsysrootdir$systemduserconfdir ]] || systemduserconfdir=${systemdutilconfdir}/user
[[ -d $dracutsysrootdir$systemdsystemconfdir ]] \
|| systemdsystemconfdir=$(pkg-config systemd --variable=systemdsystemconfdir 2> /dev/null)
@@ -1919,8 +1919,10 @@ export initdir dracutbasedir \
dbussessionconfdir dbussystem dbussystemconfdir dbussystemservices \
dbussystemservicesconfdir environment environmentconfdir modulesload \
modulesloadconfdir sysctld sysctlconfdir sysusers sysusersconfdir \
- systemdutildir systemdutilconfdir systemdcatalog systemdntpunits \
- systemdntpunitsconfdir systemdsystemunitdir systemdsystemconfdir \
+ systemdutildir systemdutilconfdir systemdcatalog systemdnetwork \
+ systemdnetworkconfdir systemdntpunits systemdntpunitsconfdir \
+ systemdportable systemdportableconfdir systemdsystemunitdir \
+ systemdsystemconfdir systemduser systemduserconfdir \
hostonly_cmdline loginstall tmpfilesdir tmpfilesconfdir depmodd \
depmodconfdir
diff --git a/modules.d/01systemd-networkd/module-setup.sh b/modules.d/01systemd-networkd/module-setup.sh
index c3f3c051..e6d113d8 100755
--- a/modules.d/01systemd-networkd/module-setup.sh
+++ b/modules.d/01systemd-networkd/module-setup.sh
@@ -39,12 +39,12 @@ install() {
"$systemdutildir"/systemd-networkd \
"$systemdutildir"/systemd-network-generator \
"$systemdutildir"/systemd-networkd-wait-online \
- "$systemdutildir"/network/80-container-host0.network \
- "$systemdutildir"/network/80-container-ve.network \
- "$systemdutildir"/network/80-container-vz.network \
- "$systemdutildir"/network/80-vm-vt.network \
- "$systemdutildir"/network/80-wifi-adhoc.network \
- "$systemdutildir"/network/99-default.link \
+ "$systemdnetwork"/80-container-host0.network \
+ "$systemdnetwork"/80-container-ve.network \
+ "$systemdnetwork"/80-container-vz.network \
+ "$systemdnetwork"/80-vm-vt.network \
+ "$systemdnetwork"/80-wifi-adhoc.network \
+ "$systemdnetwork"/99-default.link \
"$systemdsystemunitdir"/systemd-networkd.service \
"$systemdsystemunitdir"/systemd-networkd.socket \
"$systemdsystemunitdir"/systemd-network-generator.service \
@@ -67,7 +67,7 @@ install() {
inst_multiple -H -o \
"$systemdutilconfdir"/networkd.conf \
"$systemdutilconfdir/networkd.conf.d/*.conf" \
- "$systemdutilconfdir/network/*" \
+ "$systemdnetworkconfdir/*" \
"$systemdsystemconfdir"/systemd-networkd.service \
"$systemdsystemconfdir/systemd-networkd.service/*.conf" \
"$systemdsystemunitdir"/systemd-networkd.socket \
diff --git a/modules.d/01systemd-timesyncd/module-setup.sh b/modules.d/01systemd-timesyncd/module-setup.sh
index 015caecf..f6f35fee 100755
--- a/modules.d/01systemd-timesyncd/module-setup.sh
+++ b/modules.d/01systemd-timesyncd/module-setup.sh
@@ -35,7 +35,7 @@ install() {
inst_multiple -o \
"$dbussystem"/org.freedesktop.timesync1.conf \
"$dbussystemservices"/org.freedesktop.timesync1.service \
- "$systemdutildir/ntp-units.d/*.list" \
+ "$systemdntpunits/*.list" \
"$systemdutildir"/systemd-timesyncd \
"$systemdutildir"/systemd-time-wait-sync \
"$systemdutildir/timesyncd.conf.d/*.conf" \
@@ -55,7 +55,7 @@ install() {
# Install the hosts local user configurations if enabled.
if [[ $hostonly ]]; then
inst_multiple -H -o \
- "$systemdutilconfdir/ntp-units.d/*.list" \
+ "$systemdntpunitsconfdir/*.list" \
"$systemdutilconfdir"/timesyncd.conf \
"$systemdutilconfdir/timesyncd.conf.d/*.conf" \
"$systemdsystemconfdir"/systemd-timesyncd.service \
diff --git a/modules.d/35network-legacy/module-setup.sh b/modules.d/35network-legacy/module-setup.sh
index 84dcf7f5..e57fc6fa 100755
--- a/modules.d/35network-legacy/module-setup.sh
+++ b/modules.d/35network-legacy/module-setup.sh
@@ -24,8 +24,8 @@ install() {
#Adding default link
if dracut_module_included "systemd"; then
- inst_multiple -o "${systemdutildir}/network/99-default.link"
- [[ $hostonly ]] && inst_multiple -H -o "${systemdsystemconfdir}/network/*.link"
+ inst_multiple -o "${systemdnetwork}/99-default.link"
+ [[ $hostonly ]] && inst_multiple -H -o "${systemdnetworkconfdir}/*.link"
fi
inst_multiple ip dhclient sed awk grep pgrep tr expr
diff --git a/modules.d/35network-manager/module-setup.sh b/modules.d/35network-manager/module-setup.sh
index 04898a39..c93c6a3c 100755
--- a/modules.d/35network-manager/module-setup.sh
+++ b/modules.d/35network-manager/module-setup.sh
@@ -52,8 +52,8 @@ install() {
inst_simple "$moddir"/nm-wait-online-initrd.service "$systemdsystemunitdir"/nm-wait-online-initrd.service
# Adding default link
- inst_multiple -o "${systemdutildir}/network/99-default.link"
- [[ $hostonly ]] && inst_multiple -H -o "${systemdsystemconfdir}/network/*.link"
+ inst_multiple -o "${systemdnetwork}/99-default.link"
+ [[ $hostonly ]] && inst_multiple -H -o "${systemdnetworkconfdir}/*.link"
$SYSTEMCTL -q --root "$initdir" enable nm-initrd.service
fi

31
0045.patch Normal file
View File

@ -0,0 +1,31 @@
From 7bdb3fbdce70bea19dca3fec792b5266d7b9e48b Mon Sep 17 00:00:00 2001
From: Pavel Valena <pvalena@redhat.com>
Date: Tue, 14 Nov 2023 14:55:44 +0100
Subject: [PATCH] fix(hwdb): follow shfmt-recommended format
Related: RHEL-9479
---
modules.d/95hwdb/module-setup.sh | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/modules.d/95hwdb/module-setup.sh b/modules.d/95hwdb/module-setup.sh
index 16365377..7e4b1af6 100755
--- a/modules.d/95hwdb/module-setup.sh
+++ b/modules.d/95hwdb/module-setup.sh
@@ -11,11 +11,12 @@ install() {
local hwdb_bin
# systemd-hwdb ships the file in /etc, with /usr/lib as an alternative.
- # Therefore consider this location as preferred for configuration.
+ # The alternative location is preferred, as we can consider it being user
+ # configuration.
hwdb_bin="${udevdir}"/hwdb.bin
- if [[ ! -r "${hwdb_bin}" ]]; then
- hwdb_bin="${udevconfdir}"/hwdb.bin
+ if [[ ! -r ${hwdb_bin} ]]; then
+ hwdb_bin="${udevconfdir}"/hwdb.bin
fi
if [[ $hostonly ]]; then

177
0047.patch Normal file
View File

@ -0,0 +1,177 @@
From 28cadd4829118d2831908dd267766613fd74f0b1 Mon Sep 17 00:00:00 2001
From: Emanuele Giuseppe Esposito <eesposit@redhat.com>
Date: Wed, 12 Jul 2023 03:50:47 -0400
Subject: [PATCH] feat(dracut): add --sbat option to add sbat policy to UKI
Take existing .sbat section from the uefi stub and merge it
with vmlinux .sbat (if it exists) and user-provided .sbat parameters
using the new --sbat option.
For some reasons, --update-section in objcopy does not resize the
.sbat section, so remove the section from the stub and add it
to the UKI as new one, to avoid having incomplete SBAT strings.
Signed-off-by: Emanuele Giuseppe Esposito <eesposit@redhat.com>
(Cherry-picked commit: 550a0084fd95870f35218dc2cf8ea91fde1c728a)
Resolves: RHEL-5732
---
dracut.sh | 46 +++++++++++++++++++++++++++++++++++++++++++-
man/dracut.8.asc | 5 +++++
man/dracut.conf.5.asc | 5 +++++
shell-completion/bash/dracut | 2 +-
4 files changed, 56 insertions(+), 2 deletions(-)
diff --git a/dracut.sh b/dracut.sh
index 8c757b14..0bac6a33 100755
--- a/dracut.sh
+++ b/dracut.sh
@@ -271,6 +271,10 @@ Creates initial ramdisk images for preloading modules
Use [FILE] as a splash image when creating an UEFI
executable. Requires bitmap (.bmp) image format.
--kernel-image [FILE] Location of the kernel image.
+ --sbat [PARAMETERS] The SBAT parameters to be added to .sbat.
+ The string "sbat,1,SBAT Version,sbat,1,
+ https://github.com/rhboot/shim/blob/main/SBAT.md" is
+ already added by default.
--regenerate-all Regenerate all initramfs images at the default location
for the kernel versions found on the system.
-p, --parallel Use parallel processing if possible (currently only
@@ -462,6 +466,7 @@ rearrange_params() {
--long uefi-stub: \
--long uefi-splash-image: \
--long kernel-image: \
+ --long sbat: \
--long no-hostonly-i18n \
--long hostonly-i18n \
--long hostonly-nics: \
@@ -839,6 +844,11 @@ while :; do
PARMS_TO_STORE+=" '$2'"
shift
;;
+ --sbat)
+ sbat_l="$2"
+ PARMS_TO_STORE+=" '$2'"
+ shift
+ ;;
--no-machineid)
machine_id_l="no"
;;
@@ -1076,6 +1086,7 @@ stdloglvl=$((stdloglvl + verbosity_mod_l))
[[ $uefi_stub_l ]] && uefi_stub="$uefi_stub_l"
[[ $uefi_splash_image_l ]] && uefi_splash_image="$uefi_splash_image_l"
[[ $kernel_image_l ]] && kernel_image="$kernel_image_l"
+[[ $sbat_l ]] && sbat="$sbat_l"
[[ $machine_id_l ]] && machine_id="$machine_id_l"
if ! [[ $outfile ]]; then
@@ -2585,6 +2596,24 @@ fi
umask 077
+SBAT_DEFAULT="sbat,1,SBAT Version,sbat,1,https://github.com/rhboot/shim/blob/main/SBAT.md"
+sbat_out=$uefi_outdir/uki.sbat
+
+clean_sbat_string() {
+ local inp=$1
+ local temp=$uefi_outdir/temp.sbat
+ sed "/${SBAT_DEFAULT//\//\\/}/d" "$inp" > "$temp"
+ [[ -s $temp ]] && cat "$temp" >> "$sbat_out"
+ rm "$temp"
+}
+
+get_sbat_string() {
+ local inp=$1
+ local out=$uefi_outdir/$2
+ objcopy -O binary --only-section=.sbat "$inp" "$out"
+ clean_sbat_string "$out"
+}
+
if [[ $uefi == yes ]]; then
if [[ $kernel_cmdline ]]; then
echo -n "$kernel_cmdline" > "$uefi_outdir/cmdline.txt"
@@ -2635,6 +2664,16 @@ if [[ $uefi == yes ]]; then
unset uefi_splash_image
fi
+ echo "$SBAT_DEFAULT" > "$sbat_out"
+ if [[ -n $sbat ]]; then
+ echo "$sbat" | sed "/${SBAT_DEFAULT//\//\\/}/d" >> "$sbat_out"
+ fi
+ get_sbat_string "$kernel_image" kernel.sbat
+ get_sbat_string "$uefi_stub" stub.sbat
+
+ uefi_sbat_offs="${offs}"
+ offs=$((offs + $(stat -Lc%s "$sbat_out")))
+ offs=$((offs + "$align" - offs % "$align"))
uefi_linux_offs="${offs}"
offs=$((offs + $(stat -Lc%s "$kernel_image")))
offs=$((offs + "$align" - offs % "$align"))
@@ -2646,14 +2685,19 @@ if [[ $uefi == yes ]]; then
exit 1
fi
+ tmp_uefi_stub=$uefi_outdir/elf.stub
+ cp "$uefi_stub" "$tmp_uefi_stub"
+ objcopy --remove-section .sbat "$tmp_uefi_stub" &> /dev/null
+
if objcopy \
${uefi_osrelease:+--add-section .osrel="$uefi_osrelease" --change-section-vma .osrel=$(printf 0x%x "$uefi_osrelease_offs")} \
${uefi_cmdline:+--add-section .cmdline="$uefi_cmdline" --change-section-vma .cmdline=$(printf 0x%x "$uefi_cmdline_offs")} \
${uefi_splash_image:+--add-section .splash="$uefi_splash_image" --change-section-vma .splash=$(printf 0x%x "$uefi_splash_offs")} \
+ --add-section .sbat="$sbat_out" --change-section-vma .sbat="$(printf 0x%x "$uefi_sbat_offs")" \
--add-section .linux="$kernel_image" --change-section-vma .linux="$(printf 0x%x "$uefi_linux_offs")" \
--add-section .initrd="${DRACUT_TMPDIR}/initramfs.img" --change-section-vma .initrd="$(printf 0x%x "$uefi_initrd_offs")" \
--image-base="$(printf 0x%x "$base_image")" \
- "$uefi_stub" "${uefi_outdir}/linux.efi"; then
+ "$tmp_uefi_stub" "${uefi_outdir}/linux.efi"; then
if [[ -n ${uefi_secureboot_key} && -n ${uefi_secureboot_cert} ]]; then
if sbsign \
--key "${uefi_secureboot_key}" \
diff --git a/man/dracut.8.asc b/man/dracut.8.asc
index bfb86f5d..8339e8a9 100644
--- a/man/dracut.8.asc
+++ b/man/dracut.8.asc
@@ -600,6 +600,11 @@ and no /etc/cmdline/*.conf will be generated into the initramfs.
default is _/lib/modules/<KERNEL-VERSION>/vmlinuz_ or
_/boot/vmlinuz-<KERNEL-VERSION>_.
+**--sbat <parameters>**::
+ Specifies the SBAT parameters, which to include in the UEFI executable. By default
+ the default SBAT string added is "sbat,1,SBAT Version,sbat,1,
+ https://github.com/rhboot/shim/blob/main/SBAT.md".
+
**--enhanced-cpio**::
Attempt to use the dracut-cpio binary, which optimizes archive creation for
copy-on-write filesystems by using the copy_file_range(2) syscall via Rust's
diff --git a/man/dracut.conf.5.asc b/man/dracut.conf.5.asc
index 96c80129..132ca8e3 100644
--- a/man/dracut.conf.5.asc
+++ b/man/dracut.conf.5.asc
@@ -299,6 +299,11 @@ Logging levels:
default is _/lib/modules/<KERNEL-VERSION>/vmlinuz_ or
_/boot/vmlinuz-<KERNEL-VERSION>_.
+*sbat=*"__parameters__"::
+ Specifies the SBAT parameters, which to include in the UEFI executable. By default
+ the default SBAT string added is "sbat,1,SBAT Version,sbat,1,
+ https://github.com/rhboot/shim/blob/main/SBAT.md".
+
*enhanced_cpio=*"__{yes|no}__"::
Attempt to use the dracut-cpio binary, which optimizes archive creation for
copy-on-write filesystems (default=no).
diff --git a/shell-completion/bash/dracut b/shell-completion/bash/dracut
index 86de2071..9b51db01 100644
--- a/shell-completion/bash/dracut
+++ b/shell-completion/bash/dracut
@@ -46,7 +46,7 @@ _dracut() {
--kernel-cmdline --sshkey --persistent-policy --install-optional
--loginstall --uefi-stub --kernel-image --squash-compressor
--sysroot --hostonly-mode --hostonly-nics --include --logfile
- --uefi-splash-image
+ --uefi-splash-image --sbat
'
)

28
0048.patch Normal file
View File

@ -0,0 +1,28 @@
From 50df5d09d5f27889ebed61011b35ce3eef687288 Mon Sep 17 00:00:00 2001
From: Antonio Alvarez Feijoo <antonio.feijoo@suse.com>
Date: Thu, 1 Sep 2022 11:47:09 +0200
Subject: [PATCH] feat(systemd): install systemd-sysroot-fstab-check
systemd-sysroot-fstab-check is a symlink to systemd-fstab-generator added in
systemd commit https://github.com/systemd/systemd/commit/cd7ad0cb
(cherry picked from commit 23684e4a2bb024595ad63d9f49d83b4693537110)
Resolves: RHEL-12409
---
modules.d/00systemd/module-setup.sh | 1 +
1 file changed, 1 insertion(+)
diff --git a/modules.d/00systemd/module-setup.sh b/modules.d/00systemd/module-setup.sh
index 433e4758..2a4fe4ba 100755
--- a/modules.d/00systemd/module-setup.sh
+++ b/modules.d/00systemd/module-setup.sh
@@ -43,6 +43,7 @@ install() {
"$systemdutildir"/systemd-modules-load \
"$systemdutildir"/systemd-vconsole-setup \
"$systemdutildir"/systemd-volatile-root \
+ "$systemdutildir"/systemd-sysroot-fstab-check \
"$systemdutildir"/system-generators/systemd-debug-generator \
"$systemdutildir"/system-generators/systemd-fstab-generator \
"$systemdutildir"/system-generators/systemd-gpt-auto-generator \

41
0049.patch Normal file
View File

@ -0,0 +1,41 @@
From 4c75e51c585eebd9bc175920aa8c8b4afe808144 Mon Sep 17 00:00:00 2001
From: Pavel Valena <pvalena@redhat.com>
Date: Wed, 20 Sep 2023 14:56:41 +0200
Subject: [PATCH] fix(dracut.spec): add jq dependency to network subpackage
and also move nvmf module to network subpackage.
Resolves: RHEL-15012
---
pkgbuild/dracut.spec | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/pkgbuild/dracut.spec b/pkgbuild/dracut.spec
index 1996f44d..bd850986 100644
--- a/pkgbuild/dracut.spec
+++ b/pkgbuild/dracut.spec
@@ -111,6 +111,7 @@ Requires: %{name} = %{version}-%{release}
%endif
Requires: iputils
Requires: iproute
+Requires: jq
Requires: (NetworkManager >= 1.20 or dhclient)
Suggests: NetworkManager
Obsoletes: dracut-generic < 008
@@ -369,7 +370,6 @@ echo 'dracut_rescue_image="yes"' > $RPM_BUILD_ROOT%{dracutlibdir}/dracut.conf.d/
%{dracutlibdir}/modules.d/95fstab-sys
%{dracutlibdir}/modules.d/95hwdb
%{dracutlibdir}/modules.d/95lunmask
-%{dracutlibdir}/modules.d/95nvmf
%{dracutlibdir}/modules.d/95resume
%{dracutlibdir}/modules.d/95rootfs-block
%{dracutlibdir}/modules.d/95terminfo
@@ -441,6 +441,7 @@ echo 'dracut_rescue_image="yes"' > $RPM_BUILD_ROOT%{dracutlibdir}/dracut.conf.d/
%{dracutlibdir}/modules.d/95iscsi
%{dracutlibdir}/modules.d/95nbd
%{dracutlibdir}/modules.d/95nfs
+%{dracutlibdir}/modules.d/95nvmf
%{dracutlibdir}/modules.d/95ssh-client
%ifarch s390 s390x
%{dracutlibdir}/modules.d/95znet

56
0050.patch Normal file
View File

@ -0,0 +1,56 @@
From 8e933e8c8208ce16a79661379420e450b7f4a778 Mon Sep 17 00:00:00 2001
From: Pavel Valena <pvalena@redhat.com>
Date: Wed, 7 Jun 2023 22:12:45 +0200
Subject: [PATCH] fix(fcoe-uefi): exit early on empty vlan
Exit early in case get_fcoe_boot_vlan exits with error or just an empty string,
instead of producing invalid config entry.
(Cherry-picked commit: 45fc8df1cf3fdf9726efda4d26c7cccb9e6aedd2
PR: https://github.com/dracutdevs/dracut/pull/2379)
Resolves: RHEL-14251
---
modules.d/95fcoe-uefi/parse-uefifcoe.sh | 29 ++++++++++++++++-------------
1 file changed, 16 insertions(+), 13 deletions(-)
diff --git a/modules.d/95fcoe-uefi/parse-uefifcoe.sh b/modules.d/95fcoe-uefi/parse-uefifcoe.sh
index e120dec3..b341c963 100755
--- a/modules.d/95fcoe-uefi/parse-uefifcoe.sh
+++ b/modules.d/95fcoe-uefi/parse-uefifcoe.sh
@@ -9,19 +9,22 @@ print_fcoe_uefi_conf() {
mac=$(get_fcoe_boot_mac "$1")
[ -z "$mac" ] && return 1
dev=$(set_ifname fcoe "$mac")
- vlan=$(get_fcoe_boot_vlan "$1")
- 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
+ vlan=$(get_fcoe_boot_vlan "$1") || return 1
+ case "$vlan" in
+ "0") ;;
+
+ '')
+ return 1
+ ;;
+ [0-9]*)
+ printf "%s\n" "vlan=$dev.$vlan:$dev"
+ dev="$dev.$vlan"
+ ;;
+ *)
+ printf "%s\n" "vlan=$vlan:$dev"
+ dev="$vlan"
+ ;;
+ esac
# fcoe=eth0:nodcb
printf "fcoe=%s\n" "$dev:nodcb"
return 0

View File

@ -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 44.git20230822
%define dist_free_release 51.git20231114
Name: dracut
Version: 057
@ -72,6 +72,12 @@ Patch40: 0040.patch
Patch41: 0041.patch
Patch42: 0042.patch
Patch43: 0043.patch
Patch44: 0044.patch
Patch45: 0045.patch
Patch47: 0047.patch
Patch48: 0048.patch
Patch49: 0049.patch
Patch50: 0050.patch
Source1: https://www.gnu.org/licenses/lgpl-2.1.txt
@ -155,6 +161,7 @@ Requires: %{name} = %{version}-%{release}
%endif
Requires: iputils
Requires: iproute
Requires: jq
Requires: (NetworkManager >= 1.20 or dhclient)
Suggests: NetworkManager
Obsoletes: dracut-generic < 008
@ -413,7 +420,6 @@ echo 'dracut_rescue_image="yes"' > $RPM_BUILD_ROOT%{dracutlibdir}/dracut.conf.d/
%{dracutlibdir}/modules.d/95fstab-sys
%{dracutlibdir}/modules.d/95hwdb
%{dracutlibdir}/modules.d/95lunmask
%{dracutlibdir}/modules.d/95nvmf
%{dracutlibdir}/modules.d/95resume
%{dracutlibdir}/modules.d/95rootfs-block
%{dracutlibdir}/modules.d/95terminfo
@ -485,6 +491,7 @@ echo 'dracut_rescue_image="yes"' > $RPM_BUILD_ROOT%{dracutlibdir}/dracut.conf.d/
%{dracutlibdir}/modules.d/95iscsi
%{dracutlibdir}/modules.d/95nbd
%{dracutlibdir}/modules.d/95nfs
%{dracutlibdir}/modules.d/95nvmf
%{dracutlibdir}/modules.d/95ssh-client
%ifarch s390 s390x
%{dracutlibdir}/modules.d/95znet
@ -522,6 +529,14 @@ echo 'dracut_rescue_image="yes"' > $RPM_BUILD_ROOT%{dracutlibdir}/dracut.conf.d/
%{_prefix}/lib/kernel/install.d/51-dracut-rescue.install
%changelog
* Tue Nov 14 2023 Pavel Valena <pvalena@redhat.com> - 057-51.git20231114
- fix(dracut.sh): correct wrong systemd variable paths
- fix(hwdb): follow shfmt-recommended format
- feat(dracut): add --sbat option to add sbat policy to UKI
- feat(systemd): install systemd-sysroot-fstab-check
- fix(dracut.spec): add jq dependency to network subpackage
- fix(fcoe-uefi): exit early on empty vlan
* Tue Aug 22 2023 Pavel Valena <pvalena@redhat.com> - 057-44.git20230822
- feat(hwdb): install hwdb on demand when module is needed