commit
85ab5daf66
@ -0,0 +1 @@
|
|||||||
|
0e004ae0a4b910b1bd3e2f1d86dd0649f8f2addd SOURCES/102.tar.gz
|
@ -0,0 +1 @@
|
|||||||
|
SOURCES/102.tar.gz
|
@ -0,0 +1,54 @@
|
|||||||
|
From 3bcb0a9f06bac7fa62dc7241860deb8b671f17cd Mon Sep 17 00:00:00 2001
|
||||||
|
From: Pavel Valena <pvalena@redhat.com>
|
||||||
|
Date: Tue, 25 Apr 2023 14:56:59 +0200
|
||||||
|
Subject: [PATCH 01/24] feat(hwdb): add hwdb module to install hwdb.bin on
|
||||||
|
demand
|
||||||
|
|
||||||
|
Module to install hwdb.bin. Further extensions might make only selected
|
||||||
|
part of hwdb installable to save space. The module is not included by default.
|
||||||
|
|
||||||
|
Including the module adds 2MB of compressed data (on Fedora, the file has 12MB).
|
||||||
|
|
||||||
|
Installing hwdb.bin is needed in case of custom HW like a keyboard/mouse, or various interfaces.
|
||||||
|
|
||||||
|
Original PR: https://github.com/dracutdevs/dracut/pull/1681
|
||||||
|
---
|
||||||
|
modules.d/95hwdb/module-setup.sh | 26 ++++++++++++++++++++++++++
|
||||||
|
1 file changed, 26 insertions(+)
|
||||||
|
create mode 100755 modules.d/95hwdb/module-setup.sh
|
||||||
|
|
||||||
|
diff --git a/modules.d/95hwdb/module-setup.sh b/modules.d/95hwdb/module-setup.sh
|
||||||
|
new file mode 100755
|
||||||
|
index 00000000..5d3250f3
|
||||||
|
--- /dev/null
|
||||||
|
+++ b/modules.d/95hwdb/module-setup.sh
|
||||||
|
@@ -0,0 +1,26 @@
|
||||||
|
+#!/bin/bash
|
||||||
|
+# This file is part of dracut.
|
||||||
|
+# SPDX-License-Identifier: GPL-2.0-or-later
|
||||||
|
+
|
||||||
|
+check() {
|
||||||
|
+ return 255
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+# called by dracut
|
||||||
|
+install() {
|
||||||
|
+ local hwdb_bin
|
||||||
|
+
|
||||||
|
+ # Follow the same priority as `systemd-hwdb`; `/etc` is the default
|
||||||
|
+ # and `/usr/lib` an alternative location.
|
||||||
|
+ hwdb_bin="${udevconfdir}"/hwdb.bin
|
||||||
|
+
|
||||||
|
+ if [[ ! -r ${hwdb_bin} ]]; then
|
||||||
|
+ hwdb_bin="${udevdir}"/hwdb.bin
|
||||||
|
+ fi
|
||||||
|
+
|
||||||
|
+ if [[ $hostonly ]]; then
|
||||||
|
+ inst_multiple -H "${hwdb_bin}"
|
||||||
|
+ else
|
||||||
|
+ inst_multiple "${hwdb_bin}"
|
||||||
|
+ fi
|
||||||
|
+}
|
||||||
|
--
|
||||||
|
2.42.0
|
||||||
|
|
@ -0,0 +1,59 @@
|
|||||||
|
From d14d724620fe4810930d1c2f07d10fa6b8bc9557 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Pavel Valena <pvalena@redhat.com>
|
||||||
|
Date: Sun, 23 Jul 2023 19:44:17 +0200
|
||||||
|
Subject: [PATCH 02/24] fix(rngd): install system service file
|
||||||
|
|
||||||
|
as there's no reason to keep a copy; there shouldn't be any modifications.
|
||||||
|
|
||||||
|
In case there are args stored in a separate file (Fedora and alike),
|
||||||
|
it needs to be supplied too, but without the option to change the user.
|
||||||
|
---
|
||||||
|
modules.d/06rngd/module-setup.sh | 7 ++++++-
|
||||||
|
modules.d/06rngd/rngd.service | 8 --------
|
||||||
|
modules.d/06rngd/sysconfig | 1 +
|
||||||
|
3 files changed, 7 insertions(+), 9 deletions(-)
|
||||||
|
delete mode 100644 modules.d/06rngd/rngd.service
|
||||||
|
create mode 100644 modules.d/06rngd/sysconfig
|
||||||
|
|
||||||
|
diff --git a/modules.d/06rngd/module-setup.sh b/modules.d/06rngd/module-setup.sh
|
||||||
|
index aec8d576..e8bdf7f5 100755
|
||||||
|
--- a/modules.d/06rngd/module-setup.sh
|
||||||
|
+++ b/modules.d/06rngd/module-setup.sh
|
||||||
|
@@ -32,7 +32,12 @@ depends() {
|
||||||
|
|
||||||
|
install() {
|
||||||
|
inst rngd
|
||||||
|
- inst_simple "${moddir}/rngd.service" "${systemdsystemunitdir}/rngd.service"
|
||||||
|
+ inst_simple "${systemdsystemunitdir}/rngd.service"
|
||||||
|
+
|
||||||
|
+ if [ -r /etc/sysconfig/rngd ]; then
|
||||||
|
+ inst_simple "${moddir}/sysconfig" "/etc/sysconfig/rngd"
|
||||||
|
+ fi
|
||||||
|
+
|
||||||
|
# make sure dependent libs are installed too
|
||||||
|
inst_libdir_file opensc-pkcs11.so
|
||||||
|
|
||||||
|
diff --git a/modules.d/06rngd/rngd.service b/modules.d/06rngd/rngd.service
|
||||||
|
deleted file mode 100644
|
||||||
|
index dd5374d7..00000000
|
||||||
|
--- a/modules.d/06rngd/rngd.service
|
||||||
|
+++ /dev/null
|
||||||
|
@@ -1,8 +0,0 @@
|
||||||
|
-[Unit]
|
||||||
|
-Description=Hardware RNG Entropy Gatherer Daemon
|
||||||
|
-DefaultDependencies=no
|
||||||
|
-Before=systemd-udevd.service
|
||||||
|
-ConditionVirtualization=!container
|
||||||
|
-
|
||||||
|
-[Service]
|
||||||
|
-ExecStart=/usr/sbin/rngd -f
|
||||||
|
diff --git a/modules.d/06rngd/sysconfig b/modules.d/06rngd/sysconfig
|
||||||
|
new file mode 100644
|
||||||
|
index 00000000..68047ec1
|
||||||
|
--- /dev/null
|
||||||
|
+++ b/modules.d/06rngd/sysconfig
|
||||||
|
@@ -0,0 +1 @@
|
||||||
|
+RNGD_ARGS="-x pkcs11 -x nist"
|
||||||
|
--
|
||||||
|
2.42.0
|
||||||
|
|
@ -0,0 +1,238 @@
|
|||||||
|
From 6fa596ca039300e5f4bb3cca14768976efe95eac Mon Sep 17 00:00:00 2001
|
||||||
|
From: Pavel Valena <pvalena@redhat.com>
|
||||||
|
Date: Wed, 12 Jun 2024 06:30:42 +0200
|
||||||
|
Subject: [PATCH 03/24] revert: "fix(install.d): correctly install pre-genned
|
||||||
|
image and die if no args"
|
||||||
|
|
||||||
|
revert: "fix(install.d): simplify and use what kernel-install gives us"
|
||||||
|
|
||||||
|
This reverts commits:
|
||||||
|
d40155385d060f8d8608fa8a4931e2e42ddc3a8f
|
||||||
|
8388ad149c698c951089606352fdb0cdcaaf40c9
|
||||||
|
|
||||||
|
https://github.com/dracut-ng/dracut-ng/issues/334
|
||||||
|
|
||||||
|
This is temporary, until the `20-grub.install` will be able to handle initrd
|
||||||
|
from kernel staging area.
|
||||||
|
---
|
||||||
|
install.d/50-dracut.install | 152 ++++++++++++++++++-----------
|
||||||
|
install.d/51-dracut-rescue.install | 22 +----
|
||||||
|
2 files changed, 97 insertions(+), 77 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/install.d/50-dracut.install b/install.d/50-dracut.install
|
||||||
|
index 14f87721..441414ac 100755
|
||||||
|
--- a/install.d/50-dracut.install
|
||||||
|
+++ b/install.d/50-dracut.install
|
||||||
|
@@ -1,13 +1,13 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
-COMMAND="${1:?}"
|
||||||
|
-KERNEL_VERSION="${2:?}"
|
||||||
|
-#shellcheck disable=SC2034
|
||||||
|
+COMMAND="$1"
|
||||||
|
+KERNEL_VERSION="$2"
|
||||||
|
BOOT_DIR_ABS="$3"
|
||||||
|
KERNEL_IMAGE="$4"
|
||||||
|
|
||||||
|
-# If the initrd was provided on the kernel command line, we shouldn't generate our own.
|
||||||
|
-if [[ "$COMMAND" != "add" || "$#" -gt 4 ]]; then
|
||||||
|
+# If KERNEL_INSTALL_MACHINE_ID is defined but empty, BOOT_DIR_ABS is a fake directory.
|
||||||
|
+# So, let's skip to create initrd.
|
||||||
|
+if ! [[ ${KERNEL_INSTALL_MACHINE_ID-x} ]]; then
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
@@ -16,64 +16,102 @@ if [[ "$KERNEL_INSTALL_IMAGE_TYPE" = "uki" ]]; then
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
-if [[ "${KERNEL_INSTALL_INITRD_GENERATOR:-dracut}" = "dracut" ]]; then
|
||||||
|
- # We are the initrd generator
|
||||||
|
- IMAGE="initrd"
|
||||||
|
- UEFI_OPTS="--no-uefi"
|
||||||
|
+# Mismatching the install layout and the --uefi/--no-uefi opts just creates a mess.
|
||||||
|
+if [[ $KERNEL_INSTALL_LAYOUT == "uki" && -n $KERNEL_INSTALL_STAGING_AREA ]]; then
|
||||||
|
+ BOOT_DIR_ABS="$KERNEL_INSTALL_STAGING_AREA"
|
||||||
|
+ if [[ -z $KERNEL_INSTALL_UKI_GENERATOR || $KERNEL_INSTALL_UKI_GENERATOR == "dracut" ]]; then
|
||||||
|
+ # No uki generator preference set or we have been chosen
|
||||||
|
+ IMAGE="uki.efi"
|
||||||
|
+ UEFI_OPTS="--uefi"
|
||||||
|
+ elif [[ -z $KERNEL_INSTALL_INITRD_GENERATOR || $KERNEL_INSTALL_INITRD_GENERATOR == "dracut" ]]; then
|
||||||
|
+ # We aren't the uki generator, but we have been requested to make the initrd
|
||||||
|
+ IMAGE="initrd"
|
||||||
|
+ UEFI_OPTS="--no-uefi"
|
||||||
|
+ else
|
||||||
|
+ exit 0
|
||||||
|
+ fi
|
||||||
|
+elif [[ $KERNEL_INSTALL_LAYOUT == "bls" && -n $KERNEL_INSTALL_STAGING_AREA ]]; then
|
||||||
|
+ BOOT_DIR_ABS="$KERNEL_INSTALL_STAGING_AREA"
|
||||||
|
+ if [[ -z $KERNEL_INSTALL_INITRD_GENERATOR || $KERNEL_INSTALL_INITRD_GENERATOR == "dracut" ]]; then
|
||||||
|
+ IMAGE="initrd"
|
||||||
|
+ UEFI_OPTS="--no-uefi"
|
||||||
|
+ else
|
||||||
|
+ exit 0
|
||||||
|
+ fi
|
||||||
|
else
|
||||||
|
- exit 0
|
||||||
|
+ # No layout information, use users --uefi/--no-uefi preference
|
||||||
|
+ UEFI_OPTS=""
|
||||||
|
+ if [[ -d $BOOT_DIR_ABS ]]; then
|
||||||
|
+ IMAGE="initrd"
|
||||||
|
+ else
|
||||||
|
+ BOOT_DIR_ABS="/boot"
|
||||||
|
+ IMAGE="initramfs-${KERNEL_VERSION}.img"
|
||||||
|
+ fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
-if [[ "$KERNEL_INSTALL_UKI_GENERATOR" = "dracut" ]]; then
|
||||||
|
- # We are chosen to generate the UKI as well as initrd
|
||||||
|
- IMAGE="uki.efi"
|
||||||
|
- UEFI_OPTS="--uefi"
|
||||||
|
-fi
|
||||||
|
+ret=0
|
||||||
|
|
||||||
|
-if [[ -f ${KERNEL_IMAGE%/*}/$IMAGE ]]; then
|
||||||
|
- # we found an initrd or uki.efi at the same place as the kernel
|
||||||
|
- # use this and don't generate a new one
|
||||||
|
- [[ $KERNEL_INSTALL_VERBOSE == 1 ]] && echo \
|
||||||
|
- "There is an $IMAGE image at the same place as the kernel, skipping generating a new one"
|
||||||
|
- cp --reflink=auto "${KERNEL_IMAGE%/*}/$IMAGE" "$KERNEL_INSTALL_STAGING_AREA/$IMAGE" \
|
||||||
|
- && chown root:root "$KERNEL_INSTALL_STAGING_AREA/$IMAGE" \
|
||||||
|
- && chmod 0600 "$KERNEL_INSTALL_STAGING_AREA/$IMAGE" \
|
||||||
|
- && exit 0
|
||||||
|
-fi
|
||||||
|
+case "$COMMAND" in
|
||||||
|
+ add)
|
||||||
|
+ if [[ $IMAGE == "uki.efi" ]]; then
|
||||||
|
+ IMAGE_PREGENERATED=${KERNEL_IMAGE%/*}/uki.efi
|
||||||
|
+ else
|
||||||
|
+ IMAGE_PREGENERATED=${KERNEL_IMAGE%/*}/initrd
|
||||||
|
+ fi
|
||||||
|
+ if [[ -f ${IMAGE_PREGENERATED} ]]; then
|
||||||
|
+ # we found an initrd or uki.efi at the same place as the kernel
|
||||||
|
+ # use this and don't generate a new one
|
||||||
|
+ [[ $KERNEL_INSTALL_VERBOSE == 1 ]] && echo \
|
||||||
|
+ "There is an ${IMAGE} image at the same place as the kernel, skipping generating a new one"
|
||||||
|
+ cp --reflink=auto "$IMAGE_PREGENERATED" "$BOOT_DIR_ABS/$IMAGE" \
|
||||||
|
+ && chown root:root "$BOOT_DIR_ABS/$IMAGE" \
|
||||||
|
+ && chmod 0600 "$BOOT_DIR_ABS/$IMAGE" \
|
||||||
|
+ && exit 0
|
||||||
|
+ fi
|
||||||
|
|
||||||
|
-if [ -n "$KERNEL_INSTALL_CONF_ROOT" ]; then
|
||||||
|
- if [ -f "$KERNEL_INSTALL_CONF_ROOT/cmdline" ]; then
|
||||||
|
- read -r -d '' -a BOOT_OPTIONS < "$KERNEL_INSTALL_CONF_ROOT/cmdline"
|
||||||
|
- fi
|
||||||
|
-elif [[ -f /etc/kernel/cmdline ]]; then
|
||||||
|
- read -r -d '' -a BOOT_OPTIONS < /etc/kernel/cmdline
|
||||||
|
-elif [[ -f /usr/lib/kernel/cmdline ]]; then
|
||||||
|
- read -r -d '' -a BOOT_OPTIONS < /usr/lib/kernel/cmdline
|
||||||
|
-else
|
||||||
|
- declare -a BOOT_OPTIONS
|
||||||
|
+ if [ -n "$KERNEL_INSTALL_CONF_ROOT" ]; then
|
||||||
|
+ if [ -f "$KERNEL_INSTALL_CONF_ROOT/cmdline" ]; then
|
||||||
|
+ read -r -d '' -a BOOT_OPTIONS < "$KERNEL_INSTALL_CONF_ROOT/cmdline"
|
||||||
|
+ fi
|
||||||
|
+ elif [[ -f /etc/kernel/cmdline ]]; then
|
||||||
|
+ read -r -d '' -a BOOT_OPTIONS < /etc/kernel/cmdline
|
||||||
|
+ elif [[ -f /usr/lib/kernel/cmdline ]]; then
|
||||||
|
+ read -r -d '' -a BOOT_OPTIONS < /usr/lib/kernel/cmdline
|
||||||
|
+ else
|
||||||
|
+ declare -a BOOT_OPTIONS
|
||||||
|
|
||||||
|
- read -r -d '' -a line < /proc/cmdline
|
||||||
|
- for i in "${line[@]}"; do
|
||||||
|
- [[ ${i#initrd=*} != "$i" ]] && continue
|
||||||
|
- BOOT_OPTIONS+=("$i")
|
||||||
|
- done
|
||||||
|
-fi
|
||||||
|
+ read -r -d '' -a line < /proc/cmdline
|
||||||
|
+ for i in "${line[@]}"; do
|
||||||
|
+ [[ ${i#initrd=*} != "$i" ]] && continue
|
||||||
|
+ BOOT_OPTIONS+=("$i")
|
||||||
|
+ done
|
||||||
|
+ fi
|
||||||
|
|
||||||
|
-unset noimageifnotneeded
|
||||||
|
+ unset noimageifnotneeded
|
||||||
|
|
||||||
|
-for ((i = 0; i < "${#BOOT_OPTIONS[@]}"; i++)); do
|
||||||
|
- # shellcheck disable=SC1001
|
||||||
|
- if [[ ${BOOT_OPTIONS[$i]} == root\=PARTUUID\=* ]]; then
|
||||||
|
- noimageifnotneeded="yes"
|
||||||
|
- break
|
||||||
|
- fi
|
||||||
|
-done
|
||||||
|
+ for ((i = 0; i < "${#BOOT_OPTIONS[@]}"; i++)); do
|
||||||
|
+ # shellcheck disable=SC1001
|
||||||
|
+ if [[ ${BOOT_OPTIONS[$i]} == root\=PARTUUID\=* ]]; then
|
||||||
|
+ noimageifnotneeded="yes"
|
||||||
|
+ break
|
||||||
|
+ fi
|
||||||
|
+ done
|
||||||
|
+
|
||||||
|
+ # shellcheck disable=SC2046
|
||||||
|
+ dracut -f \
|
||||||
|
+ ${noimageifnotneeded:+--noimageifnotneeded} \
|
||||||
|
+ $([[ $KERNEL_INSTALL_VERBOSE == 1 ]] && echo --verbose) \
|
||||||
|
+ $([[ -n $KERNEL_IMAGE ]] && echo --kernel-image "$KERNEL_IMAGE") \
|
||||||
|
+ "$UEFI_OPTS" \
|
||||||
|
+ --kver "$KERNEL_VERSION" \
|
||||||
|
+ "$BOOT_DIR_ABS/$IMAGE"
|
||||||
|
+ ret=$?
|
||||||
|
+ ;;
|
||||||
|
+
|
||||||
|
+ remove)
|
||||||
|
+ rm -f -- "$BOOT_DIR_ABS/$IMAGE"
|
||||||
|
+ ret=$?
|
||||||
|
+ ;;
|
||||||
|
+esac
|
||||||
|
|
||||||
|
-# shellcheck disable=SC2046
|
||||||
|
-dracut -f \
|
||||||
|
- ${noimageifnotneeded:+--noimageifnotneeded} \
|
||||||
|
- $([[ $KERNEL_INSTALL_VERBOSE == 1 ]] && echo --verbose) \
|
||||||
|
- $([[ -n $KERNEL_IMAGE ]] && echo --kernel-image "$KERNEL_IMAGE") \
|
||||||
|
- "$UEFI_OPTS" \
|
||||||
|
- --kver "$KERNEL_VERSION" \
|
||||||
|
- "$KERNEL_INSTALL_STAGING_AREA/$IMAGE" || exit 1
|
||||||
|
+exit $ret
|
||||||
|
diff --git a/install.d/51-dracut-rescue.install b/install.d/51-dracut-rescue.install
|
||||||
|
index 25f75557..aa0ccdc5 100755
|
||||||
|
--- a/install.d/51-dracut-rescue.install
|
||||||
|
+++ b/install.d/51-dracut-rescue.install
|
||||||
|
@@ -2,29 +2,11 @@
|
||||||
|
|
||||||
|
export LANG=C
|
||||||
|
|
||||||
|
-COMMAND="${1:?}"
|
||||||
|
-KERNEL_VERSION="${2:?}"
|
||||||
|
+COMMAND="$1"
|
||||||
|
+KERNEL_VERSION="$2"
|
||||||
|
BOOT_DIR_ABS="${3%/*}/0-rescue"
|
||||||
|
KERNEL_IMAGE="$4"
|
||||||
|
|
||||||
|
-# If the initrd was provided on the kernel command line, we shouldn't generate our own.
|
||||||
|
-if [[ "$COMMAND" = "add" && "$#" -gt 4 ]]; then
|
||||||
|
- exit 0
|
||||||
|
-fi
|
||||||
|
-
|
||||||
|
-# Do not attempt to create initramfs if the supplied image is already a UKI
|
||||||
|
-if [[ "$KERNEL_INSTALL_IMAGE_TYPE" = "uki" ]]; then
|
||||||
|
- exit 0
|
||||||
|
-fi
|
||||||
|
-
|
||||||
|
-if [[ "$KERNEL_INSTALL_UKI_GENERATOR" = "dracut" ]]; then
|
||||||
|
- # Rescue images currently not compatible with UKIs
|
||||||
|
- exit 0
|
||||||
|
-elif [[ "${KERNEL_INSTALL_INITRD_GENERATOR:-dracut}" != "dracut" ]]; then
|
||||||
|
- # We are not the initrd generator
|
||||||
|
- exit 0
|
||||||
|
-fi
|
||||||
|
-
|
||||||
|
dropindirs_sort() {
|
||||||
|
suffix=$1
|
||||||
|
shift
|
||||||
|
--
|
||||||
|
2.42.0
|
||||||
|
|
@ -0,0 +1,96 @@
|
|||||||
|
From c6d18c3c71597e78572378fc4dde391f1845b8bd Mon Sep 17 00:00:00 2001
|
||||||
|
From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= <zbyszek@in.waw.pl>
|
||||||
|
Date: Tue, 18 Jan 2022 18:08:42 +0100
|
||||||
|
Subject: [PATCH 04/24] feat(kernel-install): do nothing when
|
||||||
|
$KERNEL_INSTALL_INITRD_GENERATOR says so
|
||||||
|
|
||||||
|
dracut may be installed without being actually used. This is very common in
|
||||||
|
binary distros where a package may be pulled in through dependencies, even
|
||||||
|
though the user does not need it in a particular setup. KERNEL_INSTALL_INITRD_GENERATOR
|
||||||
|
is being added in systemd's kernel-install to select which of the possibly many
|
||||||
|
initrd generation mechanisms will be used.
|
||||||
|
|
||||||
|
For backwards compat, if it not set, continue as before. But if set to
|
||||||
|
something else, skip our kernel-install plugins.
|
||||||
|
|
||||||
|
(Cherry-picked commit f47bcdd7342ca0d46b889e712a1c7446e18434bc from PR#1825)
|
||||||
|
---
|
||||||
|
install.d/50-dracut.install | 31 ++++++------------------------
|
||||||
|
install.d/51-dracut-rescue.install | 12 +++++++++---
|
||||||
|
2 files changed, 15 insertions(+), 28 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/install.d/50-dracut.install b/install.d/50-dracut.install
|
||||||
|
index 441414ac..efb184cd 100755
|
||||||
|
--- a/install.d/50-dracut.install
|
||||||
|
+++ b/install.d/50-dracut.install
|
||||||
|
@@ -6,38 +6,19 @@ BOOT_DIR_ABS="$3"
|
||||||
|
KERNEL_IMAGE="$4"
|
||||||
|
|
||||||
|
# If KERNEL_INSTALL_MACHINE_ID is defined but empty, BOOT_DIR_ABS is a fake directory.
|
||||||
|
-# So, let's skip to create initrd.
|
||||||
|
+# In this case, do not create the initrd.
|
||||||
|
if ! [[ ${KERNEL_INSTALL_MACHINE_ID-x} ]]; then
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
-# Do not attempt to create initramfs if the supplied image is already a UKI
|
||||||
|
-if [[ "$KERNEL_INSTALL_IMAGE_TYPE" = "uki" ]]; then
|
||||||
|
+# Skip this plugin if we're using a different generator. If nothing is specified,
|
||||||
|
+# assume we're wanted since we're installed.
|
||||||
|
+if [ "${KERNEL_INSTALL_INITRD_GENERATOR:-dracut}" != "dracut" ]; then
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
-# Mismatching the install layout and the --uefi/--no-uefi opts just creates a mess.
|
||||||
|
-if [[ $KERNEL_INSTALL_LAYOUT == "uki" && -n $KERNEL_INSTALL_STAGING_AREA ]]; then
|
||||||
|
- BOOT_DIR_ABS="$KERNEL_INSTALL_STAGING_AREA"
|
||||||
|
- if [[ -z $KERNEL_INSTALL_UKI_GENERATOR || $KERNEL_INSTALL_UKI_GENERATOR == "dracut" ]]; then
|
||||||
|
- # No uki generator preference set or we have been chosen
|
||||||
|
- IMAGE="uki.efi"
|
||||||
|
- UEFI_OPTS="--uefi"
|
||||||
|
- elif [[ -z $KERNEL_INSTALL_INITRD_GENERATOR || $KERNEL_INSTALL_INITRD_GENERATOR == "dracut" ]]; then
|
||||||
|
- # We aren't the uki generator, but we have been requested to make the initrd
|
||||||
|
- IMAGE="initrd"
|
||||||
|
- UEFI_OPTS="--no-uefi"
|
||||||
|
- else
|
||||||
|
- exit 0
|
||||||
|
- fi
|
||||||
|
-elif [[ $KERNEL_INSTALL_LAYOUT == "bls" && -n $KERNEL_INSTALL_STAGING_AREA ]]; then
|
||||||
|
- BOOT_DIR_ABS="$KERNEL_INSTALL_STAGING_AREA"
|
||||||
|
- if [[ -z $KERNEL_INSTALL_INITRD_GENERATOR || $KERNEL_INSTALL_INITRD_GENERATOR == "dracut" ]]; then
|
||||||
|
- IMAGE="initrd"
|
||||||
|
- UEFI_OPTS="--no-uefi"
|
||||||
|
- else
|
||||||
|
- exit 0
|
||||||
|
- fi
|
||||||
|
+if [[ -d "$BOOT_DIR_ABS" ]]; then
|
||||||
|
+ INITRD="initrd"
|
||||||
|
else
|
||||||
|
# No layout information, use users --uefi/--no-uefi preference
|
||||||
|
UEFI_OPTS=""
|
||||||
|
diff --git a/install.d/51-dracut-rescue.install b/install.d/51-dracut-rescue.install
|
||||||
|
index aa0ccdc5..be4172b5 100755
|
||||||
|
--- a/install.d/51-dracut-rescue.install
|
||||||
|
+++ b/install.d/51-dracut-rescue.install
|
||||||
|
@@ -7,9 +7,15 @@ KERNEL_VERSION="$2"
|
||||||
|
BOOT_DIR_ABS="${3%/*}/0-rescue"
|
||||||
|
KERNEL_IMAGE="$4"
|
||||||
|
|
||||||
|
-dropindirs_sort() {
|
||||||
|
- suffix=$1
|
||||||
|
- shift
|
||||||
|
+# Skip this plugin if we're using a different generator. If nothing is specified,
|
||||||
|
+# assume we're wanted since we're installed.
|
||||||
|
+if [ "${KERNEL_INSTALL_INITRD_GENERATOR:-dracut}" != "dracut" ]; then
|
||||||
|
+ exit 0
|
||||||
|
+fi
|
||||||
|
+
|
||||||
|
+dropindirs_sort()
|
||||||
|
+{
|
||||||
|
+ suffix=$1; shift
|
||||||
|
args=("$@")
|
||||||
|
files=$(
|
||||||
|
while (($# > 0)); do
|
||||||
|
--
|
||||||
|
2.42.0
|
||||||
|
|
@ -0,0 +1,39 @@
|
|||||||
|
From 1bd81956dc050db071c5885cfbcde393370468ae Mon Sep 17 00:00:00 2001
|
||||||
|
From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= <zbyszek@in.waw.pl>
|
||||||
|
Date: Tue, 18 Jan 2022 18:58:58 +0100
|
||||||
|
Subject: [PATCH 05/24] fix(kernel-install): do not generate an initrd when one
|
||||||
|
was specified
|
||||||
|
|
||||||
|
According to the synopsis, kernel-install can be called with an
|
||||||
|
already-prepared initrd. In that case, no initrd should be generated by dracut.
|
||||||
|
|
||||||
|
(Cherry-picked commit 0b72cf5c4eca0e0db76e3e210cfdc48e6b49bb74 from PR#1825)
|
||||||
|
---
|
||||||
|
install.d/50-dracut.install | 4 ++++
|
||||||
|
1 file changed, 4 insertions(+)
|
||||||
|
|
||||||
|
diff --git a/install.d/50-dracut.install b/install.d/50-dracut.install
|
||||||
|
index efb184cd..3907e303 100755
|
||||||
|
--- a/install.d/50-dracut.install
|
||||||
|
+++ b/install.d/50-dracut.install
|
||||||
|
@@ -4,6 +4,7 @@ COMMAND="$1"
|
||||||
|
KERNEL_VERSION="$2"
|
||||||
|
BOOT_DIR_ABS="$3"
|
||||||
|
KERNEL_IMAGE="$4"
|
||||||
|
+INITRD_OPTIONS_SHIFT=4
|
||||||
|
|
||||||
|
# If KERNEL_INSTALL_MACHINE_ID is defined but empty, BOOT_DIR_ABS is a fake directory.
|
||||||
|
# In this case, do not create the initrd.
|
||||||
|
@@ -34,6 +35,9 @@ ret=0
|
||||||
|
|
||||||
|
case "$COMMAND" in
|
||||||
|
add)
|
||||||
|
+ # If the initrd was provided on the kernel command line, we shouldn't generate our own.
|
||||||
|
+ [ "$#" -gt "$INITRD_OPTIONS_SHIFT" ] && exit 0
|
||||||
|
+
|
||||||
|
if [[ $IMAGE == "uki.efi" ]]; then
|
||||||
|
IMAGE_PREGENERATED=${KERNEL_IMAGE%/*}/uki.efi
|
||||||
|
else
|
||||||
|
--
|
||||||
|
2.42.0
|
||||||
|
|
@ -0,0 +1,25 @@
|
|||||||
|
From 6cb58e86ae65cf9922023b12e889446323a89080 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Laszlo Gombos <laszlo.gombos@gmail.com>
|
||||||
|
Date: Sat, 15 Jun 2024 15:21:44 -0400
|
||||||
|
Subject: [PATCH 06/24] fix(crypt): decryption when rd.luks.name is set
|
||||||
|
|
||||||
|
---
|
||||||
|
modules.d/90crypt/parse-crypt.sh | 2 +-
|
||||||
|
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||||
|
|
||||||
|
diff --git a/modules.d/90crypt/parse-crypt.sh b/modules.d/90crypt/parse-crypt.sh
|
||||||
|
index 39fc6d21..9567a4a9 100755
|
||||||
|
--- a/modules.d/90crypt/parse-crypt.sh
|
||||||
|
+++ b/modules.d/90crypt/parse-crypt.sh
|
||||||
|
@@ -174,7 +174,7 @@ else
|
||||||
|
} >> "$hookdir/emergency/90-crypt.sh"
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
- elif getargbool 1 rd.auto; then
|
||||||
|
+ elif getargbool 1 rd.auto && [ -z "$(getargs rd.luks.name)" ]; then
|
||||||
|
if [ -z "$DRACUT_SYSTEMD" ]; then
|
||||||
|
{
|
||||||
|
printf -- 'ENV{ID_FS_TYPE}=="crypto_LUKS", RUN+="%s ' "$(command -v initqueue)"
|
||||||
|
--
|
||||||
|
2.42.0
|
||||||
|
|
@ -0,0 +1,75 @@
|
|||||||
|
From 30e7870504d09183bb9d99ed04f148c7dfb0c645 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Pavel Valena <pvalena@redhat.com>
|
||||||
|
Date: Thu, 11 Jul 2024 07:33:05 +0200
|
||||||
|
Subject: [PATCH 07/24] fix: incorrectly applied patch in commit
|
||||||
|
c6d18c3c71597e78572378fc4dde391f1845b8
|
||||||
|
|
||||||
|
named: "feat(kernel-install): do nothing when $KERNEL_INSTALL_INITRD_GENERATOR says so"
|
||||||
|
|
||||||
|
Resolves: rhbz#2276271
|
||||||
|
---
|
||||||
|
install.d/50-dracut.install | 30 ++++++++++++++++++++++++++++--
|
||||||
|
install.d/51-dracut-rescue.install | 6 +++---
|
||||||
|
2 files changed, 31 insertions(+), 5 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/install.d/50-dracut.install b/install.d/50-dracut.install
|
||||||
|
index 3907e303..076b4f5e 100755
|
||||||
|
--- a/install.d/50-dracut.install
|
||||||
|
+++ b/install.d/50-dracut.install
|
||||||
|
@@ -18,8 +18,34 @@ if [ "${KERNEL_INSTALL_INITRD_GENERATOR:-dracut}" != "dracut" ]; then
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
-if [[ -d "$BOOT_DIR_ABS" ]]; then
|
||||||
|
- INITRD="initrd"
|
||||||
|
+# Do not attempt to create initramfs if the supplied image is already a UKI
|
||||||
|
+if [[ "$KERNEL_INSTALL_IMAGE_TYPE" = "uki" ]]; then
|
||||||
|
+ exit 0
|
||||||
|
+fi
|
||||||
|
+
|
||||||
|
+# Mismatching the install layout and the --uefi/--no-uefi opts just creates a mess.
|
||||||
|
+if [[ $KERNEL_INSTALL_LAYOUT == "uki" && -n $KERNEL_INSTALL_STAGING_AREA ]]; then
|
||||||
|
+ BOOT_DIR_ABS="$KERNEL_INSTALL_STAGING_AREA"
|
||||||
|
+ if [[ -z $KERNEL_INSTALL_UKI_GENERATOR || $KERNEL_INSTALL_UKI_GENERATOR == "dracut" ]]; then
|
||||||
|
+ # No uki generator preference set or we have been chosen
|
||||||
|
+ IMAGE="uki.efi"
|
||||||
|
+ UEFI_OPTS="--uefi"
|
||||||
|
+ elif [[ -z $KERNEL_INSTALL_INITRD_GENERATOR || $KERNEL_INSTALL_INITRD_GENERATOR == "dracut" ]]; then
|
||||||
|
+ # We aren't the uki generator, but we have been requested to make the initrd
|
||||||
|
+ IMAGE="initrd"
|
||||||
|
+ UEFI_OPTS="--no-uefi"
|
||||||
|
+ else
|
||||||
|
+ exit 0
|
||||||
|
+ fi
|
||||||
|
+elif [[ $KERNEL_INSTALL_LAYOUT == "bls" && -n $KERNEL_INSTALL_STAGING_AREA ]]; then
|
||||||
|
+ BOOT_DIR_ABS="$KERNEL_INSTALL_STAGING_AREA"
|
||||||
|
+ if [[ -z $KERNEL_INSTALL_INITRD_GENERATOR || $KERNEL_INSTALL_INITRD_GENERATOR == "dracut" ]]; then
|
||||||
|
+ IMAGE="initrd"
|
||||||
|
+ UEFI_OPTS="--no-uefi"
|
||||||
|
+ else
|
||||||
|
+ exit 0
|
||||||
|
+ fi
|
||||||
|
+
|
||||||
|
else
|
||||||
|
# No layout information, use users --uefi/--no-uefi preference
|
||||||
|
UEFI_OPTS=""
|
||||||
|
diff --git a/install.d/51-dracut-rescue.install b/install.d/51-dracut-rescue.install
|
||||||
|
index be4172b5..5310229e 100755
|
||||||
|
--- a/install.d/51-dracut-rescue.install
|
||||||
|
+++ b/install.d/51-dracut-rescue.install
|
||||||
|
@@ -13,9 +13,9 @@ if [ "${KERNEL_INSTALL_INITRD_GENERATOR:-dracut}" != "dracut" ]; then
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
-dropindirs_sort()
|
||||||
|
-{
|
||||||
|
- suffix=$1; shift
|
||||||
|
+dropindirs_sort() {
|
||||||
|
+ suffix=$1
|
||||||
|
+ shift
|
||||||
|
args=("$@")
|
||||||
|
files=$(
|
||||||
|
while (($# > 0)); do
|
||||||
|
--
|
||||||
|
2.42.0
|
||||||
|
|
@ -0,0 +1,29 @@
|
|||||||
|
From 93937d805f8166d9f708f9163fc93839fc1437d3 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Pavel Valena <pvalena@redhat.com>
|
||||||
|
Date: Thu, 11 Jul 2024 16:24:14 +0200
|
||||||
|
Subject: [PATCH 08/24] revert: "fix(crypt): unlock encrypted devices by
|
||||||
|
default during boot"
|
||||||
|
|
||||||
|
This reverts commit 2339acfaeee60d6bb26a1103db2e53bc8f9cb2d1.
|
||||||
|
|
||||||
|
Resolves: rhbz#2295215
|
||||||
|
---
|
||||||
|
modules.d/90crypt/parse-crypt.sh | 2 +-
|
||||||
|
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||||
|
|
||||||
|
diff --git a/modules.d/90crypt/parse-crypt.sh b/modules.d/90crypt/parse-crypt.sh
|
||||||
|
index 9567a4a9..e46e347a 100755
|
||||||
|
--- a/modules.d/90crypt/parse-crypt.sh
|
||||||
|
+++ b/modules.d/90crypt/parse-crypt.sh
|
||||||
|
@@ -174,7 +174,7 @@ else
|
||||||
|
} >> "$hookdir/emergency/90-crypt.sh"
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
- elif getargbool 1 rd.auto && [ -z "$(getargs rd.luks.name)" ]; then
|
||||||
|
+ elif getargbool 0 rd.auto; then
|
||||||
|
if [ -z "$DRACUT_SYSTEMD" ]; then
|
||||||
|
{
|
||||||
|
printf -- 'ENV{ID_FS_TYPE}=="crypto_LUKS", RUN+="%s ' "$(command -v initqueue)"
|
||||||
|
--
|
||||||
|
2.42.0
|
||||||
|
|
@ -0,0 +1,33 @@
|
|||||||
|
From e02ef9afa1ede698623f25d5694949e9b4fedb4e Mon Sep 17 00:00:00 2001
|
||||||
|
From: Pavel Valena <pvalena@redhat.com>
|
||||||
|
Date: Tue, 6 Dec 2022 21:46:01 +0100
|
||||||
|
Subject: [PATCH 09/24] fix(90kernel-modules): install blk modules using symbol
|
||||||
|
blk_alloc_disk
|
||||||
|
|
||||||
|
Corresponding kernel symbol blk_cleanup_disk is no longer used in the nvdimm
|
||||||
|
driver and calls are made directly instead.
|
||||||
|
|
||||||
|
blk_alloc_disk is used:
|
||||||
|
https://elixir.bootlin.com/linux/v6.1-rc8/source/drivers/nvdimm/pmem.c#L522
|
||||||
|
|
||||||
|
Resolves: RHEL-32237
|
||||||
|
---
|
||||||
|
modules.d/90kernel-modules/module-setup.sh | 2 +-
|
||||||
|
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||||
|
|
||||||
|
diff --git a/modules.d/90kernel-modules/module-setup.sh b/modules.d/90kernel-modules/module-setup.sh
|
||||||
|
index ec60f393..89f33231 100755
|
||||||
|
--- a/modules.d/90kernel-modules/module-setup.sh
|
||||||
|
+++ b/modules.d/90kernel-modules/module-setup.sh
|
||||||
|
@@ -2,7 +2,7 @@
|
||||||
|
|
||||||
|
# called by dracut
|
||||||
|
installkernel() {
|
||||||
|
- local _blockfuncs='ahci_platform_get_resources|ata_scsi_ioctl|scsi_add_host|blk_cleanup_queue|register_mtd_blktrans|scsi_esp_register|register_virtio_device|usb_stor_disconnect|mmc_add_host|sdhci_add_host|scsi_add_host_with_dma|blk_mq_alloc_disk|blk_mq_alloc_request|blk_mq_destroy_queue|blk_cleanup_disk'
|
||||||
|
+ local _blockfuncs='ahci_platform_get_resources|ata_scsi_ioctl|scsi_add_host|blk_cleanup_queue|register_mtd_blktrans|scsi_esp_register|register_virtio_device|usb_stor_disconnect|mmc_add_host|sdhci_add_host|scsi_add_host_with_dma|blk_alloc_disk|blk_mq_alloc_disk|blk_mq_alloc_request|blk_mq_destroy_queue|blk_cleanup_disk'
|
||||||
|
local -A _hostonly_drvs
|
||||||
|
|
||||||
|
record_block_dev_drv() {
|
||||||
|
--
|
||||||
|
2.42.0
|
||||||
|
|
@ -0,0 +1,30 @@
|
|||||||
|
From aded658821983ba7d92def26793813c1b3a83475 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Laszlo Gombos <laszlo.gombos@gmail.com>
|
||||||
|
Date: Sat, 20 Jul 2024 18:49:38 -0400
|
||||||
|
Subject: [PATCH 10/24] test: do not force include dash, let sh module make a
|
||||||
|
selection
|
||||||
|
|
||||||
|
This is important for alpine, so that it does not install both
|
||||||
|
dash and busybox dracut modules that are potentially conflicting.
|
||||||
|
|
||||||
|
(cherry picked from commit 6e3c2bf9d01ad0f93176ee121bb70404f24de4e7)
|
||||||
|
---
|
||||||
|
modules.d/80test-makeroot/module-setup.sh | 2 +-
|
||||||
|
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||||
|
|
||||||
|
diff --git a/modules.d/80test-makeroot/module-setup.sh b/modules.d/80test-makeroot/module-setup.sh
|
||||||
|
index f311e4a0..fc105d7e 100755
|
||||||
|
--- a/modules.d/80test-makeroot/module-setup.sh
|
||||||
|
+++ b/modules.d/80test-makeroot/module-setup.sh
|
||||||
|
@@ -6,7 +6,7 @@ check() {
|
||||||
|
}
|
||||||
|
|
||||||
|
depends() {
|
||||||
|
- echo "dash rootfs-block kernel-modules qemu"
|
||||||
|
+ echo "rootfs-block kernel-modules qemu"
|
||||||
|
}
|
||||||
|
|
||||||
|
installkernel() {
|
||||||
|
--
|
||||||
|
2.42.0
|
||||||
|
|
@ -0,0 +1,31 @@
|
|||||||
|
From a891ae527aaf3c015d3b4b0290655b89fdf8f03d Mon Sep 17 00:00:00 2001
|
||||||
|
From: Pavel Valena <pvalena@redhat.com>
|
||||||
|
Date: Thu, 8 Aug 2024 01:30:50 +0200
|
||||||
|
Subject: [PATCH 11/24] fix(dracut-functions): allow for \ in get_maj_min file
|
||||||
|
path
|
||||||
|
|
||||||
|
as the path might be f.e. /dev/disk/by-partlabel/EFI\x20System\x20Partition
|
||||||
|
|
||||||
|
which would produce Warning 'grep: warning: stray \ before x' in get_maj_min
|
||||||
|
|
||||||
|
Resolves: RHEL-47145
|
||||||
|
---
|
||||||
|
dracut-functions.sh | 2 +-
|
||||||
|
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||||
|
|
||||||
|
diff --git a/dracut-functions.sh b/dracut-functions.sh
|
||||||
|
index f9e5d3bc..c8cb2e15 100755
|
||||||
|
--- a/dracut-functions.sh
|
||||||
|
+++ b/dracut-functions.sh
|
||||||
|
@@ -243,7 +243,7 @@ get_maj_min() {
|
||||||
|
local _out
|
||||||
|
|
||||||
|
if [[ $get_maj_min_cache_file ]]; then
|
||||||
|
- _out="$(grep -m1 -oE "^$1 \S+$" "$get_maj_min_cache_file" | awk '{print $NF}')"
|
||||||
|
+ _out="$(grep -m1 -oE "^${1//\\/\\\\} \S+$" "$get_maj_min_cache_file" | awk '{print $NF}')"
|
||||||
|
fi
|
||||||
|
|
||||||
|
if ! [[ "$_out" ]]; then
|
||||||
|
--
|
||||||
|
2.42.0
|
||||||
|
|
@ -0,0 +1,42 @@
|
|||||||
|
From 821ffb39cd0c3003b2711d30302b713ab9b5da9b Mon Sep 17 00:00:00 2001
|
||||||
|
From: Fabian Vogt <fvogt@suse.de>
|
||||||
|
Date: Mon, 5 Aug 2024 11:28:32 +0200
|
||||||
|
Subject: [PATCH 12/24] fix(dracut-functions.sh): only return block devices
|
||||||
|
from get_persistent_dev
|
||||||
|
|
||||||
|
With udev 256, there are now directories such as
|
||||||
|
/dev/disk/by-path/pci-0000:02:00.0-nvme-1-part/ which match here.
|
||||||
|
|
||||||
|
In case a nonexisting file/device was passed to get_persistent_dev, it
|
||||||
|
returned the first directory it looked at because both have maj:min 0:0.
|
||||||
|
This accidental conversion from garbage to a sensible looking path leads
|
||||||
|
to weird behaviour later.
|
||||||
|
|
||||||
|
Instead of filtering out directories explicitly switch the check to only
|
||||||
|
return block devices, which also takes care of the character special
|
||||||
|
/dev/mapper/control.
|
||||||
|
|
||||||
|
(cherry picked from commit 55d2fb5b459f356fdbde60ddefb97be942a0c141)
|
||||||
|
|
||||||
|
Resolves: RHEL-49744
|
||||||
|
---
|
||||||
|
dracut-functions.sh | 3 +--
|
||||||
|
1 file changed, 1 insertion(+), 2 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/dracut-functions.sh b/dracut-functions.sh
|
||||||
|
index c8cb2e15..43d905e3 100755
|
||||||
|
--- a/dracut-functions.sh
|
||||||
|
+++ b/dracut-functions.sh
|
||||||
|
@@ -294,8 +294,7 @@ get_persistent_dev() {
|
||||||
|
/dev/disk/by-partlabel/* \
|
||||||
|
/dev/disk/by-id/* \
|
||||||
|
/dev/disk/by-path/*; do
|
||||||
|
- [[ -e $i ]] || continue
|
||||||
|
- [[ $i == /dev/mapper/control ]] && continue
|
||||||
|
+ [[ -b $i ]] || continue
|
||||||
|
[[ $i == /dev/mapper/mpath* ]] && continue
|
||||||
|
_tmp=$(get_maj_min "$i")
|
||||||
|
if [ "$_tmp" = "$_dev" ]; then
|
||||||
|
--
|
||||||
|
2.42.0
|
||||||
|
|
@ -0,0 +1,112 @@
|
|||||||
|
From 3e4a22f2b72d0723fd43ca917b8aa9003c6c7f8f Mon Sep 17 00:00:00 2001
|
||||||
|
From: Pavel Valena <pvalena@redhat.com>
|
||||||
|
Date: Wed, 12 Jun 2024 06:06:32 +0200
|
||||||
|
Subject: [PATCH 13/24] feat(systemd*): include systemd config files from
|
||||||
|
/usr/lib/systemd
|
||||||
|
|
||||||
|
and also use proper variables for the paths, and fixup invalid paths.
|
||||||
|
--
|
||||||
|
|
||||||
|
The new systemd reads from both /etc and /usr/, so to accomodate this,
|
||||||
|
I've added new paths to install configs from (I probably haven't covered
|
||||||
|
all). This changes only hostonly behaviour; uses global variables:
|
||||||
|
|
||||||
|
systemdutilconfdir: "/etc/systemd"
|
||||||
|
systemdutildir: "/lib/systemd:/lib/systemd/systemd-udevd" "/usr/lib/systemd:/usr/lib/systemd/systemd-udevd"
|
||||||
|
|
||||||
|
(cherry picked from commit ea4905e944a2acd75ba3a48a5dfeaba417f724e8)
|
||||||
|
|
||||||
|
Resolves: RHEL-32506
|
||||||
|
---
|
||||||
|
modules.d/00systemd/module-setup.sh | 6 ++++--
|
||||||
|
modules.d/01systemd-coredump/module-setup.sh | 3 ++-
|
||||||
|
modules.d/01systemd-pstore/module-setup.sh | 2 ++
|
||||||
|
modules.d/01systemd-resolved/module-setup.sh | 1 +
|
||||||
|
modules.d/01systemd-timesyncd/module-setup.sh | 1 +
|
||||||
|
5 files changed, 10 insertions(+), 3 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/modules.d/00systemd/module-setup.sh b/modules.d/00systemd/module-setup.sh
|
||||||
|
index d173c99f..0f151289 100755
|
||||||
|
--- a/modules.d/00systemd/module-setup.sh
|
||||||
|
+++ b/modules.d/00systemd/module-setup.sh
|
||||||
|
@@ -42,6 +42,8 @@ install() {
|
||||||
|
"$systemdutildir"/system-generators/systemd-debug-generator \
|
||||||
|
"$systemdutildir"/system-generators/systemd-fstab-generator \
|
||||||
|
"$systemdutildir"/system-generators/systemd-gpt-auto-generator \
|
||||||
|
+ "$systemdutildir"/system.conf \
|
||||||
|
+ "$systemdutildir"/system.conf.d/*.conf \
|
||||||
|
"$systemdsystemunitdir"/debug-shell.service \
|
||||||
|
"$systemdsystemunitdir"/cryptsetup.target \
|
||||||
|
"$systemdsystemunitdir"/cryptsetup-pre.target \
|
||||||
|
@@ -94,8 +96,8 @@ install() {
|
||||||
|
|
||||||
|
if [[ $hostonly ]]; then
|
||||||
|
inst_multiple -H -o \
|
||||||
|
- /etc/systemd/system.conf \
|
||||||
|
- /etc/systemd/system.conf.d/*.conf \
|
||||||
|
+ "$systemdutilconfdir"/system.conf \
|
||||||
|
+ "$systemdutilconfdir"/system.conf.d/*.conf \
|
||||||
|
/etc/hosts \
|
||||||
|
/etc/hostname \
|
||||||
|
/etc/nsswitch.conf \
|
||||||
|
diff --git a/modules.d/01systemd-coredump/module-setup.sh b/modules.d/01systemd-coredump/module-setup.sh
|
||||||
|
index 47666b6c..17deb088 100755
|
||||||
|
--- a/modules.d/01systemd-coredump/module-setup.sh
|
||||||
|
+++ b/modules.d/01systemd-coredump/module-setup.sh
|
||||||
|
@@ -33,6 +33,7 @@ install() {
|
||||||
|
inst_multiple -o \
|
||||||
|
"$sysctld"/50-coredump.conf \
|
||||||
|
"$systemdutildir"/coredump.conf \
|
||||||
|
+ "$systemdutildir/coredump.conf.d/*.conf" \
|
||||||
|
"$systemdutildir"/systemd-coredump \
|
||||||
|
"$systemdsystemunitdir"/systemd-coredump.socket \
|
||||||
|
"$systemdsystemunitdir"/systemd-coredump@.service \
|
||||||
|
@@ -51,7 +52,7 @@ install() {
|
||||||
|
if [[ $hostonly ]]; then
|
||||||
|
inst_multiple -H -o \
|
||||||
|
"$systemdutilconfdir"/coredump.conf \
|
||||||
|
- "$systemdsystemconfdir/coredump.conf.d/*.conf" \
|
||||||
|
+ "$systemdutilconfdir/coredump.conf.d/*.conf" \
|
||||||
|
"$systemdsystemconfdir"/systemd-coredump.socket \
|
||||||
|
"$systemdsystemconfdir/systemd-coredump.socket.d/*.conf" \
|
||||||
|
"$systemdsystemconfdir"/systemd-coredump@.service \
|
||||||
|
diff --git a/modules.d/01systemd-pstore/module-setup.sh b/modules.d/01systemd-pstore/module-setup.sh
|
||||||
|
index 67034bbf..5de5db4b 100755
|
||||||
|
--- a/modules.d/01systemd-pstore/module-setup.sh
|
||||||
|
+++ b/modules.d/01systemd-pstore/module-setup.sh
|
||||||
|
@@ -34,6 +34,8 @@ install() {
|
||||||
|
inst_dir /var/lib/systemd/pstore
|
||||||
|
inst_multiple -o \
|
||||||
|
"$tmpfilesdir/systemd-pstore.conf" \
|
||||||
|
+ "$systemdutildir"/pstore.conf \
|
||||||
|
+ "$systemdutildir/pstore.conf.d/*.conf" \
|
||||||
|
"$systemdutildir"/systemd-pstore \
|
||||||
|
"$systemdsystemunitdir"/systemd-pstore.service \
|
||||||
|
"$systemdsystemunitdir/systemd-pstore.service.d/*.conf"
|
||||||
|
diff --git a/modules.d/01systemd-resolved/module-setup.sh b/modules.d/01systemd-resolved/module-setup.sh
|
||||||
|
index 0c2e8c28..7b4b26e8 100755
|
||||||
|
--- a/modules.d/01systemd-resolved/module-setup.sh
|
||||||
|
+++ b/modules.d/01systemd-resolved/module-setup.sh
|
||||||
|
@@ -49,6 +49,7 @@ install() {
|
||||||
|
# Install the hosts local user configurations if enabled.
|
||||||
|
if [[ $hostonly ]]; then
|
||||||
|
inst_multiple -H -o \
|
||||||
|
+ "$systemdutilconfdir"/resolv.conf \
|
||||||
|
"$systemdutilconfdir"/resolved.conf \
|
||||||
|
"$systemdutilconfdir/resolved.conf.d/*.conf" \
|
||||||
|
"$systemdsystemconfdir"/systemd-resolved.service \
|
||||||
|
diff --git a/modules.d/01systemd-timesyncd/module-setup.sh b/modules.d/01systemd-timesyncd/module-setup.sh
|
||||||
|
index a2c67540..77f7b113 100755
|
||||||
|
--- a/modules.d/01systemd-timesyncd/module-setup.sh
|
||||||
|
+++ b/modules.d/01systemd-timesyncd/module-setup.sh
|
||||||
|
@@ -38,6 +38,7 @@ install() {
|
||||||
|
"$systemdntpunits/*.list" \
|
||||||
|
"$systemdutildir"/systemd-timesyncd \
|
||||||
|
"$systemdutildir"/systemd-time-wait-sync \
|
||||||
|
+ "$systemdutildir"/timesyncd.conf \
|
||||||
|
"$systemdutildir/timesyncd.conf.d/*.conf" \
|
||||||
|
"$systemdsystemunitdir"/systemd-timesyncd.service \
|
||||||
|
"$systemdsystemunitdir/systemd-timesyncd.service.d/*.conf" \
|
||||||
|
--
|
||||||
|
2.42.0
|
||||||
|
|
@ -0,0 +1,34 @@
|
|||||||
|
From 53d78f4eb236500465279c424c296ff576421c7c Mon Sep 17 00:00:00 2001
|
||||||
|
From: Pavel Valena <pvalena@redhat.com>
|
||||||
|
Date: Thu, 8 Aug 2024 00:21:12 +0200
|
||||||
|
Subject: [PATCH 14/24] fix(resume): always include the resume module
|
||||||
|
|
||||||
|
as we can't determine with certainity that it won't be needed.
|
||||||
|
|
||||||
|
rhel-only
|
||||||
|
|
||||||
|
Resolves: RHEL-53350
|
||||||
|
---
|
||||||
|
modules.d/95resume/module-setup.sh | 5 +++++
|
||||||
|
1 file changed, 5 insertions(+)
|
||||||
|
|
||||||
|
diff --git a/modules.d/95resume/module-setup.sh b/modules.d/95resume/module-setup.sh
|
||||||
|
index d419566e..c0f04a6c 100755
|
||||||
|
--- a/modules.d/95resume/module-setup.sh
|
||||||
|
+++ b/modules.d/95resume/module-setup.sh
|
||||||
|
@@ -1,7 +1,12 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
# called by dracut
|
||||||
|
+# shellcheck disable=SC2317
|
||||||
|
check() {
|
||||||
|
+
|
||||||
|
+ # Always include resume module
|
||||||
|
+ return 0
|
||||||
|
+
|
||||||
|
swap_on_netdevice() {
|
||||||
|
local _dev
|
||||||
|
for _dev in "${swap_devs[@]}"; do
|
||||||
|
--
|
||||||
|
2.42.0
|
||||||
|
|
@ -0,0 +1,197 @@
|
|||||||
|
From b8b7e0245bb3c645b45d4a31847ed227a8431ec8 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Philipp Rudo <prudo@redhat.com>
|
||||||
|
Date: Mon, 22 Jul 2024 16:46:47 +0200
|
||||||
|
Subject: [PATCH 15/24] feat(dracut-init.sh): allow changing the destination
|
||||||
|
directory for inst et al
|
||||||
|
|
||||||
|
When using 99squash dracut actually builds two separate initrds. The
|
||||||
|
"normal" one, that gets squashed into a squashfs image, and a
|
||||||
|
"minimalistic" one, whose only task is to mount and switch_root to the
|
||||||
|
squashfs image.
|
||||||
|
|
||||||
|
This is currently done the following way:
|
||||||
|
1. Skipp install() for 99squash during the "normal" installation phase.
|
||||||
|
2. Trigger a special postinstall hook in 99squash that moves the content
|
||||||
|
of $initdir to $squashdir and installs the "minimalistic" initrd to
|
||||||
|
$initdir.
|
||||||
|
3. Strip the binaries in $initdir (of which $squashdir is a sub
|
||||||
|
directory of).
|
||||||
|
4. Squash the content of $squashdir into the squashfs image and remove
|
||||||
|
$squashdir.
|
||||||
|
|
||||||
|
The problem with this approach is that the steps 2 and 4 specific to
|
||||||
|
99squash but need to be done in dracut.sh. Thus a lot of special
|
||||||
|
handling for 99squash is needed in dracut.sh. This will get even more
|
||||||
|
complex once support for different filesystem images, e.g. erofs, are
|
||||||
|
implemented.
|
||||||
|
|
||||||
|
In order to be able to move most of the functionality into 99squash
|
||||||
|
itself a new approach will be chosen, i.e.
|
||||||
|
1. During the installation phase install the "normal" initrd into
|
||||||
|
$initdir and the "minimalistic" initrd into $squashdir.
|
||||||
|
2. Strip the binaries in $initdir.
|
||||||
|
3. Trigger a special postinstall hook in 99squash that squashes the
|
||||||
|
content of $initdir (excluding $squashdir) into the squashfs image,
|
||||||
|
removes the content of $intidir (excluding $suqashdir) and, moves the
|
||||||
|
content of $squashdir into $initdir.
|
||||||
|
|
||||||
|
With that the only special handling remaining in dracut.sh is triggering
|
||||||
|
the postinstall hook.
|
||||||
|
|
||||||
|
However, in inst et al. the destination directory is hard coded to
|
||||||
|
$initdir. Thus allow setting a different destination directory in inst
|
||||||
|
et al. to get the new approach to work. For the time being only do that
|
||||||
|
for the functions required by 99squash.
|
||||||
|
|
||||||
|
Signed-off-by: Philipp Rudo <prudo@redhat.com>
|
||||||
|
|
||||||
|
(cherry picked from commit 5ab4470cf136c2d9983564b84b49fd700d4b8514)
|
||||||
|
|
||||||
|
Related: RHEL-43460
|
||||||
|
---
|
||||||
|
dracut-init.sh | 40 +++++++++++++++++++++++++---------------
|
||||||
|
1 file changed, 25 insertions(+), 15 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/dracut-init.sh b/dracut-init.sh
|
||||||
|
index 863df0cb..58e657b5 100755
|
||||||
|
--- a/dracut-init.sh
|
||||||
|
+++ b/dracut-init.sh
|
||||||
|
@@ -240,34 +240,36 @@ inst_dir() {
|
||||||
|
}
|
||||||
|
|
||||||
|
inst() {
|
||||||
|
+ local dstdir="${dstdir:-"$initdir"}"
|
||||||
|
local _ret _hostonly_install
|
||||||
|
if [[ $1 == "-H" ]]; then
|
||||||
|
_hostonly_install="-H"
|
||||||
|
shift
|
||||||
|
fi
|
||||||
|
- [[ -e ${initdir}/"${2:-$1}" ]] && return 0 # already there
|
||||||
|
- if $DRACUT_INSTALL ${dracutsysrootdir:+-r "$dracutsysrootdir"} ${initdir:+-D "$initdir"} ${loginstall:+-L "$loginstall"} ${DRACUT_RESOLVE_DEPS:+-l} ${DRACUT_FIPS_MODE:+-f} ${_hostonly_install:+-H} "$@"; then
|
||||||
|
+ [[ -e ${dstdir}/"${2:-$1}" ]] && return 0 # already there
|
||||||
|
+ if $DRACUT_INSTALL ${dracutsysrootdir:+-r "$dracutsysrootdir"} ${dstdir:+-D "$dstdir"} ${loginstall:+-L "$loginstall"} ${DRACUT_RESOLVE_DEPS:+-l} ${DRACUT_FIPS_MODE:+-f} ${_hostonly_install:+-H} "$@"; then
|
||||||
|
return 0
|
||||||
|
else
|
||||||
|
_ret=$?
|
||||||
|
- derror FAILED: "$DRACUT_INSTALL" ${dracutsysrootdir:+-r "$dracutsysrootdir"} ${initdir:+-D "$initdir"} ${loginstall:+-L "$loginstall"} ${DRACUT_RESOLVE_DEPS:+-l} ${DRACUT_FIPS_MODE:+-f} ${_hostonly_install:+-H} "$@"
|
||||||
|
+ derror FAILED: "$DRACUT_INSTALL" ${dracutsysrootdir:+-r "$dracutsysrootdir"} ${dstdir:+-D "$dstdir"} ${loginstall:+-L "$loginstall"} ${DRACUT_RESOLVE_DEPS:+-l} ${DRACUT_FIPS_MODE:+-f} ${_hostonly_install:+-H} "$@"
|
||||||
|
return $_ret
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
inst_simple() {
|
||||||
|
+ local dstdir="${dstdir:-"$initdir"}"
|
||||||
|
local _ret _hostonly_install
|
||||||
|
if [[ $1 == "-H" ]]; then
|
||||||
|
_hostonly_install="-H"
|
||||||
|
shift
|
||||||
|
fi
|
||||||
|
- [[ -e ${initdir}/"${2:-$1}" ]] && return 0 # already there
|
||||||
|
- [[ -e $1 ]] || return 1 # no source
|
||||||
|
- if $DRACUT_INSTALL ${dracutsysrootdir:+-r "$dracutsysrootdir"} ${initdir:+-D "$initdir"} ${loginstall:+-L "$loginstall"} ${_hostonly_install:+-H} "$@"; then
|
||||||
|
+ [[ -e ${dstdir}/"${2:-$1}" ]] && return 0 # already there
|
||||||
|
+ [[ -e $1 ]] || return 1 # no source
|
||||||
|
+ if $DRACUT_INSTALL ${dracutsysrootdir:+-r "$dracutsysrootdir"} ${dstdir:+-D "$dstdir"} ${loginstall:+-L "$loginstall"} ${_hostonly_install:+-H} "$@"; then
|
||||||
|
return 0
|
||||||
|
else
|
||||||
|
_ret=$?
|
||||||
|
- derror FAILED: "$DRACUT_INSTALL" ${dracutsysrootdir:+-r "$dracutsysrootdir"} ${initdir:+-D "$initdir"} ${loginstall:+-L "$loginstall"} ${_hostonly_install:+-H} "$@"
|
||||||
|
+ derror FAILED: "$DRACUT_INSTALL" ${dracutsysrootdir:+-r "$dracutsysrootdir"} ${dstdir:+-D "$dstdir"} ${loginstall:+-L "$loginstall"} ${_hostonly_install:+-H} "$@"
|
||||||
|
return $_ret
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
@@ -290,16 +292,17 @@ inst_symlink() {
|
||||||
|
}
|
||||||
|
|
||||||
|
inst_multiple() {
|
||||||
|
+ local dstdir="${dstdir:-"$initdir"}"
|
||||||
|
local _ret _hostonly_install
|
||||||
|
if [[ $1 == "-H" ]]; then
|
||||||
|
_hostonly_install="-H"
|
||||||
|
shift
|
||||||
|
fi
|
||||||
|
- if $DRACUT_INSTALL ${dracutsysrootdir:+-r "$dracutsysrootdir"} ${initdir:+-D "$initdir"} -a ${loginstall:+-L "$loginstall"} ${DRACUT_RESOLVE_DEPS:+-l} ${DRACUT_FIPS_MODE:+-f} ${_hostonly_install:+-H} "$@"; then
|
||||||
|
+ if $DRACUT_INSTALL ${dracutsysrootdir:+-r "$dracutsysrootdir"} ${dstdir:+-D "$dstdir"} -a ${loginstall:+-L "$loginstall"} ${DRACUT_RESOLVE_DEPS:+-l} ${DRACUT_FIPS_MODE:+-f} ${_hostonly_install:+-H} "$@"; then
|
||||||
|
return 0
|
||||||
|
else
|
||||||
|
_ret=$?
|
||||||
|
- derror FAILED: "$DRACUT_INSTALL" ${dracutsysrootdir:+-r "$dracutsysrootdir"} ${initdir:+-D "$initdir"} -a ${loginstall:+-L "$loginstall"} ${DRACUT_RESOLVE_DEPS:+-l} ${DRACUT_FIPS_MODE:+-f} ${_hostonly_install:+-H} "$@"
|
||||||
|
+ derror FAILED: "$DRACUT_INSTALL" ${dracutsysrootdir:+-r "$dracutsysrootdir"} ${dstdir:+-D "$dstdir"} -a ${loginstall:+-L "$loginstall"} ${DRACUT_RESOLVE_DEPS:+-l} ${DRACUT_FIPS_MODE:+-f} ${_hostonly_install:+-H} "$@"
|
||||||
|
return $_ret
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
@@ -566,6 +569,8 @@ inst_rules_wildcard() {
|
||||||
|
|
||||||
|
# make sure that library links are correct and up to date
|
||||||
|
build_ld_cache() {
|
||||||
|
+ local dstdir="${dstdir:-"$initdir"}"
|
||||||
|
+
|
||||||
|
for f in "$dracutsysrootdir"/etc/ld.so.conf "$dracutsysrootdir"/etc/ld.so.conf.d/*; do
|
||||||
|
[[ -f $f ]] && inst_simple "${f#"$dracutsysrootdir"}"
|
||||||
|
done
|
||||||
|
@@ -1047,13 +1052,15 @@ for_each_module_dir() {
|
||||||
|
}
|
||||||
|
|
||||||
|
dracut_kernel_post() {
|
||||||
|
+ local dstdir="${dstdir:-"$initdir"}"
|
||||||
|
+
|
||||||
|
for _f in modules.builtin modules.builtin.alias modules.builtin.modinfo modules.order; do
|
||||||
|
[[ -e $srcmods/$_f ]] && inst_simple "$srcmods/$_f" "/lib/modules/$kernel/$_f"
|
||||||
|
done
|
||||||
|
|
||||||
|
# generate module dependencies for the initrd
|
||||||
|
- if [[ -d $initdir/lib/modules/$kernel ]] \
|
||||||
|
- && ! depmod -a -b "$initdir" "$kernel"; then
|
||||||
|
+ if [[ -d $dstdir/lib/modules/$kernel ]] \
|
||||||
|
+ && ! depmod -a -b "$dstdir" "$kernel"; then
|
||||||
|
dfatal "\"depmod -a $kernel\" failed."
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
@@ -1067,6 +1074,7 @@ instmods() {
|
||||||
|
# <kernel subsystem> can be e.g. "=block" or "=drivers/usb/storage"
|
||||||
|
# -c check
|
||||||
|
# -s silent
|
||||||
|
+ local dstdir="${dstdir:-"$initdir"}"
|
||||||
|
local _optional="-o"
|
||||||
|
local _silent
|
||||||
|
local _ret
|
||||||
|
@@ -1092,7 +1100,7 @@ instmods() {
|
||||||
|
fi
|
||||||
|
|
||||||
|
$DRACUT_INSTALL \
|
||||||
|
- ${initdir:+-D "$initdir"} \
|
||||||
|
+ ${dstdir:+-D "$dstdir"} \
|
||||||
|
${dracutsysrootdir:+-r "$dracutsysrootdir"} \
|
||||||
|
${loginstall:+-L "$loginstall"} \
|
||||||
|
${hostonly:+-H} \
|
||||||
|
@@ -1106,7 +1114,7 @@ instmods() {
|
||||||
|
if ((_ret != 0)) && [[ -z $_silent ]]; then
|
||||||
|
derror "FAILED: " \
|
||||||
|
"$DRACUT_INSTALL" \
|
||||||
|
- ${initdir:+-D "$initdir"} \
|
||||||
|
+ ${dstdir:+-D "$dstdir"} \
|
||||||
|
${dracutsysrootdir:+-r "$dracutsysrootdir"} \
|
||||||
|
${loginstall:+-L "$loginstall"} \
|
||||||
|
${hostonly:+-H} \
|
||||||
|
@@ -1123,14 +1131,16 @@ instmods() {
|
||||||
|
|
||||||
|
if [[ "$(ln --help)" == *--relative* ]]; then
|
||||||
|
ln_r() {
|
||||||
|
- ln -sfnr "${initdir}/$1" "${initdir}/$2"
|
||||||
|
+ local dstdir="${dstdir:-"$initdir"}"
|
||||||
|
+ ln -sfnr "${dstdir}/$1" "${dstdir}/$2"
|
||||||
|
}
|
||||||
|
else
|
||||||
|
ln_r() {
|
||||||
|
+ local dstdir="${dstdir:-"$initdir"}"
|
||||||
|
local _source=$1
|
||||||
|
local _dest=$2
|
||||||
|
[[ -d ${_dest%/*} ]] && _dest=$(readlink -f "${_dest%/*}")/${_dest##*/}
|
||||||
|
- ln -sfn -- "$(convert_abs_rel "${_dest}" "${_source}")" "${initdir}/${_dest}"
|
||||||
|
+ ln -sfn -- "$(convert_abs_rel "${_dest}" "${_source}")" "${dstdir}/${_dest}"
|
||||||
|
}
|
||||||
|
fi
|
||||||
|
|
||||||
|
--
|
||||||
|
2.42.0
|
||||||
|
|
@ -0,0 +1,82 @@
|
|||||||
|
From c81d6422d71b02ed9158a67c00fa0a5eec232f37 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Philipp Rudo <prudo@redhat.com>
|
||||||
|
Date: Thu, 25 Jul 2024 12:47:00 +0200
|
||||||
|
Subject: [PATCH 16/24] fix(dracut-init.sh): add module to mods_to_load before
|
||||||
|
checking dependencies
|
||||||
|
|
||||||
|
When implementing erofs support for 99squash we end up with three
|
||||||
|
modules 99squash, 95squash-squashfs and 95squash-erofs. Where 99squash
|
||||||
|
contains the common code for filesystem images and
|
||||||
|
95squash-{squashfs,erofs} the special handing depending on the
|
||||||
|
filesystem used. This leads to a dependency cycle as we want to allow
|
||||||
|
users both to choose 99squash, when the exact filesystem doesn't matter,
|
||||||
|
as well as 95squash-{squashfs,erofs} when a specific filesystem is
|
||||||
|
required.
|
||||||
|
|
||||||
|
But when 99squash is added as a dependency calling
|
||||||
|
dracut_module_included fails in its depends() function. This lead to
|
||||||
|
cases where both handlers, 95squash-squashfs and 95squash-erofs, were
|
||||||
|
added to the initrd.
|
||||||
|
|
||||||
|
Reason for the failure is that a module only is marked to be loaded
|
||||||
|
after all it's dependencies have been checked as well. Thus a child
|
||||||
|
module cannot detect which parent module wants it to be included. Fix
|
||||||
|
this by marking modules to be loaded before checking its dependencies in
|
||||||
|
check_module. Do the same change in check_mount for consistency.
|
||||||
|
|
||||||
|
Signed-off-by: Philipp Rudo <prudo@redhat.com>
|
||||||
|
|
||||||
|
(cherry picked from commit 634b4a5c6fbe595eb240cd529d669d21eadd510c)
|
||||||
|
|
||||||
|
Related: RHEL-43460
|
||||||
|
---
|
||||||
|
dracut-init.sh | 12 ++++++------
|
||||||
|
1 file changed, 6 insertions(+), 6 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/dracut-init.sh b/dracut-init.sh
|
||||||
|
index 58e657b5..840c6167 100755
|
||||||
|
--- a/dracut-init.sh
|
||||||
|
+++ b/dracut-init.sh
|
||||||
|
@@ -915,6 +915,9 @@ check_mount() {
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
+ [[ " $mods_to_load " == *\ $_mod\ * ]] \
|
||||||
|
+ || mods_to_load+=" $_mod "
|
||||||
|
+
|
||||||
|
for _moddep in $(module_depends "$_mod" "$_moddir"); do
|
||||||
|
# handle deps as if they were manually added
|
||||||
|
[[ " $dracutmodules " == *\ $_mod\ * ]] \
|
||||||
|
@@ -933,9 +936,6 @@ check_mount() {
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
- [[ " $mods_to_load " == *\ $_mod\ * ]] \
|
||||||
|
- || mods_to_load+=" $_mod "
|
||||||
|
-
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
|
@@ -990,6 +990,9 @@ check_module() {
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
+ [[ " $mods_to_load " == *\ $_mod\ * ]] \
|
||||||
|
+ || mods_to_load+=" $_mod "
|
||||||
|
+
|
||||||
|
for _moddep in $(module_depends "$_mod" "$_moddir"); do
|
||||||
|
# handle deps as if they were manually added
|
||||||
|
[[ " $dracutmodules " == *\ $_mod\ * ]] \
|
||||||
|
@@ -1008,9 +1011,6 @@ check_module() {
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
- [[ " $mods_to_load " == *\ $_mod\ * ]] \
|
||||||
|
- || mods_to_load+=" $_mod "
|
||||||
|
-
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
|
--
|
||||||
|
2.42.0
|
||||||
|
|
@ -0,0 +1,192 @@
|
|||||||
|
From bbb64f449a4f3cd76ea63d73ebc1043a3dd14118 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Philipp Rudo <prudo@redhat.com>
|
||||||
|
Date: Mon, 22 Jul 2024 16:30:50 +0200
|
||||||
|
Subject: [PATCH 17/24] feat(squash): move mksquashfs to 99squash/modules-setup
|
||||||
|
|
||||||
|
When using 99squash dracut actually builds two separat initrds. The
|
||||||
|
"normal" one, that gets squashed into a squashfs image, and a
|
||||||
|
"minimalistic" one, whose only task is to mount and switch_root to the
|
||||||
|
squashfs image.
|
||||||
|
|
||||||
|
For that 99squash currently requires a lot of special handling in
|
||||||
|
dracut.sh. Move most of this special handling into 99squash itself. This
|
||||||
|
requires a new approach when building the "minimalistic" initrd. The new
|
||||||
|
approach works the following way
|
||||||
|
|
||||||
|
1. During the installation phase install the "normal" initrd into
|
||||||
|
$initdir and the "minimalistic" initrd into $squashdir.
|
||||||
|
2. Strip the binaries in $initdir.
|
||||||
|
3. Trigger a special postinstall hook in 99squash that squashes the
|
||||||
|
content of $initdir (excluding $squashdir) into the squashfs image,
|
||||||
|
removes the content of $intidir (excluding $suqashdir) and, moves the
|
||||||
|
content of $squashdir into $initdir.
|
||||||
|
|
||||||
|
Signed-off-by: Philipp Rudo <prudo@redhat.com>
|
||||||
|
|
||||||
|
(cherry picked from commit 7a4dd89ca732329893628b886fe8e78337d896e8)
|
||||||
|
|
||||||
|
Related: RHEL-43460
|
||||||
|
---
|
||||||
|
dracut.sh | 35 ++++--------------
|
||||||
|
modules.d/99squash/module-setup.sh | 58 +++++++++++++++++++++---------
|
||||||
|
2 files changed, 49 insertions(+), 44 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/dracut.sh b/dracut.sh
|
||||||
|
index cc6d6f28..68bdf33b 100755
|
||||||
|
--- a/dracut.sh
|
||||||
|
+++ b/dracut.sh
|
||||||
|
@@ -1277,6 +1277,7 @@ trap '
|
||||||
|
trap 'exit 1;' SIGINT
|
||||||
|
|
||||||
|
readonly initdir="${DRACUT_TMPDIR}/initramfs"
|
||||||
|
+readonly squashdir="$initdir/squash_root"
|
||||||
|
mkdir -p "$initdir"
|
||||||
|
|
||||||
|
if [[ $early_microcode == yes ]] || { [[ $acpi_override == yes ]] && [[ -d $acpi_table_dir ]]; }; then
|
||||||
|
@@ -1804,7 +1805,8 @@ export initdir dracutbasedir \
|
||||||
|
host_fs_types host_devs swap_devs sshkey add_fstab \
|
||||||
|
DRACUT_VERSION \
|
||||||
|
prefix filesystems drivers \
|
||||||
|
- hostonly_cmdline loginstall
|
||||||
|
+ hostonly_cmdline loginstall \
|
||||||
|
+ squashdir squash_compress
|
||||||
|
|
||||||
|
mods_to_load=""
|
||||||
|
# check all our modules to see if they should be sourced.
|
||||||
|
@@ -1909,6 +1911,8 @@ if [[ $kernel_only != yes ]]; then
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
+dracut_module_included "squash" && mkdir -p "$squashdir"
|
||||||
|
+
|
||||||
|
_isize=0 #initramfs size
|
||||||
|
modules_loaded=" "
|
||||||
|
# source our modules.
|
||||||
|
@@ -2255,14 +2259,6 @@ if [[ $kernel_only != yes ]]; then
|
||||||
|
build_ld_cache
|
||||||
|
fi
|
||||||
|
|
||||||
|
-if dracut_module_included "squash"; then
|
||||||
|
- readonly squash_dir="$initdir/squash/root"
|
||||||
|
- readonly squash_img="$initdir/squash-root.img"
|
||||||
|
- mkdir -p "$squash_dir"
|
||||||
|
- dinfo "*** Install squash loader ***"
|
||||||
|
- DRACUT_SQUASH_POST_INST=1 module_install "squash"
|
||||||
|
-fi
|
||||||
|
-
|
||||||
|
if [[ $do_strip == yes ]] && ! [[ $DRACUT_FIPS_MODE ]]; then
|
||||||
|
# stripping files negates (dedup) benefits of using reflink
|
||||||
|
[[ -n $enhanced_cpio ]] && ddebug "strip is enabled alongside cpio reflink"
|
||||||
|
@@ -2282,25 +2278,8 @@ fi
|
||||||
|
|
||||||
|
if dracut_module_included "squash"; then
|
||||||
|
dinfo "*** Squashing the files inside the initramfs ***"
|
||||||
|
- declare squash_compress_arg
|
||||||
|
- # shellcheck disable=SC2086
|
||||||
|
- if [[ $squash_compress ]]; then
|
||||||
|
- if ! mksquashfs /dev/null "$DRACUT_TMPDIR"/.squash-test.img -no-progress -comp $squash_compress &> /dev/null; then
|
||||||
|
- dwarn "mksquashfs doesn't support compressor '$squash_compress', failing back to default compressor."
|
||||||
|
- else
|
||||||
|
- squash_compress_arg="$squash_compress"
|
||||||
|
- fi
|
||||||
|
- fi
|
||||||
|
-
|
||||||
|
- # shellcheck disable=SC2086
|
||||||
|
- if ! mksquashfs "$squash_dir" "$squash_img" \
|
||||||
|
- -no-xattrs -no-exports -noappend -no-recovery -always-use-fragments \
|
||||||
|
- -no-progress ${squash_compress_arg:+-comp $squash_compress_arg} 1> /dev/null; then
|
||||||
|
- dfatal "Failed making squash image"
|
||||||
|
- exit 1
|
||||||
|
- fi
|
||||||
|
-
|
||||||
|
- rm -rf "$squash_dir"
|
||||||
|
+ DRACUT_SQUASH_POST_INST=1 module_install "squash"
|
||||||
|
+ rm -rf "$squashdir"
|
||||||
|
dinfo "*** Squashing the files inside the initramfs done ***"
|
||||||
|
|
||||||
|
# Skip initramfs compress
|
||||||
|
diff --git a/modules.d/99squash/module-setup.sh b/modules.d/99squash/module-setup.sh
|
||||||
|
index dc2e0a20..96d097af 100755
|
||||||
|
--- a/modules.d/99squash/module-setup.sh
|
||||||
|
+++ b/modules.d/99squash/module-setup.sh
|
||||||
|
@@ -12,26 +12,13 @@ depends() {
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
|
-installpost() {
|
||||||
|
+squash_install() {
|
||||||
|
local _busybox
|
||||||
|
_busybox=$(find_binary busybox)
|
||||||
|
|
||||||
|
- # Move everything under $initdir except $squash_dir
|
||||||
|
- # itself into squash image
|
||||||
|
- for i in "$initdir"/*; do
|
||||||
|
- [[ $squash_dir == "$i"/* ]] || mv "$i" "$squash_dir"/
|
||||||
|
- done
|
||||||
|
-
|
||||||
|
# Create mount points for squash loader
|
||||||
|
mkdir -p "$initdir"/squash/
|
||||||
|
- mkdir -p "$squash_dir"/squash/
|
||||||
|
-
|
||||||
|
- # Copy dracut spec files out side of the squash image
|
||||||
|
- # so dracut rebuild and lsinitrd can work
|
||||||
|
- for file in "$squash_dir"/usr/lib/dracut/*; do
|
||||||
|
- [[ -f $file ]] || continue
|
||||||
|
- DRACUT_RESOLVE_DEPS=1 dracutsysrootdir="$squash_dir" inst "${file#"$squash_dir"}"
|
||||||
|
- done
|
||||||
|
+ mkdir -p "$squashdir"/squash/
|
||||||
|
|
||||||
|
# Install required modules and binaries for the squash image init script.
|
||||||
|
if [[ $_busybox ]]; then
|
||||||
|
@@ -61,8 +48,47 @@ installpost() {
|
||||||
|
build_ld_cache
|
||||||
|
}
|
||||||
|
|
||||||
|
+squash_installpost() {
|
||||||
|
+ local _img="$squashdir"/squash-root.img
|
||||||
|
+ local _comp _file
|
||||||
|
+
|
||||||
|
+ # shellcheck disable=SC2086
|
||||||
|
+ if [[ $squash_compress ]]; then
|
||||||
|
+ if ! mksquashfs /dev/null "$DRACUT_TMPDIR"/.squash-test.img -no-progress -comp $squash_compress &> /dev/null; then
|
||||||
|
+ dwarn "mksquashfs doesn't support compressor '$squash_compress', failing back to default compressor."
|
||||||
|
+ else
|
||||||
|
+ _comp="$squash_compress"
|
||||||
|
+ fi
|
||||||
|
+ fi
|
||||||
|
+
|
||||||
|
+ # shellcheck disable=SC2086
|
||||||
|
+ if ! mksquashfs "$initdir" "$_img" \
|
||||||
|
+ -no-xattrs -no-exports -noappend -no-recovery -always-use-fragments \
|
||||||
|
+ -no-progress ${_comp:+-comp $_comp} \
|
||||||
|
+ -e "$squashdir" 1> /dev/null; then
|
||||||
|
+ dfatal "Failed making squash image"
|
||||||
|
+ exit 1
|
||||||
|
+ fi
|
||||||
|
+
|
||||||
|
+ # Rescue the dracut spec files so dracut rebuild and lsinitrd can work
|
||||||
|
+ for _file in "$initdir"/usr/lib/dracut/*; do
|
||||||
|
+ [[ -f $_file ]] || continue
|
||||||
|
+ DRACUT_RESOLVE_DEPS=1 dstdir=$squashdir inst "$_file" "${_file#"$initdir"}"
|
||||||
|
+ done
|
||||||
|
+
|
||||||
|
+ # Remove everything that got squashed into the image
|
||||||
|
+ for _file in "$initdir"/*; do
|
||||||
|
+ [[ $_file == "$squashdir" ]] && continue
|
||||||
|
+ rm -rf "$_file"
|
||||||
|
+ done
|
||||||
|
+ mv "$squashdir"/* "$initdir"
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
install() {
|
||||||
|
+
|
||||||
|
if [[ $DRACUT_SQUASH_POST_INST ]]; then
|
||||||
|
- installpost
|
||||||
|
+ squash_installpost
|
||||||
|
+ else
|
||||||
|
+ dstdir="$squashdir" squash_install
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
--
|
||||||
|
2.42.0
|
||||||
|
|
@ -0,0 +1,183 @@
|
|||||||
|
From 1ef53f9d5ea7f74730b27b8016304c58b2d31871 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Philipp Rudo <prudo@redhat.com>
|
||||||
|
Date: Tue, 23 Jul 2024 16:39:13 +0200
|
||||||
|
Subject: [PATCH 18/24] feat(squash): split 95squash-squashfs from 99squash
|
||||||
|
|
||||||
|
99squash only allows squashing the files using squashfs. In order to
|
||||||
|
make the implementation for different filesystems easier split out the
|
||||||
|
squashfs specific parts into 95squash-squashfs.
|
||||||
|
|
||||||
|
While at it rename the root image contained in the initrd to
|
||||||
|
squashfs-root.img. This allows tools like lsinitrd to detect the
|
||||||
|
filesystem used later on.
|
||||||
|
|
||||||
|
Signed-off-by: Philipp Rudo <prudo@redhat.com>
|
||||||
|
|
||||||
|
(cherry picked from commit f281606f110be1549cd6b1cd34828653879a5f50)
|
||||||
|
|
||||||
|
Related: RHEL-43460
|
||||||
|
---
|
||||||
|
modules.d/95squash-squashfs/module-setup.sh | 48 ++++++++++++++++++
|
||||||
|
modules.d/99squash/init-squash.sh | 2 +-
|
||||||
|
modules.d/99squash/module-setup.sh | 54 ++++++++++++---------
|
||||||
|
3 files changed, 80 insertions(+), 24 deletions(-)
|
||||||
|
create mode 100755 modules.d/95squash-squashfs/module-setup.sh
|
||||||
|
|
||||||
|
diff --git a/modules.d/95squash-squashfs/module-setup.sh b/modules.d/95squash-squashfs/module-setup.sh
|
||||||
|
new file mode 100755
|
||||||
|
index 00000000..83973700
|
||||||
|
--- /dev/null
|
||||||
|
+++ b/modules.d/95squash-squashfs/module-setup.sh
|
||||||
|
@@ -0,0 +1,48 @@
|
||||||
|
+#!/bin/bash
|
||||||
|
+
|
||||||
|
+check() {
|
||||||
|
+ require_binaries mksquashfs unsquashfs || return 1
|
||||||
|
+ require_kernel_modules squashfs || return 1
|
||||||
|
+
|
||||||
|
+ return 255
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+depends() {
|
||||||
|
+ echo "squash"
|
||||||
|
+ return 0
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+squashfs_install() {
|
||||||
|
+ hostonly="" instmods "squashfs"
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+squashfs_installpost() {
|
||||||
|
+ local _img="$squashdir/squashfs-root.img"
|
||||||
|
+ local _comp
|
||||||
|
+
|
||||||
|
+ # shellcheck disable=SC2086
|
||||||
|
+ if [[ $squash_compress ]]; then
|
||||||
|
+ if ! mksquashfs /dev/null "$DRACUT_TMPDIR"/.squash-test.img -no-progress -comp $squash_compress &> /dev/null; then
|
||||||
|
+ dwarn "mksquashfs doesn't support compressor '$squash_compress', failing back to default compressor."
|
||||||
|
+ else
|
||||||
|
+ _comp="$squash_compress"
|
||||||
|
+ fi
|
||||||
|
+ fi
|
||||||
|
+
|
||||||
|
+ # shellcheck disable=SC2086
|
||||||
|
+ if ! mksquashfs "$initdir" "$_img" \
|
||||||
|
+ -no-xattrs -no-exports -noappend -no-recovery -always-use-fragments \
|
||||||
|
+ -no-progress ${_comp:+-comp $_comp} \
|
||||||
|
+ -e "$squashdir" 1> /dev/null; then
|
||||||
|
+ dfatal "Failed making squash image"
|
||||||
|
+ exit 1
|
||||||
|
+ fi
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+install() {
|
||||||
|
+ if [[ $DRACUT_SQUASH_POST_INST ]]; then
|
||||||
|
+ squashfs_installpost
|
||||||
|
+ else
|
||||||
|
+ dstdir="$squashdir" squashfs_install
|
||||||
|
+ fi
|
||||||
|
+}
|
||||||
|
diff --git a/modules.d/99squash/init-squash.sh b/modules.d/99squash/init-squash.sh
|
||||||
|
index 59769f62..42a9a86f 100755
|
||||||
|
--- a/modules.d/99squash/init-squash.sh
|
||||||
|
+++ b/modules.d/99squash/init-squash.sh
|
||||||
|
@@ -21,7 +21,7 @@ modprobe overlay
|
||||||
|
# Mount the squash image
|
||||||
|
mount -t ramfs ramfs /squash
|
||||||
|
mkdir -p /squash/root /squash/overlay/upper /squash/overlay/work
|
||||||
|
-mount -t squashfs -o ro,loop /squash-root.img /squash/root
|
||||||
|
+mount -t squashfs -o ro,loop /squashfs-root.img /squash/root
|
||||||
|
|
||||||
|
# Setup new root overlay
|
||||||
|
mkdir /newroot
|
||||||
|
diff --git a/modules.d/99squash/module-setup.sh b/modules.d/99squash/module-setup.sh
|
||||||
|
index 96d097af..015944c2 100755
|
||||||
|
--- a/modules.d/99squash/module-setup.sh
|
||||||
|
+++ b/modules.d/99squash/module-setup.sh
|
||||||
|
@@ -1,17 +1,42 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
check() {
|
||||||
|
- require_binaries mksquashfs unsquashfs || return 1
|
||||||
|
- require_kernel_modules squashfs loop overlay || return 1
|
||||||
|
+ require_kernel_modules loop overlay || return 1
|
||||||
|
|
||||||
|
return 255
|
||||||
|
}
|
||||||
|
|
||||||
|
depends() {
|
||||||
|
- echo "systemd-initrd"
|
||||||
|
+ local _handler
|
||||||
|
+
|
||||||
|
+ _handler=$(squash_get_handler) || return 1
|
||||||
|
+
|
||||||
|
+ echo "systemd-initrd $_handler"
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
|
+squash_get_handler() {
|
||||||
|
+ local _module _handler
|
||||||
|
+
|
||||||
|
+ for _module in squash-squashfs; do
|
||||||
|
+ if dracut_module_included "$_module"; then
|
||||||
|
+ _handler="$_module"
|
||||||
|
+ break
|
||||||
|
+ fi
|
||||||
|
+ done
|
||||||
|
+
|
||||||
|
+ if [ -z "$_handler" ]; then
|
||||||
|
+ if check_module "squash-squashfs"; then
|
||||||
|
+ _handler="squash-squashfs"
|
||||||
|
+ else
|
||||||
|
+ dfatal "No valid handler for found"
|
||||||
|
+ return 1
|
||||||
|
+ fi
|
||||||
|
+ fi
|
||||||
|
+
|
||||||
|
+ echo "$_handler"
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
squash_install() {
|
||||||
|
local _busybox
|
||||||
|
_busybox=$(find_binary busybox)
|
||||||
|
@@ -36,7 +61,7 @@ squash_install() {
|
||||||
|
[[ $DRACUT_FIPS_MODE ]] && inst_libdir_file -o "libssl.so*"
|
||||||
|
fi
|
||||||
|
|
||||||
|
- hostonly="" instmods "loop" "squashfs" "overlay"
|
||||||
|
+ hostonly="" instmods "loop" "overlay"
|
||||||
|
dracut_kernel_post
|
||||||
|
|
||||||
|
# Install squash image init script.
|
||||||
|
@@ -49,26 +74,9 @@ squash_install() {
|
||||||
|
}
|
||||||
|
|
||||||
|
squash_installpost() {
|
||||||
|
- local _img="$squashdir"/squash-root.img
|
||||||
|
- local _comp _file
|
||||||
|
-
|
||||||
|
- # shellcheck disable=SC2086
|
||||||
|
- if [[ $squash_compress ]]; then
|
||||||
|
- if ! mksquashfs /dev/null "$DRACUT_TMPDIR"/.squash-test.img -no-progress -comp $squash_compress &> /dev/null; then
|
||||||
|
- dwarn "mksquashfs doesn't support compressor '$squash_compress', failing back to default compressor."
|
||||||
|
- else
|
||||||
|
- _comp="$squash_compress"
|
||||||
|
- fi
|
||||||
|
- fi
|
||||||
|
+ local _file
|
||||||
|
|
||||||
|
- # shellcheck disable=SC2086
|
||||||
|
- if ! mksquashfs "$initdir" "$_img" \
|
||||||
|
- -no-xattrs -no-exports -noappend -no-recovery -always-use-fragments \
|
||||||
|
- -no-progress ${_comp:+-comp $_comp} \
|
||||||
|
- -e "$squashdir" 1> /dev/null; then
|
||||||
|
- dfatal "Failed making squash image"
|
||||||
|
- exit 1
|
||||||
|
- fi
|
||||||
|
+ DRACUT_SQUASH_POST_INST=1 module_install "$(squash_get_handler)"
|
||||||
|
|
||||||
|
# Rescue the dracut spec files so dracut rebuild and lsinitrd can work
|
||||||
|
for _file in "$initdir"/usr/lib/dracut/*; do
|
||||||
|
--
|
||||||
|
2.42.0
|
||||||
|
|
@ -0,0 +1,128 @@
|
|||||||
|
From 4e8ea763cb10ab4f3b65e865d2ad03c8a5393e04 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Philipp Rudo <prudo@redhat.com>
|
||||||
|
Date: Tue, 23 Jul 2024 17:42:33 +0200
|
||||||
|
Subject: [PATCH 19/24] feat(squash): add module 95squash-erofs
|
||||||
|
|
||||||
|
Allow squashing the image in 99squash using erofs. Keep squashfs as
|
||||||
|
default to not change existing systems. I.e. only use erofs if the user
|
||||||
|
explicitly include 95squash-erofs or when the prereqs for squashfs are
|
||||||
|
missing.
|
||||||
|
|
||||||
|
Signed-off-by: Philipp Rudo <prudo@redhat.com>
|
||||||
|
|
||||||
|
(cherry picked from commit e185d6ae1cc38af90f741d3d6c677458d69a345f)
|
||||||
|
|
||||||
|
Resolves: RHEL-43460
|
||||||
|
---
|
||||||
|
modules.d/95squash-erofs/module-setup.sh | 45 ++++++++++++++++++++++++
|
||||||
|
modules.d/99squash/init-squash.sh | 12 +++++--
|
||||||
|
modules.d/99squash/module-setup.sh | 4 ++-
|
||||||
|
3 files changed, 58 insertions(+), 3 deletions(-)
|
||||||
|
create mode 100755 modules.d/95squash-erofs/module-setup.sh
|
||||||
|
|
||||||
|
diff --git a/modules.d/95squash-erofs/module-setup.sh b/modules.d/95squash-erofs/module-setup.sh
|
||||||
|
new file mode 100755
|
||||||
|
index 00000000..71c2b672
|
||||||
|
--- /dev/null
|
||||||
|
+++ b/modules.d/95squash-erofs/module-setup.sh
|
||||||
|
@@ -0,0 +1,45 @@
|
||||||
|
+#!/bin/bash
|
||||||
|
+
|
||||||
|
+check() {
|
||||||
|
+ require_binaries mkfs.erofs || return 1
|
||||||
|
+ require_kernel_modules erofs || return 1
|
||||||
|
+
|
||||||
|
+ return 255
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+depends() {
|
||||||
|
+ echo "squash"
|
||||||
|
+ return 0
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+erofs_install() {
|
||||||
|
+ hostonly="" instmods "erofs"
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+erofs_installpost() {
|
||||||
|
+ local _img="$squashdir/erofs-root.img"
|
||||||
|
+ local -a _erofs_args
|
||||||
|
+
|
||||||
|
+ _erofs_args+=("--exclude-path=$squashdir")
|
||||||
|
+ _erofs_args+=("-E" "fragments")
|
||||||
|
+
|
||||||
|
+ if [[ -n $squash_compress ]]; then
|
||||||
|
+ if mkfs.erofs "${_erofs_args[@]}" -z "$squash_compress" "$_img" "$initdir" &> /dev/null; then
|
||||||
|
+ return
|
||||||
|
+ fi
|
||||||
|
+ dwarn "mkfs.erofs doesn't support compressor '$squash_compress', failing back to default compressor."
|
||||||
|
+ fi
|
||||||
|
+
|
||||||
|
+ if ! mkfs.erofs "${_erofs_args[@]}" "$_img" "$initdir" &> /dev/null; then
|
||||||
|
+ dfatal "Failed making squash image"
|
||||||
|
+ exit 1
|
||||||
|
+ fi
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+install() {
|
||||||
|
+ if [[ $DRACUT_SQUASH_POST_INST ]]; then
|
||||||
|
+ erofs_installpost
|
||||||
|
+ else
|
||||||
|
+ dstdir="$squashdir" erofs_install
|
||||||
|
+ fi
|
||||||
|
+}
|
||||||
|
diff --git a/modules.d/99squash/init-squash.sh b/modules.d/99squash/init-squash.sh
|
||||||
|
index 42a9a86f..31a39cfd 100755
|
||||||
|
--- a/modules.d/99squash/init-squash.sh
|
||||||
|
+++ b/modules.d/99squash/init-squash.sh
|
||||||
|
@@ -13,15 +13,23 @@ grep -q '^devtmpfs /dev devtmpfs' /proc/self/mounts \
|
||||||
|
grep -q '^tmpfs /run tmpfs' /proc/self/mounts \
|
||||||
|
|| (mkdir -p /run && mount -t tmpfs -o mode=755,noexec,nosuid,strictatime tmpfs /run)
|
||||||
|
|
||||||
|
+if [ -e /erofs-root.img ]; then
|
||||||
|
+ _fs=erofs
|
||||||
|
+ _img=erofs-root.img
|
||||||
|
+else
|
||||||
|
+ _fs=squashfs
|
||||||
|
+ _img=squashfs-root.img
|
||||||
|
+fi
|
||||||
|
+
|
||||||
|
# Load required modules
|
||||||
|
modprobe loop
|
||||||
|
-modprobe squashfs
|
||||||
|
+modprobe "$_fs"
|
||||||
|
modprobe overlay
|
||||||
|
|
||||||
|
# Mount the squash image
|
||||||
|
mount -t ramfs ramfs /squash
|
||||||
|
mkdir -p /squash/root /squash/overlay/upper /squash/overlay/work
|
||||||
|
-mount -t squashfs -o ro,loop /squashfs-root.img /squash/root
|
||||||
|
+mount -t "$_fs" -o ro,loop /"$_img" /squash/root
|
||||||
|
|
||||||
|
# Setup new root overlay
|
||||||
|
mkdir /newroot
|
||||||
|
diff --git a/modules.d/99squash/module-setup.sh b/modules.d/99squash/module-setup.sh
|
||||||
|
index 015944c2..5cbbec63 100755
|
||||||
|
--- a/modules.d/99squash/module-setup.sh
|
||||||
|
+++ b/modules.d/99squash/module-setup.sh
|
||||||
|
@@ -18,7 +18,7 @@ depends() {
|
||||||
|
squash_get_handler() {
|
||||||
|
local _module _handler
|
||||||
|
|
||||||
|
- for _module in squash-squashfs; do
|
||||||
|
+ for _module in squash-squashfs squash-erofs; do
|
||||||
|
if dracut_module_included "$_module"; then
|
||||||
|
_handler="$_module"
|
||||||
|
break
|
||||||
|
@@ -28,6 +28,8 @@ squash_get_handler() {
|
||||||
|
if [ -z "$_handler" ]; then
|
||||||
|
if check_module "squash-squashfs"; then
|
||||||
|
_handler="squash-squashfs"
|
||||||
|
+ elif check_module "squash-erofs"; then
|
||||||
|
+ _handler="squash-erofs"
|
||||||
|
else
|
||||||
|
dfatal "No valid handler for found"
|
||||||
|
return 1
|
||||||
|
--
|
||||||
|
2.42.0
|
||||||
|
|
@ -0,0 +1,240 @@
|
|||||||
|
From 327adc7782fd43f4cf9848f1c24f196c496b6b53 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Philipp Rudo <prudo@redhat.com>
|
||||||
|
Date: Tue, 23 Jul 2024 18:33:37 +0200
|
||||||
|
Subject: [PATCH 20/24] feat(lsinitrd): add support for erofs images
|
||||||
|
|
||||||
|
Add support to handle erofs images in lsinitrd. Unfortunately the erofs
|
||||||
|
tooling is missing some functionality of unsquashfs, esp. the ability to
|
||||||
|
extract single files and list the content of the image. Work around this
|
||||||
|
deficiency by always extracting the full image and emulate the missing
|
||||||
|
functionality as close as possible.
|
||||||
|
|
||||||
|
While at it also handle the rename of the squashfs image to
|
||||||
|
squashfs-root.img.
|
||||||
|
|
||||||
|
Signed-off-by: Philipp Rudo <prudo@redhat.com>
|
||||||
|
|
||||||
|
(cherry picked from commit 009b4ccc94fe3fcf129dddc5aca4f25b1e1b1862)
|
||||||
|
|
||||||
|
Resolves: RHEL-43460
|
||||||
|
---
|
||||||
|
lsinitrd.sh | 167 +++++++++++++++++++++++++++++++++++-----------------
|
||||||
|
1 file changed, 113 insertions(+), 54 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/lsinitrd.sh b/lsinitrd.sh
|
||||||
|
index 1329ab70..952dbc9f 100755
|
||||||
|
--- a/lsinitrd.sh
|
||||||
|
+++ b/lsinitrd.sh
|
||||||
|
@@ -172,10 +172,47 @@ dracutlibdirs() {
|
||||||
|
done
|
||||||
|
}
|
||||||
|
|
||||||
|
+SQUASH_TMPFILE=""
|
||||||
|
+SQUASH_EXTRACT="$TMPDIR/squash-extract"
|
||||||
|
+
|
||||||
|
+extract_squash_img() {
|
||||||
|
+ local _img _tmp
|
||||||
|
+
|
||||||
|
+ [[ $SQUASH_TMPDIR == none ]] && return 1
|
||||||
|
+ [[ -s $SQUASH_TMPFILE ]] && return 0
|
||||||
|
+
|
||||||
|
+ # Before dracut 104 the image was named squash-root.img. Keep the old name
|
||||||
|
+ # so newer versions of lsinitrd can inspect initrds build with older dracut
|
||||||
|
+ # versions.
|
||||||
|
+ for _img in squash-root.img squashfs-root.img erofs-root.img; do
|
||||||
|
+ _tmp="$TMPDIR/$_img"
|
||||||
|
+ $CAT "$image" 2> /dev/null | cpio --extract --verbose --quiet --to-stdout -- \
|
||||||
|
+ $_img > "$_tmp" 2> /dev/null
|
||||||
|
+ [[ -s $_tmp ]] || continue
|
||||||
|
+
|
||||||
|
+ SQUASH_TMPFILE="$_tmp"
|
||||||
|
+
|
||||||
|
+ # fsck.erofs doesn't allow extracting single files or listing the
|
||||||
|
+ # content of the image. So always extract the full image.
|
||||||
|
+ if [[ $_img == erofs-root.img ]]; then
|
||||||
|
+ mkdir -p "$SQUASH_EXTRACT"
|
||||||
|
+ fsck.erofs --extract="$SQUASH_EXTRACT/erofs-root" --overwrite "$SQUASH_TMPFILE" 2> /dev/null
|
||||||
|
+ ((ret += $?))
|
||||||
|
+ fi
|
||||||
|
+
|
||||||
|
+ break
|
||||||
|
+ done
|
||||||
|
+
|
||||||
|
+ if [[ -z $SQUASH_TMPFILE ]]; then
|
||||||
|
+ SQUASH_TMPFILE=none
|
||||||
|
+ return 1
|
||||||
|
+ fi
|
||||||
|
+
|
||||||
|
+ return 0
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
extract_files() {
|
||||||
|
- SQUASH_IMG="squash-root.img"
|
||||||
|
- SQUASH_TMPFILE="$TMPDIR/initrd.root.sqsh"
|
||||||
|
- SQUASH_EXTRACT="$TMPDIR/squash-extract"
|
||||||
|
+ local nofileinfo
|
||||||
|
|
||||||
|
((${#filenames[@]} == 1)) && nofileinfo=1
|
||||||
|
for f in "${!filenames[@]}"; do
|
||||||
|
@@ -183,18 +220,24 @@ extract_files() {
|
||||||
|
[[ $nofileinfo ]] || echo "========================================================================"
|
||||||
|
# shellcheck disable=SC2001
|
||||||
|
[[ $f == *"\\x"* ]] && f=$(echo "$f" | sed 's/\\x.\{2\}/????/g')
|
||||||
|
- $CAT "$image" 2> /dev/null | cpio --extract --verbose --quiet --to-stdout "$f" 2> /dev/null
|
||||||
|
- ((ret += $?))
|
||||||
|
- if [[ -z ${f/#squashfs-root*/} ]]; then
|
||||||
|
- if [[ ! -s $SQUASH_TMPFILE ]]; then
|
||||||
|
- $CAT "$image" 2> /dev/null | cpio --extract --verbose --quiet --to-stdout -- \
|
||||||
|
- $SQUASH_IMG > "$SQUASH_TMPFILE" 2> /dev/null
|
||||||
|
- fi
|
||||||
|
- unsquashfs -force -d "$SQUASH_EXTRACT" -no-progress "$SQUASH_TMPFILE" "${f#squashfs-root/}" > /dev/null 2>&1
|
||||||
|
- ((ret += $?))
|
||||||
|
- cat "$SQUASH_EXTRACT/${f#squashfs-root/}" 2> /dev/null
|
||||||
|
- rm "$SQUASH_EXTRACT/${f#squashfs-root/}" 2> /dev/null
|
||||||
|
- fi
|
||||||
|
+
|
||||||
|
+ case $f in
|
||||||
|
+ squashfs-root/*)
|
||||||
|
+ extract_squash_img
|
||||||
|
+ unsquashfs -force -d "$SQUASH_EXTRACT" -no-progress "$SQUASH_TMPFILE" "${f#squashfs-root/}" &> /dev/null
|
||||||
|
+ ((ret += $?))
|
||||||
|
+ cat "$SQUASH_EXTRACT/${f#squashfs-root/}" 2> /dev/null
|
||||||
|
+ ;;
|
||||||
|
+ erofs-root/*)
|
||||||
|
+ extract_squash_img
|
||||||
|
+ cat "$SQUASH_EXTRACT/$f" 2> /dev/null
|
||||||
|
+ ;;
|
||||||
|
+ *)
|
||||||
|
+ $CAT "$image" 2> /dev/null | cpio --extract --verbose --quiet --to-stdout "$f" 2> /dev/null
|
||||||
|
+ ((ret += $?))
|
||||||
|
+ ;;
|
||||||
|
+ esac
|
||||||
|
+
|
||||||
|
[[ $nofileinfo ]] || echo "========================================================================"
|
||||||
|
[[ $nofileinfo ]] || echo
|
||||||
|
done
|
||||||
|
@@ -220,66 +263,82 @@ list_files() {
|
||||||
|
}
|
||||||
|
|
||||||
|
list_squash_content() {
|
||||||
|
- SQUASH_IMG="squash-root.img"
|
||||||
|
- SQUASH_TMPFILE="$TMPDIR/initrd.root.sqsh"
|
||||||
|
+ extract_squash_img || return 0
|
||||||
|
|
||||||
|
- $CAT "$image" 2> /dev/null | cpio --extract --verbose --quiet --to-stdout -- \
|
||||||
|
- $SQUASH_IMG > "$SQUASH_TMPFILE" 2> /dev/null
|
||||||
|
- if [[ -s $SQUASH_TMPFILE ]]; then
|
||||||
|
- echo "Squashed content ($SQUASH_IMG):"
|
||||||
|
- echo "========================================================================"
|
||||||
|
- unsquashfs -d "squashfs-root" -ll "$SQUASH_TMPFILE" | tail -n +4
|
||||||
|
- echo "========================================================================"
|
||||||
|
- fi
|
||||||
|
+ echo "Squashed content (${SQUASH_TMPFILE##*/}):"
|
||||||
|
+ echo "========================================================================"
|
||||||
|
+ case $SQUASH_TMPFILE in
|
||||||
|
+ */squash-root.img | */squashfs-root.img)
|
||||||
|
+ unsquashfs -ll "$SQUASH_TMPFILE" | tail -n +4
|
||||||
|
+ ;;
|
||||||
|
+ */erofs-root.img)
|
||||||
|
+ (
|
||||||
|
+ cd "$SQUASH_EXTRACT" || return 1
|
||||||
|
+ find erofs-root/ -ls
|
||||||
|
+ )
|
||||||
|
+ ;;
|
||||||
|
+ esac
|
||||||
|
+ echo "========================================================================"
|
||||||
|
}
|
||||||
|
|
||||||
|
list_cmdline() {
|
||||||
|
- # depends on list_squash_content() having run before
|
||||||
|
- SQUASH_IMG="squash-root.img"
|
||||||
|
- SQUASH_TMPFILE="$TMPDIR/initrd.root.sqsh"
|
||||||
|
- SQUASH_EXTRACT="$TMPDIR/squash-extract"
|
||||||
|
|
||||||
|
echo "dracut cmdline:"
|
||||||
|
# shellcheck disable=SC2046
|
||||||
|
$CAT "$image" | cpio --extract --verbose --quiet --to-stdout -- \
|
||||||
|
etc/cmdline.d/\*.conf 2> /dev/null
|
||||||
|
((ret += $?))
|
||||||
|
- if [[ -s $SQUASH_TMPFILE ]]; then
|
||||||
|
- unsquashfs -force -d "$SQUASH_EXTRACT" -no-progress "$SQUASH_TMPFILE" etc/cmdline.d/\*.conf > /dev/null 2>&1
|
||||||
|
- ((ret += $?))
|
||||||
|
- cat "$SQUASH_EXTRACT"/etc/cmdline.d/*.conf 2> /dev/null
|
||||||
|
- rm "$SQUASH_EXTRACT"/etc/cmdline.d/*.conf 2> /dev/null
|
||||||
|
- fi
|
||||||
|
+
|
||||||
|
+ extract_squash_img || return 0
|
||||||
|
+ case $SQUASH_TMPFILE in
|
||||||
|
+ */squash-root.img | */squashfs-root.img)
|
||||||
|
+ unsquashfs -force -d "$SQUASH_EXTRACT" -no-progress "$SQUASH_TMPFILE" etc/cmdline.d/\*.conf &> /dev/null
|
||||||
|
+ ((ret += $?))
|
||||||
|
+ cat "$SQUASH_EXTRACT"/etc/cmdline.d/*.conf 2> /dev/null
|
||||||
|
+ ;;
|
||||||
|
+ */erofs-root.img)
|
||||||
|
+ cat "$SQUASH_EXTRACT"/erofs-root/etc/cmdline.d/*.conf 2> /dev/null
|
||||||
|
+ ;;
|
||||||
|
+ esac
|
||||||
|
+
|
||||||
|
}
|
||||||
|
|
||||||
|
unpack_files() {
|
||||||
|
- SQUASH_IMG="squash-root.img"
|
||||||
|
- SQUASH_TMPFILE="$TMPDIR/initrd.root.sqsh"
|
||||||
|
-
|
||||||
|
if ((${#filenames[@]} > 0)); then
|
||||||
|
for f in "${!filenames[@]}"; do
|
||||||
|
# shellcheck disable=SC2001
|
||||||
|
[[ $f == *"\\x"* ]] && f=$(echo "$f" | sed 's/\\x.\{2\}/????/g')
|
||||||
|
- $CAT "$image" 2> /dev/null | cpio -id --quiet $verbose "$f"
|
||||||
|
- ((ret += $?))
|
||||||
|
- if [[ -z ${f/#squashfs-root*/} ]]; then
|
||||||
|
- if [[ ! -s $SQUASH_TMPFILE ]]; then
|
||||||
|
- $CAT "$image" 2> /dev/null | cpio --extract --verbose --quiet --to-stdout -- \
|
||||||
|
- $SQUASH_IMG > "$SQUASH_TMPFILE" 2> /dev/null
|
||||||
|
- fi
|
||||||
|
- unsquashfs -force -d "squashfs-root" -no-progress "$SQUASH_TMPFILE" "${f#squashfs-root/}" > /dev/null
|
||||||
|
- ((ret += $?))
|
||||||
|
- fi
|
||||||
|
+ case $f in
|
||||||
|
+ squashfs-root/*)
|
||||||
|
+ extract_squash_img || continue
|
||||||
|
+ unsquashfs -force -d "squashfs-root" -no-progress "$SQUASH_TMPFILE" "${f#squashfs-root/}" > /dev/null
|
||||||
|
+ ((ret += $?))
|
||||||
|
+ ;;
|
||||||
|
+ erofs-root/*)
|
||||||
|
+ extract_squash_img || continue
|
||||||
|
+ mkdir -p "${f%/*}"
|
||||||
|
+ cp -rf "$SQUASH_EXTRACT/$f" "$f"
|
||||||
|
+ ;;
|
||||||
|
+ *)
|
||||||
|
+ $CAT "$image" 2> /dev/null | cpio -id --quiet $verbose "$f"
|
||||||
|
+ ((ret += $?))
|
||||||
|
+ ;;
|
||||||
|
+ esac
|
||||||
|
done
|
||||||
|
else
|
||||||
|
$CAT "$image" 2> /dev/null | cpio -id --quiet $verbose
|
||||||
|
((ret += $?))
|
||||||
|
- $CAT "$image" 2> /dev/null | cpio --extract --verbose --quiet --to-stdout -- \
|
||||||
|
- $SQUASH_IMG > "$SQUASH_TMPFILE" 2> /dev/null
|
||||||
|
- if [[ -s $SQUASH_TMPFILE ]]; then
|
||||||
|
- unsquashfs -d "squashfs-root" -no-progress "$SQUASH_TMPFILE" > /dev/null
|
||||||
|
- ((ret += $?))
|
||||||
|
- fi
|
||||||
|
+
|
||||||
|
+ extract_squash_img || return 0
|
||||||
|
+ case $SQUASH_TMPFILE in
|
||||||
|
+ */squash-root.img | */squashfs-root.img)
|
||||||
|
+ unsquashfs -d "squashfs-root" -no-progress "$SQUASH_TMPFILE" > /dev/null
|
||||||
|
+ ((ret += $?))
|
||||||
|
+ ;;
|
||||||
|
+ */erofs-root.img)
|
||||||
|
+ cp -rf "$SQUASH_EXTRACT/erofs-root" .
|
||||||
|
+ ;;
|
||||||
|
+ esac
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
--
|
||||||
|
2.42.0
|
||||||
|
|
@ -0,0 +1,59 @@
|
|||||||
|
From 0d90ae671e130b631383fb481a1f38a175167eff Mon Sep 17 00:00:00 2001
|
||||||
|
From: Philipp Rudo <prudo@redhat.com>
|
||||||
|
Date: Tue, 30 Jul 2024 17:24:28 +0200
|
||||||
|
Subject: [PATCH 21/24] feat(dracut-initramfs-restore): unpack erofs images
|
||||||
|
|
||||||
|
Follow the example for squashfs images and also unpack erofs images in
|
||||||
|
dracut-initramfs-restore.
|
||||||
|
|
||||||
|
Signed-off-by: Philipp Rudo <prudo@redhat.com>
|
||||||
|
|
||||||
|
(cherry picked from commit b390e194911835e6bd24eeeb0946e374852b8ddc)
|
||||||
|
|
||||||
|
Resolves: RHEL-43460
|
||||||
|
---
|
||||||
|
dracut-initramfs-restore.sh | 10 ++++++++--
|
||||||
|
modules.d/95squash-erofs/module-setup.sh | 2 +-
|
||||||
|
2 files changed, 9 insertions(+), 3 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/dracut-initramfs-restore.sh b/dracut-initramfs-restore.sh
|
||||||
|
index cc561b22..015160b7 100755
|
||||||
|
--- a/dracut-initramfs-restore.sh
|
||||||
|
+++ b/dracut-initramfs-restore.sh
|
||||||
|
@@ -74,12 +74,18 @@ else
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
-if [[ -d squash ]]; then
|
||||||
|
- if ! unsquashfs -no-xattrs -f -d . squash-root.img > /dev/null; then
|
||||||
|
+if [[ -f squashfs-root.img ]]; then
|
||||||
|
+ if ! unsquashfs -no-xattrs -f -d . squashfs-root.img > /dev/null; then
|
||||||
|
echo "Squash module is enabled for this initramfs but failed to unpack squash-root.img" >&2
|
||||||
|
rm -f -- /run/initramfs/shutdown
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
+elif [[ -f erofs-root.img ]]; then
|
||||||
|
+ if ! fsck.erofs --extract=. --overwrite erofs-root.img > /dev/null; then
|
||||||
|
+ echo "Squash module is enabled for this initramfs but failed to unpack erofs-root.img" >&2
|
||||||
|
+ rm -f -- /run/initramfs/shutdown
|
||||||
|
+ exit 1
|
||||||
|
+ fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
if grep -q -w selinux /sys/kernel/security/lsm 2> /dev/null \
|
||||||
|
diff --git a/modules.d/95squash-erofs/module-setup.sh b/modules.d/95squash-erofs/module-setup.sh
|
||||||
|
index 71c2b672..d763a902 100755
|
||||||
|
--- a/modules.d/95squash-erofs/module-setup.sh
|
||||||
|
+++ b/modules.d/95squash-erofs/module-setup.sh
|
||||||
|
@@ -1,7 +1,7 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
check() {
|
||||||
|
- require_binaries mkfs.erofs || return 1
|
||||||
|
+ require_binaries mkfs.erofs fsck.erofs || return 1
|
||||||
|
require_kernel_modules erofs || return 1
|
||||||
|
|
||||||
|
return 255
|
||||||
|
--
|
||||||
|
2.42.0
|
||||||
|
|
@ -0,0 +1,55 @@
|
|||||||
|
From a3ca60929c50f1a1d41cf4567e3a4a8231a92642 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Philipp Rudo <prudo@redhat.com>
|
||||||
|
Date: Tue, 30 Jul 2024 13:35:17 +0200
|
||||||
|
Subject: [PATCH 22/24] fix(squash): explicitly create required directories
|
||||||
|
|
||||||
|
At the moment 99squash relies on dracut-install to create the required
|
||||||
|
directories it later links to. This approach is error prone and will
|
||||||
|
cause problems when switching to use 99busybox later on, which tries to
|
||||||
|
add a link to /usr/sbin that hasn't been created. Thus explicitly
|
||||||
|
create the expected directories before installing the minimal initrd.
|
||||||
|
|
||||||
|
Signed-off-by: Philipp Rudo <prudo@redhat.com>
|
||||||
|
(cherry picked from commit dde95b10ff6b28330370fd697350f8bc5da422da)
|
||||||
|
|
||||||
|
Related: RHEL-43460
|
||||||
|
---
|
||||||
|
modules.d/99squash/module-setup.sh | 13 +++++++------
|
||||||
|
1 file changed, 7 insertions(+), 6 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/modules.d/99squash/module-setup.sh b/modules.d/99squash/module-setup.sh
|
||||||
|
index 5cbbec63..6aa649b7 100755
|
||||||
|
--- a/modules.d/99squash/module-setup.sh
|
||||||
|
+++ b/modules.d/99squash/module-setup.sh
|
||||||
|
@@ -40,12 +40,15 @@ squash_get_handler() {
|
||||||
|
}
|
||||||
|
|
||||||
|
squash_install() {
|
||||||
|
- local _busybox
|
||||||
|
+ local _busybox _dir
|
||||||
|
_busybox=$(find_binary busybox)
|
||||||
|
|
||||||
|
- # Create mount points for squash loader
|
||||||
|
- mkdir -p "$initdir"/squash/
|
||||||
|
- mkdir -p "$squashdir"/squash/
|
||||||
|
+ # Create mount points for squash loader and basic directories
|
||||||
|
+ mkdir -p "$initdir"/squash
|
||||||
|
+ for _dir in squash usr/bin usr/sbin usr/lib; do
|
||||||
|
+ mkdir -p "$squashdir/$_dir"
|
||||||
|
+ [[ $_dir == usr/* ]] && ln_r "/$_dir" "${_dir#usr}"
|
||||||
|
+ done
|
||||||
|
|
||||||
|
# Install required modules and binaries for the squash image init script.
|
||||||
|
if [[ $_busybox ]]; then
|
||||||
|
@@ -67,8 +70,6 @@ squash_install() {
|
||||||
|
dracut_kernel_post
|
||||||
|
|
||||||
|
# Install squash image init script.
|
||||||
|
- ln_r /usr/bin /bin
|
||||||
|
- ln_r /usr/sbin /sbin
|
||||||
|
inst_simple "$moddir"/init-squash.sh /init
|
||||||
|
|
||||||
|
# make sure that library links are correct and up to date for squash loader
|
||||||
|
--
|
||||||
|
2.42.0
|
||||||
|
|
@ -0,0 +1,64 @@
|
|||||||
|
From a6e8e41cd1d67bb4ee64b2bf107e98c18bf8afdf Mon Sep 17 00:00:00 2001
|
||||||
|
From: Philipp Rudo <prudo@redhat.com>
|
||||||
|
Date: Tue, 30 Jul 2024 13:44:32 +0200
|
||||||
|
Subject: [PATCH 23/24] fix(squash): use 99busybox instead of installing it
|
||||||
|
manually
|
||||||
|
|
||||||
|
Make use of 99busybox in 99squash rather than installing it manually.
|
||||||
|
This not only removes duplicate code but allows mixing of busybox with
|
||||||
|
tools from coreutils. This requires a small change in 99busybox to
|
||||||
|
remove the hard coded use of $initdir.
|
||||||
|
|
||||||
|
Suggested-by: Laszlo Gombos <laszlo.gombos@gmail.com>
|
||||||
|
Signed-off-by: Philipp Rudo <prudo@redhat.com>
|
||||||
|
|
||||||
|
(cherry picked from commit 395366278f473038badba239f76cac391428b149)
|
||||||
|
|
||||||
|
Related: RHEL-43460
|
||||||
|
---
|
||||||
|
modules.d/05busybox/module-setup.sh | 5 +++++
|
||||||
|
modules.d/99squash/module-setup.sh | 5 +----
|
||||||
|
2 files changed, 6 insertions(+), 4 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/modules.d/05busybox/module-setup.sh b/modules.d/05busybox/module-setup.sh
|
||||||
|
index 86b3761a..857145c9 100755
|
||||||
|
--- a/modules.d/05busybox/module-setup.sh
|
||||||
|
+++ b/modules.d/05busybox/module-setup.sh
|
||||||
|
@@ -15,6 +15,7 @@ depends() {
|
||||||
|
# called by dracut
|
||||||
|
install() {
|
||||||
|
local _i _path _busybox
|
||||||
|
+ local _dstdir="${dstdir:-"$initdir"}"
|
||||||
|
local _progs=()
|
||||||
|
_busybox=$(find_binary busybox)
|
||||||
|
inst "$_busybox" /usr/bin/busybox
|
||||||
|
@@ -26,6 +27,10 @@ install() {
|
||||||
|
for _i in "${_progs[@]}"; do
|
||||||
|
_path=$(find_binary "$_i")
|
||||||
|
[ -z "$_path" ] && continue
|
||||||
|
+
|
||||||
|
+ # do not remove existing destination files
|
||||||
|
+ [ -e "${_dstdir}/$_path" ] && continue
|
||||||
|
+
|
||||||
|
ln_r /usr/bin/busybox "$_path"
|
||||||
|
done
|
||||||
|
}
|
||||||
|
diff --git a/modules.d/99squash/module-setup.sh b/modules.d/99squash/module-setup.sh
|
||||||
|
index 6aa649b7..56f70774 100755
|
||||||
|
--- a/modules.d/99squash/module-setup.sh
|
||||||
|
+++ b/modules.d/99squash/module-setup.sh
|
||||||
|
@@ -52,10 +52,7 @@ squash_install() {
|
||||||
|
|
||||||
|
# Install required modules and binaries for the squash image init script.
|
||||||
|
if [[ $_busybox ]]; then
|
||||||
|
- inst "$_busybox" /usr/bin/busybox
|
||||||
|
- for _i in sh echo mount modprobe mkdir switch_root grep umount; do
|
||||||
|
- ln_r /usr/bin/busybox /usr/bin/$_i
|
||||||
|
- done
|
||||||
|
+ module_install "busybox"
|
||||||
|
else
|
||||||
|
DRACUT_RESOLVE_DEPS=1 inst_multiple sh mount modprobe mkdir switch_root grep umount
|
||||||
|
|
||||||
|
--
|
||||||
|
2.42.0
|
||||||
|
|
@ -0,0 +1,69 @@
|
|||||||
|
From 3b4fe88a4259ec576a41d98b6aaee324a6b48b0f Mon Sep 17 00:00:00 2001
|
||||||
|
From: "Brian C. Lane" <bcl@redhat.com>
|
||||||
|
Date: Wed, 10 Jul 2024 16:30:09 -0700
|
||||||
|
Subject: [PATCH 24/24] feat(dmdquash-live): add support for using erofs
|
||||||
|
|
||||||
|
This adds support for rootfs compressed with erofs. Either as a plain
|
||||||
|
erofs image or a LiveOS/rootfs.img ext4 filesystem compressed with
|
||||||
|
erofs.
|
||||||
|
|
||||||
|
This patch does not make any attempt to change the squashfs directory
|
||||||
|
naming (or variable names) in order to make these changes as small as
|
||||||
|
possible and easy to review. It also does not make any attempt to
|
||||||
|
support the multitude of available options other than what is needed by
|
||||||
|
anaconda-dracut calling this script to setup the boot.iso root
|
||||||
|
filesystem.
|
||||||
|
|
||||||
|
(which isn't to say it doesn't work, it just hasn't been tested and is
|
||||||
|
outside the scope of this change).
|
||||||
|
|
||||||
|
(cherry picked commit ca5ae5d3466eec40d118fc96d450478aa6faebb6)
|
||||||
|
|
||||||
|
Resolves: RHEL-43460
|
||||||
|
---
|
||||||
|
modules.d/90dmsquash-live/dmsquash-live-root.sh | 10 +++++-----
|
||||||
|
1 file changed, 5 insertions(+), 5 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/modules.d/90dmsquash-live/dmsquash-live-root.sh b/modules.d/90dmsquash-live/dmsquash-live-root.sh
|
||||||
|
index 4518852b..a376185e 100755
|
||||||
|
--- a/modules.d/90dmsquash-live/dmsquash-live-root.sh
|
||||||
|
+++ b/modules.d/90dmsquash-live/dmsquash-live-root.sh
|
||||||
|
@@ -97,7 +97,6 @@ det_img_fs() {
|
||||||
|
blkid -s TYPE -u noraid -o value "$1"
|
||||||
|
}
|
||||||
|
|
||||||
|
-load_fstype squashfs
|
||||||
|
CMDLINE=$(getcmdline)
|
||||||
|
for arg in $CMDLINE; do
|
||||||
|
case $arg in
|
||||||
|
@@ -112,14 +111,15 @@ if [ -f "$livedev" ]; then
|
||||||
|
# check filesystem type and handle accordingly
|
||||||
|
fstype=$(det_img_fs "$livedev")
|
||||||
|
case $fstype in
|
||||||
|
- squashfs) SQUASHED=$livedev ;;
|
||||||
|
- auto) die "cannot mount live image (unknown filesystem type)" ;;
|
||||||
|
+ squashfs | erofs) SQUASHED=$livedev ;;
|
||||||
|
+ auto) die "cannot mount live image (unknown filesystem type $fstype)" ;;
|
||||||
|
*) FSIMG=$livedev ;;
|
||||||
|
esac
|
||||||
|
load_fstype "$fstype"
|
||||||
|
else
|
||||||
|
livedev_fstype=$(det_fs "$livedev")
|
||||||
|
- if [ "$livedev_fstype" = "squashfs" ]; then
|
||||||
|
+ load_fstype "$livedev_fstype"
|
||||||
|
+ if [ "$livedev_fstype" = "squashfs" ] || [ "$livedev_fstype" = "erofs" ]; then
|
||||||
|
# no mount needed - we've already got the LiveOS image in $livedev
|
||||||
|
SQUASHED=$livedev
|
||||||
|
elif [ "$livedev_fstype" != "ntfs" ]; then
|
||||||
|
@@ -336,7 +336,7 @@ if [ -e "$SQUASHED" ]; then
|
||||||
|
SQUASHED_LOOPDEV=$(losetup -f)
|
||||||
|
losetup -r "$SQUASHED_LOOPDEV" $SQUASHED
|
||||||
|
mkdir -m 0755 -p /run/initramfs/squashfs
|
||||||
|
- mount -n -t squashfs -o ro "$SQUASHED_LOOPDEV" /run/initramfs/squashfs
|
||||||
|
+ mount -n -o ro "$SQUASHED_LOOPDEV" /run/initramfs/squashfs
|
||||||
|
|
||||||
|
if [ -d /run/initramfs/squashfs/LiveOS ]; then
|
||||||
|
if [ -f /run/initramfs/squashfs/LiveOS/rootfs.img ]; then
|
||||||
|
--
|
||||||
|
2.42.0
|
||||||
|
|
@ -0,0 +1,39 @@
|
|||||||
|
From 458e2a42d6921cedb67623b68f6e310145f4b129 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Lukas Nykryn <lnykryn@redhat.com>
|
||||||
|
Date: Mon, 19 Jul 2021 11:27:28 +0200
|
||||||
|
Subject: [PATCH 25/31] fix(nfs): set correct ownership and permissions for
|
||||||
|
statd directory
|
||||||
|
|
||||||
|
The directory ownership for the statd directory should be
|
||||||
|
rpcuser:rpcuser.
|
||||||
|
|
||||||
|
(cherry picked from commit ed5ab5787177f2be8a620a8d2d63a9ad26fbf149 from PR#583)
|
||||||
|
|
||||||
|
Resolves: RHEL-53361
|
||||||
|
---
|
||||||
|
modules.d/95nfs/module-setup.sh | 9 +++++++--
|
||||||
|
1 file changed, 7 insertions(+), 2 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/modules.d/95nfs/module-setup.sh b/modules.d/95nfs/module-setup.sh
|
||||||
|
index abe1ee59..da6549d1 100755
|
||||||
|
--- a/modules.d/95nfs/module-setup.sh
|
||||||
|
+++ b/modules.d/95nfs/module-setup.sh
|
||||||
|
@@ -120,8 +120,13 @@ install() {
|
||||||
|
mkdir -m 0755 -p "$initdir/var/lib/nfs"
|
||||||
|
mkdir -m 0755 -p "$initdir/var/lib/nfs/rpc_pipefs"
|
||||||
|
mkdir -m 0770 -p "$initdir/var/lib/rpcbind"
|
||||||
|
- [ -d "/var/lib/nfs/statd/sm" ] && mkdir -m 0755 -p "$initdir/var/lib/nfs/statd/sm"
|
||||||
|
- [ -d "/var/lib/nfs/sm" ] && mkdir -m 0755 -p "$initdir/var/lib/nfs/sm"
|
||||||
|
+ [ -d "$dracutsysrootdir/var/lib/nfs/statd/sm" ] \
|
||||||
|
+ && mkdir -m 0700 -p "$initdir/var/lib/nfs/statd" \
|
||||||
|
+ && mkdir -m 0755 -p "$initdir/var/lib/nfs/statd/sm" \
|
||||||
|
+ && chown -R rpcuser:rpcuser "$initdir/var/lib/nfs/statd"
|
||||||
|
+ [ -d "$dracutsysrootdir/var/lib/nfs/sm" ] \
|
||||||
|
+ && mkdir -m 0755 -p "$initdir/var/lib/nfs/sm" \
|
||||||
|
+ && chown -R rpcuser:rpcuser "$initdir/var/lib/nfs/sm"
|
||||||
|
|
||||||
|
# Rather than copy the passwd file in, just set a user for rpcbind
|
||||||
|
# We'll save the state and restart the daemon from the root anyway
|
||||||
|
--
|
||||||
|
2.42.0
|
||||||
|
|
@ -0,0 +1,42 @@
|
|||||||
|
From 23a7d5d4752dd4273f406cf1729b2d98f39d0aa5 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Pavel Valena <pvalena@redhat.com>
|
||||||
|
Date: Sat, 17 Aug 2024 00:39:17 +0200
|
||||||
|
Subject: [PATCH 26/31] fix(resume): do not include resume if swap is on
|
||||||
|
netdevice
|
||||||
|
|
||||||
|
Additional fix, restoring previous behavior identical to RHEL-9.
|
||||||
|
|
||||||
|
rhel-only
|
||||||
|
|
||||||
|
Resolves: RHEL-53350
|
||||||
|
---
|
||||||
|
modules.d/95resume/module-setup.sh | 6 +++---
|
||||||
|
1 file changed, 3 insertions(+), 3 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/modules.d/95resume/module-setup.sh b/modules.d/95resume/module-setup.sh
|
||||||
|
index c0f04a6c..785f681a 100755
|
||||||
|
--- a/modules.d/95resume/module-setup.sh
|
||||||
|
+++ b/modules.d/95resume/module-setup.sh
|
||||||
|
@@ -4,9 +4,6 @@
|
||||||
|
# shellcheck disable=SC2317
|
||||||
|
check() {
|
||||||
|
|
||||||
|
- # Always include resume module
|
||||||
|
- return 0
|
||||||
|
-
|
||||||
|
swap_on_netdevice() {
|
||||||
|
local _dev
|
||||||
|
for _dev in "${swap_devs[@]}"; do
|
||||||
|
@@ -23,6 +20,9 @@ check() {
|
||||||
|
# hibernation support requested on kernel command line
|
||||||
|
return 0
|
||||||
|
else
|
||||||
|
+ # always include resume module when not on netdevice
|
||||||
|
+ return 0
|
||||||
|
+
|
||||||
|
# resume= not set on kernel command line
|
||||||
|
if [[ -f /sys/power/resume ]]; then
|
||||||
|
if [[ "$(< /sys/power/resume)" == "0:0" ]]; then
|
||||||
|
--
|
||||||
|
2.42.0
|
||||||
|
|
@ -0,0 +1,44 @@
|
|||||||
|
From 101ee8a01d36d93b23749a67c337a2833f8ce1d3 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Pavel Valena <pvalena@redhat.com>
|
||||||
|
Date: Sat, 17 Aug 2024 01:43:50 +0200
|
||||||
|
Subject: [PATCH 27/31] feat(dracut-init.sh): give --force-add precedence over
|
||||||
|
--omit
|
||||||
|
|
||||||
|
This gives precedence of force_add_dracutmodules to omit_dracutmodules,
|
||||||
|
as there is not other way to override omit_dracutmodules list, and users
|
||||||
|
would expect it to be overriden from command line.
|
||||||
|
|
||||||
|
Ref: https://github.com/dracut-ng/dracut-ng/pull/569
|
||||||
|
|
||||||
|
This way, `--add` retains it behaviour, and `--force-add` gains additional
|
||||||
|
functionality in non-hostonly mode. The module may still be skipped
|
||||||
|
if the module check returns 1, but it should throw error (as I'd expect
|
||||||
|
for `--force-add`).
|
||||||
|
|
||||||
|
(cherry picked commit a669346f48cbb3278c51ba5e95b1b91f9bfdee0a from PR#584)
|
||||||
|
|
||||||
|
Resolves: RHEL-53791
|
||||||
|
---
|
||||||
|
dracut-init.sh | 6 ++++--
|
||||||
|
1 file changed, 4 insertions(+), 2 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/dracut-init.sh b/dracut-init.sh
|
||||||
|
index 840c6167..5d5fc081 100755
|
||||||
|
--- a/dracut-init.sh
|
||||||
|
+++ b/dracut-init.sh
|
||||||
|
@@ -960,8 +960,10 @@ check_module() {
|
||||||
|
[[ $2 ]] || mods_checked_as_dep+=" $_mod "
|
||||||
|
|
||||||
|
if [[ " $omit_dracutmodules " == *\ $_mod\ * ]]; then
|
||||||
|
- ddebug "Module '$_mod' will not be installed, because it's in the list to be omitted!"
|
||||||
|
- return 1
|
||||||
|
+ if [[ " $force_add_dracutmodules " != *\ $_mod\ * ]]; then
|
||||||
|
+ ddebug "Module '$_mod' will not be installed, because it's in the list to be omitted!"
|
||||||
|
+ return 1
|
||||||
|
+ fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [[ " $dracutmodules $add_dracutmodules $force_add_dracutmodules" == *\ $_mod\ * ]]; then
|
||||||
|
--
|
||||||
|
2.42.0
|
||||||
|
|
@ -0,0 +1,36 @@
|
|||||||
|
From afd17820980728f18a5cc96e794d4c56a8694698 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Pavel Valena <pvalena@redhat.com>
|
||||||
|
Date: Fri, 16 Aug 2024 20:40:15 +0200
|
||||||
|
Subject: [PATCH 28/31] feat(lsinitrd.sh): look for initrd in /usr/lib/modules/
|
||||||
|
|
||||||
|
Introduce new path for lsinitrd.sh to look into:
|
||||||
|
|
||||||
|
/usr/lib/modules/$kver/initramfs.img
|
||||||
|
|
||||||
|
Which is valid on all ostree-based systems, and also other image based
|
||||||
|
systems with pre-generated initramfs.
|
||||||
|
|
||||||
|
Ref: https://issues.redhat.com/browse/RHEL-35890
|
||||||
|
(cherry picked from commit 22ae6ecaf9ecdb9db3e79aa9a72d527e7436c282)
|
||||||
|
|
||||||
|
Resolves: RHEL-54650
|
||||||
|
---
|
||||||
|
lsinitrd.sh | 2 ++
|
||||||
|
1 file changed, 2 insertions(+)
|
||||||
|
|
||||||
|
diff --git a/lsinitrd.sh b/lsinitrd.sh
|
||||||
|
index 952dbc9f..429cce7e 100755
|
||||||
|
--- a/lsinitrd.sh
|
||||||
|
+++ b/lsinitrd.sh
|
||||||
|
@@ -136,6 +136,8 @@ else
|
||||||
|
image="/lib/modules/${KERNEL_VERSION}/initramfs.img"
|
||||||
|
elif [[ -f /boot/initramfs-${KERNEL_VERSION}.img ]]; then
|
||||||
|
image="/boot/initramfs-${KERNEL_VERSION}.img"
|
||||||
|
+ elif [[ -f /usr/lib/modules/${KERNEL_VERSION}/initramfs.img ]]; then
|
||||||
|
+ image="/usr/lib/modules/${KERNEL_VERSION}/initramfs.img"
|
||||||
|
elif [[ $MACHINE_ID ]] \
|
||||||
|
&& mountpoint -q /efi; then
|
||||||
|
image="/efi/${MACHINE_ID}/${KERNEL_VERSION}/initrd"
|
||||||
|
--
|
||||||
|
2.42.0
|
||||||
|
|
@ -0,0 +1,28 @@
|
|||||||
|
From 833ca2c3832f1939a9a9729ed66c20d2a5fbf1fa Mon Sep 17 00:00:00 2001
|
||||||
|
From: Pavel Valena <pvalena@redhat.com>
|
||||||
|
Date: Mon, 19 Aug 2024 09:41:27 +0200
|
||||||
|
Subject: [PATCH 29/31] feat(fips): include fips module unconditionally
|
||||||
|
|
||||||
|
rhel-only
|
||||||
|
|
||||||
|
Resolves: RHEL-39404
|
||||||
|
---
|
||||||
|
modules.d/01fips/module-setup.sh | 2 +-
|
||||||
|
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||||
|
|
||||||
|
diff --git a/modules.d/01fips/module-setup.sh b/modules.d/01fips/module-setup.sh
|
||||||
|
index 83fcd564..5ce1f201 100755
|
||||||
|
--- a/modules.d/01fips/module-setup.sh
|
||||||
|
+++ b/modules.d/01fips/module-setup.sh
|
||||||
|
@@ -2,7 +2,7 @@
|
||||||
|
|
||||||
|
# called by dracut
|
||||||
|
check() {
|
||||||
|
- return 255
|
||||||
|
+ return 0
|
||||||
|
}
|
||||||
|
|
||||||
|
# called by dracut
|
||||||
|
--
|
||||||
|
2.42.0
|
||||||
|
|
@ -0,0 +1,40 @@
|
|||||||
|
From e1ae840425837004bacafe53c53468207aa513e3 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Pavel Valena <pvalena@redhat.com>
|
||||||
|
Date: Thu, 8 Aug 2024 00:55:03 +0200
|
||||||
|
Subject: [PATCH 30/31] fix(nfs): include also entries from
|
||||||
|
/usr/lib/{passwd,group}
|
||||||
|
|
||||||
|
as those paths are used by bootc instead of the /etc ones.
|
||||||
|
|
||||||
|
(cherry picked from commit 45cdf3c4f24f77f04b264a7747f115d1031b2e67)
|
||||||
|
|
||||||
|
Resolves: RHEL-53431
|
||||||
|
---
|
||||||
|
modules.d/95nfs/module-setup.sh | 11 +++++++++--
|
||||||
|
1 file changed, 9 insertions(+), 2 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/modules.d/95nfs/module-setup.sh b/modules.d/95nfs/module-setup.sh
|
||||||
|
index da6549d1..df2d0e05 100755
|
||||||
|
--- a/modules.d/95nfs/module-setup.sh
|
||||||
|
+++ b/modules.d/95nfs/module-setup.sh
|
||||||
|
@@ -130,8 +130,15 @@ install() {
|
||||||
|
|
||||||
|
# Rather than copy the passwd file in, just set a user for rpcbind
|
||||||
|
# We'll save the state and restart the daemon from the root anyway
|
||||||
|
- grep -E '^nfsnobody:|^rpc:|^rpcuser:' "$dracutsysrootdir"/etc/passwd >> "$initdir/etc/passwd"
|
||||||
|
- grep -E '^nogroup:|^rpc:|^nobody:' "$dracutsysrootdir"/etc/group >> "$initdir/etc/group"
|
||||||
|
+ local _confdir
|
||||||
|
+ for _confdir in etc usr/lib; do
|
||||||
|
+
|
||||||
|
+ grep -sE '^(nfsnobody|_rpc|rpc|rpcuser):' "${dracutsysrootdir}/${_confdir}/passwd" \
|
||||||
|
+ >> "$initdir/${_confdir}/passwd"
|
||||||
|
+
|
||||||
|
+ grep -sE '^(nogroup|rpc|nobody):' "${dracutsysrootdir}/${_confdir}/group" \
|
||||||
|
+ >> "$initdir/${_confdir}/group"
|
||||||
|
+ done
|
||||||
|
|
||||||
|
dracut_need_initqueue
|
||||||
|
}
|
||||||
|
--
|
||||||
|
2.42.0
|
||||||
|
|
@ -0,0 +1,39 @@
|
|||||||
|
From d18bbc304e838ecf3b888ce4d70f1d96d21821f5 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Daniel McIlvaney <damcilva@microsoft.com>
|
||||||
|
Date: Fri, 7 Jun 2024 11:38:54 -0700
|
||||||
|
Subject: [PATCH 31/31] fix(dracut-functions): avoid awk in get_maj_min()
|
||||||
|
|
||||||
|
The `get_maj_min()` cache lookup is commonly used
|
||||||
|
across many flows. While `awk` should be available,
|
||||||
|
some highly constrained environments may not have it.
|
||||||
|
A second call to `grep` can provide the same behaviour
|
||||||
|
without adding a dependnecy.
|
||||||
|
|
||||||
|
Lines in the cache will be of the form "/dev/sda2 8:2".
|
||||||
|
`awk '{print $NF}'` returns the last word of a matching line. Since
|
||||||
|
the initial matching regex is so specific a second call to grep can
|
||||||
|
easily extract the last word.
|
||||||
|
|
||||||
|
(cherry picked commit ec7efd5701e9a1b24f2e85666d625fb1fe46ce86)
|
||||||
|
|
||||||
|
Related: RHEL-47145
|
||||||
|
---
|
||||||
|
dracut-functions.sh | 2 +-
|
||||||
|
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||||
|
|
||||||
|
diff --git a/dracut-functions.sh b/dracut-functions.sh
|
||||||
|
index 43d905e3..b4d57454 100755
|
||||||
|
--- a/dracut-functions.sh
|
||||||
|
+++ b/dracut-functions.sh
|
||||||
|
@@ -243,7 +243,7 @@ get_maj_min() {
|
||||||
|
local _out
|
||||||
|
|
||||||
|
if [[ $get_maj_min_cache_file ]]; then
|
||||||
|
- _out="$(grep -m1 -oE "^${1//\\/\\\\} \S+$" "$get_maj_min_cache_file" | awk '{print $NF}')"
|
||||||
|
+ _out="$(grep -m1 -oE "^${1//\\/\\\\} \S+$" "$get_maj_min_cache_file" | grep -oE "\S+$")"
|
||||||
|
fi
|
||||||
|
|
||||||
|
if ! [[ "$_out" ]]; then
|
||||||
|
--
|
||||||
|
2.42.0
|
||||||
|
|
@ -0,0 +1,73 @@
|
|||||||
|
From 7a580a481f8b2d2df60a5e7b9da5c4a11ed9ecbf Mon Sep 17 00:00:00 2001
|
||||||
|
From: Philipp Rudo <prudo@redhat.com>
|
||||||
|
Date: Mon, 26 Aug 2024 15:58:54 +0200
|
||||||
|
Subject: [PATCH 32/35] revert(dracut-init.sh): add module to mods_to_load
|
||||||
|
before checking dependencies
|
||||||
|
|
||||||
|
Commit d0f8fde5 ("fix(dracut-init.sh): add module to mods_to_load before
|
||||||
|
checking dependencies") introduced a regression. When dracut is in
|
||||||
|
"auto" mode, i.e. '--modules auto' or no --modules is provided, the
|
||||||
|
expected behavior is that all modules that return 0 in their check()
|
||||||
|
function are included. Except for the ones where the dependencies cannot
|
||||||
|
be installed. The commit however, caused those modules to be included
|
||||||
|
without their dependencies. Thus revert the commit.
|
||||||
|
|
||||||
|
This reverts commit d0f8fde5668cfd7fda1d15824e268b4949b4fd04.
|
||||||
|
|
||||||
|
Reported-by: Jo Zzsi <jozzsicsataban@gmail.com>
|
||||||
|
Signed-off-by: Philipp Rudo <prudo@redhat.com>
|
||||||
|
|
||||||
|
(cherry picked from commit bddbb11bbbfc405317a6fbd53bb189b575d46da2)
|
||||||
|
|
||||||
|
Resolves: RHEL-43460
|
||||||
|
---
|
||||||
|
dracut-init.sh | 12 ++++++------
|
||||||
|
1 file changed, 6 insertions(+), 6 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/dracut-init.sh b/dracut-init.sh
|
||||||
|
index 5d5fc081..756a0a75 100755
|
||||||
|
--- a/dracut-init.sh
|
||||||
|
+++ b/dracut-init.sh
|
||||||
|
@@ -915,9 +915,6 @@ check_mount() {
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
- [[ " $mods_to_load " == *\ $_mod\ * ]] \
|
||||||
|
- || mods_to_load+=" $_mod "
|
||||||
|
-
|
||||||
|
for _moddep in $(module_depends "$_mod" "$_moddir"); do
|
||||||
|
# handle deps as if they were manually added
|
||||||
|
[[ " $dracutmodules " == *\ $_mod\ * ]] \
|
||||||
|
@@ -936,6 +933,9 @@ check_mount() {
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
+ [[ " $mods_to_load " == *\ $_mod\ * ]] \
|
||||||
|
+ || mods_to_load+=" $_mod "
|
||||||
|
+
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
|
@@ -992,9 +992,6 @@ check_module() {
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
- [[ " $mods_to_load " == *\ $_mod\ * ]] \
|
||||||
|
- || mods_to_load+=" $_mod "
|
||||||
|
-
|
||||||
|
for _moddep in $(module_depends "$_mod" "$_moddir"); do
|
||||||
|
# handle deps as if they were manually added
|
||||||
|
[[ " $dracutmodules " == *\ $_mod\ * ]] \
|
||||||
|
@@ -1013,6 +1010,9 @@ check_module() {
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
+ [[ " $mods_to_load " == *\ $_mod\ * ]] \
|
||||||
|
+ || mods_to_load+=" $_mod "
|
||||||
|
+
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
|
--
|
||||||
|
2.42.0
|
||||||
|
|
@ -0,0 +1,313 @@
|
|||||||
|
From 7e1598536003caf9c6b68e9a4eaf3cef8bfcfeb9 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Philipp Rudo <prudo@redhat.com>
|
||||||
|
Date: Mon, 26 Aug 2024 15:23:41 +0200
|
||||||
|
Subject: [PATCH 33/35] fix(squash): remove cyclic dependency
|
||||||
|
|
||||||
|
With commit d0f8fde5 ("fix(dracut-init.sh): add module to mods_to_load
|
||||||
|
before checking dependencies") reverted 99squash can no longer rely on
|
||||||
|
dracut_module_included working as expected in its check() and depends()
|
||||||
|
function. Solve this problem by breaking up the cyclic dependency
|
||||||
|
between 99squash and 95squash-{squashfs,erofs} as the commit was
|
||||||
|
originally introduced to allow this cyclic dependency.
|
||||||
|
|
||||||
|
This requires to move all code shared by 95squash-{squashfs,erofs} from
|
||||||
|
99squash to a new 99squash-lib module and update the dependencies
|
||||||
|
accordingly. In addition update the checks in dracut.sh to check for
|
||||||
|
99squash-lib as 99squash is no longer guaranteed to be included.
|
||||||
|
Finally make sure that 99squash-lib isn't included without a back
|
||||||
|
end.
|
||||||
|
|
||||||
|
While at it improve and align the error messages in 99squash and
|
||||||
|
99squash-lib.
|
||||||
|
|
||||||
|
Signed-off-by: Philipp Rudo <prudo@redhat.com>
|
||||||
|
(cherry picked from commit d5783635950e38cccf334e7163db79f280650fa2)
|
||||||
|
|
||||||
|
Resolves: RHEL-43460
|
||||||
|
---
|
||||||
|
dracut.sh | 6 +-
|
||||||
|
modules.d/95squash-erofs/module-setup.sh | 2 +-
|
||||||
|
modules.d/95squash-squashfs/module-setup.sh | 2 +-
|
||||||
|
.../{99squash => 99squash-lib}/init-squash.sh | 0
|
||||||
|
modules.d/99squash-lib/module-setup.sh | 101 ++++++++++++++++++
|
||||||
|
modules.d/99squash/module-setup.sh | 80 +-------------
|
||||||
|
6 files changed, 110 insertions(+), 81 deletions(-)
|
||||||
|
rename modules.d/{99squash => 99squash-lib}/init-squash.sh (100%)
|
||||||
|
create mode 100755 modules.d/99squash-lib/module-setup.sh
|
||||||
|
|
||||||
|
diff --git a/dracut.sh b/dracut.sh
|
||||||
|
index 68bdf33b..71568fe0 100755
|
||||||
|
--- a/dracut.sh
|
||||||
|
+++ b/dracut.sh
|
||||||
|
@@ -1911,7 +1911,7 @@ if [[ $kernel_only != yes ]]; then
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
-dracut_module_included "squash" && mkdir -p "$squashdir"
|
||||||
|
+dracut_module_included "squash-lib" && mkdir -p "$squashdir"
|
||||||
|
|
||||||
|
_isize=0 #initramfs size
|
||||||
|
modules_loaded=" "
|
||||||
|
@@ -2276,9 +2276,9 @@ if [[ $do_strip == yes ]] && ! [[ $DRACUT_FIPS_MODE ]]; then
|
||||||
|
dinfo "*** Stripping files done ***"
|
||||||
|
fi
|
||||||
|
|
||||||
|
-if dracut_module_included "squash"; then
|
||||||
|
+if dracut_module_included "squash-lib"; then
|
||||||
|
dinfo "*** Squashing the files inside the initramfs ***"
|
||||||
|
- DRACUT_SQUASH_POST_INST=1 module_install "squash"
|
||||||
|
+ DRACUT_SQUASH_POST_INST=1 module_install "squash-lib"
|
||||||
|
rm -rf "$squashdir"
|
||||||
|
dinfo "*** Squashing the files inside the initramfs done ***"
|
||||||
|
|
||||||
|
diff --git a/modules.d/95squash-erofs/module-setup.sh b/modules.d/95squash-erofs/module-setup.sh
|
||||||
|
index d763a902..a6e7ad0b 100755
|
||||||
|
--- a/modules.d/95squash-erofs/module-setup.sh
|
||||||
|
+++ b/modules.d/95squash-erofs/module-setup.sh
|
||||||
|
@@ -8,7 +8,7 @@ check() {
|
||||||
|
}
|
||||||
|
|
||||||
|
depends() {
|
||||||
|
- echo "squash"
|
||||||
|
+ echo "squash-lib"
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
|
diff --git a/modules.d/95squash-squashfs/module-setup.sh b/modules.d/95squash-squashfs/module-setup.sh
|
||||||
|
index 83973700..d15586da 100755
|
||||||
|
--- a/modules.d/95squash-squashfs/module-setup.sh
|
||||||
|
+++ b/modules.d/95squash-squashfs/module-setup.sh
|
||||||
|
@@ -8,7 +8,7 @@ check() {
|
||||||
|
}
|
||||||
|
|
||||||
|
depends() {
|
||||||
|
- echo "squash"
|
||||||
|
+ echo "squash-lib"
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
|
diff --git a/modules.d/99squash/init-squash.sh b/modules.d/99squash-lib/init-squash.sh
|
||||||
|
similarity index 100%
|
||||||
|
rename from modules.d/99squash/init-squash.sh
|
||||||
|
rename to modules.d/99squash-lib/init-squash.sh
|
||||||
|
diff --git a/modules.d/99squash-lib/module-setup.sh b/modules.d/99squash-lib/module-setup.sh
|
||||||
|
new file mode 100755
|
||||||
|
index 00000000..6a0b6f85
|
||||||
|
--- /dev/null
|
||||||
|
+++ b/modules.d/99squash-lib/module-setup.sh
|
||||||
|
@@ -0,0 +1,101 @@
|
||||||
|
+#!/bin/bash
|
||||||
|
+
|
||||||
|
+check() {
|
||||||
|
+ require_kernel_modules loop overlay || return 1
|
||||||
|
+
|
||||||
|
+ return 255
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+depends() {
|
||||||
|
+ echo "systemd-initrd"
|
||||||
|
+
|
||||||
|
+ return 0
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+squash_get_handler() {
|
||||||
|
+ local _module _handler
|
||||||
|
+ local -a _modules=(squash-squashfs squash-erofs)
|
||||||
|
+
|
||||||
|
+ for _module in "${_modules[@]}"; do
|
||||||
|
+ if dracut_module_included "$_module"; then
|
||||||
|
+ _handler="$_module"
|
||||||
|
+ break
|
||||||
|
+ fi
|
||||||
|
+ done
|
||||||
|
+
|
||||||
|
+ if [[ -z $_handler ]]; then
|
||||||
|
+ dfatal "Cannot include squash-lib directly. It requires one of: ${_modules[*]}"
|
||||||
|
+ return 1
|
||||||
|
+ fi
|
||||||
|
+
|
||||||
|
+ echo "$_handler"
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+squash_install() {
|
||||||
|
+ local _busybox _dir
|
||||||
|
+
|
||||||
|
+ # verify that there is a valid handler before doing anything
|
||||||
|
+ squash_get_handler > /dev/null || return 1
|
||||||
|
+
|
||||||
|
+ _busybox=$(find_binary busybox)
|
||||||
|
+
|
||||||
|
+ # Create mount points for squash loader and basic directories
|
||||||
|
+ mkdir -p "$initdir"/squash
|
||||||
|
+ for _dir in squash usr/bin usr/sbin usr/lib; do
|
||||||
|
+ mkdir -p "$squashdir/$_dir"
|
||||||
|
+ [[ $_dir == usr/* ]] && ln_r "/$_dir" "${_dir#usr}"
|
||||||
|
+ done
|
||||||
|
+
|
||||||
|
+ # Install required modules and binaries for the squash image init script.
|
||||||
|
+ if [[ $_busybox ]]; then
|
||||||
|
+ module_install "busybox"
|
||||||
|
+ else
|
||||||
|
+ DRACUT_RESOLVE_DEPS=1 inst_multiple sh mount modprobe mkdir switch_root grep umount
|
||||||
|
+
|
||||||
|
+ # libpthread workaround: pthread_cancel wants to dlopen libgcc_s.so
|
||||||
|
+ inst_libdir_file -o "libgcc_s.so*"
|
||||||
|
+
|
||||||
|
+ # FIPS workaround for Fedora/RHEL: libcrypto needs libssl when FIPS is enabled
|
||||||
|
+ [[ $DRACUT_FIPS_MODE ]] && inst_libdir_file -o "libssl.so*"
|
||||||
|
+ fi
|
||||||
|
+
|
||||||
|
+ hostonly="" instmods "loop" "overlay"
|
||||||
|
+ dracut_kernel_post
|
||||||
|
+
|
||||||
|
+ # Install squash image init script.
|
||||||
|
+ inst_simple "$moddir"/init-squash.sh /init
|
||||||
|
+
|
||||||
|
+ # make sure that library links are correct and up to date for squash loader
|
||||||
|
+ build_ld_cache
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+squash_installpost() {
|
||||||
|
+ local _file _handler
|
||||||
|
+
|
||||||
|
+ _handler=$(squash_get_handler)
|
||||||
|
+ [[ -n $_handler ]] || return 1
|
||||||
|
+
|
||||||
|
+ DRACUT_SQUASH_POST_INST=1 module_install "$_handler"
|
||||||
|
+
|
||||||
|
+ # Rescue the dracut spec files so dracut rebuild and lsinitrd can work
|
||||||
|
+ for _file in "$initdir"/usr/lib/dracut/*; do
|
||||||
|
+ [[ -f $_file ]] || continue
|
||||||
|
+ DRACUT_RESOLVE_DEPS=1 dstdir=$squashdir inst "$_file" "${_file#"$initdir"}"
|
||||||
|
+ done
|
||||||
|
+
|
||||||
|
+ # Remove everything that got squashed into the image
|
||||||
|
+ for _file in "$initdir"/*; do
|
||||||
|
+ [[ $_file == "$squashdir" ]] && continue
|
||||||
|
+ rm -rf "$_file"
|
||||||
|
+ done
|
||||||
|
+ mv "$squashdir"/* "$initdir"
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+install() {
|
||||||
|
+
|
||||||
|
+ if [[ $DRACUT_SQUASH_POST_INST ]]; then
|
||||||
|
+ squash_installpost
|
||||||
|
+ else
|
||||||
|
+ dstdir="$squashdir" squash_install
|
||||||
|
+ fi
|
||||||
|
+}
|
||||||
|
diff --git a/modules.d/99squash/module-setup.sh b/modules.d/99squash/module-setup.sh
|
||||||
|
index 56f70774..c48ba2c5 100755
|
||||||
|
--- a/modules.d/99squash/module-setup.sh
|
||||||
|
+++ b/modules.d/99squash/module-setup.sh
|
||||||
|
@@ -1,102 +1,30 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
check() {
|
||||||
|
- require_kernel_modules loop overlay || return 1
|
||||||
|
-
|
||||||
|
return 255
|
||||||
|
}
|
||||||
|
|
||||||
|
depends() {
|
||||||
|
- local _handler
|
||||||
|
-
|
||||||
|
- _handler=$(squash_get_handler) || return 1
|
||||||
|
-
|
||||||
|
- echo "systemd-initrd $_handler"
|
||||||
|
- return 0
|
||||||
|
-}
|
||||||
|
-
|
||||||
|
-squash_get_handler() {
|
||||||
|
local _module _handler
|
||||||
|
+ local -a _modules=(squash-squashfs squash-erofs)
|
||||||
|
|
||||||
|
- for _module in squash-squashfs squash-erofs; do
|
||||||
|
+ for _module in "${_modules[@]}"; do
|
||||||
|
if dracut_module_included "$_module"; then
|
||||||
|
_handler="$_module"
|
||||||
|
break
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
- if [ -z "$_handler" ]; then
|
||||||
|
+ if [[ -z $_handler ]]; then
|
||||||
|
if check_module "squash-squashfs"; then
|
||||||
|
_handler="squash-squashfs"
|
||||||
|
elif check_module "squash-erofs"; then
|
||||||
|
_handler="squash-erofs"
|
||||||
|
else
|
||||||
|
- dfatal "No valid handler for found"
|
||||||
|
+ dfatal "Cannot find valid handler for squash. It requires one of: ${_modules[*]}"
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "$_handler"
|
||||||
|
}
|
||||||
|
-
|
||||||
|
-squash_install() {
|
||||||
|
- local _busybox _dir
|
||||||
|
- _busybox=$(find_binary busybox)
|
||||||
|
-
|
||||||
|
- # Create mount points for squash loader and basic directories
|
||||||
|
- mkdir -p "$initdir"/squash
|
||||||
|
- for _dir in squash usr/bin usr/sbin usr/lib; do
|
||||||
|
- mkdir -p "$squashdir/$_dir"
|
||||||
|
- [[ $_dir == usr/* ]] && ln_r "/$_dir" "${_dir#usr}"
|
||||||
|
- done
|
||||||
|
-
|
||||||
|
- # Install required modules and binaries for the squash image init script.
|
||||||
|
- if [[ $_busybox ]]; then
|
||||||
|
- module_install "busybox"
|
||||||
|
- else
|
||||||
|
- DRACUT_RESOLVE_DEPS=1 inst_multiple sh mount modprobe mkdir switch_root grep umount
|
||||||
|
-
|
||||||
|
- # libpthread workaround: pthread_cancel wants to dlopen libgcc_s.so
|
||||||
|
- inst_libdir_file -o "libgcc_s.so*"
|
||||||
|
-
|
||||||
|
- # FIPS workaround for Fedora/RHEL: libcrypto needs libssl when FIPS is enabled
|
||||||
|
- [[ $DRACUT_FIPS_MODE ]] && inst_libdir_file -o "libssl.so*"
|
||||||
|
- fi
|
||||||
|
-
|
||||||
|
- hostonly="" instmods "loop" "overlay"
|
||||||
|
- dracut_kernel_post
|
||||||
|
-
|
||||||
|
- # Install squash image init script.
|
||||||
|
- inst_simple "$moddir"/init-squash.sh /init
|
||||||
|
-
|
||||||
|
- # make sure that library links are correct and up to date for squash loader
|
||||||
|
- build_ld_cache
|
||||||
|
-}
|
||||||
|
-
|
||||||
|
-squash_installpost() {
|
||||||
|
- local _file
|
||||||
|
-
|
||||||
|
- DRACUT_SQUASH_POST_INST=1 module_install "$(squash_get_handler)"
|
||||||
|
-
|
||||||
|
- # Rescue the dracut spec files so dracut rebuild and lsinitrd can work
|
||||||
|
- for _file in "$initdir"/usr/lib/dracut/*; do
|
||||||
|
- [[ -f $_file ]] || continue
|
||||||
|
- DRACUT_RESOLVE_DEPS=1 dstdir=$squashdir inst "$_file" "${_file#"$initdir"}"
|
||||||
|
- done
|
||||||
|
-
|
||||||
|
- # Remove everything that got squashed into the image
|
||||||
|
- for _file in "$initdir"/*; do
|
||||||
|
- [[ $_file == "$squashdir" ]] && continue
|
||||||
|
- rm -rf "$_file"
|
||||||
|
- done
|
||||||
|
- mv "$squashdir"/* "$initdir"
|
||||||
|
-}
|
||||||
|
-
|
||||||
|
-install() {
|
||||||
|
-
|
||||||
|
- if [[ $DRACUT_SQUASH_POST_INST ]]; then
|
||||||
|
- squash_installpost
|
||||||
|
- else
|
||||||
|
- dstdir="$squashdir" squash_install
|
||||||
|
- fi
|
||||||
|
-}
|
||||||
|
--
|
||||||
|
2.42.0
|
||||||
|
|
@ -0,0 +1,38 @@
|
|||||||
|
From 8fe64408bd8349e28b7257f93880527a93c63fa2 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Philipp Rudo <prudo@redhat.com>
|
||||||
|
Date: Tue, 27 Aug 2024 12:14:40 +0200
|
||||||
|
Subject: [PATCH 34/35] fix(dracut.sh): exit when installing the squash loader
|
||||||
|
fails
|
||||||
|
|
||||||
|
The postinstall phase in 99squash-lib can fail, e.g. when 99squash-lib
|
||||||
|
is added without one of the required back ends. Usually this isn't fatal
|
||||||
|
and simply results in a "normal" initrd, i.e. one without squashed
|
||||||
|
image, being created. Nevertheless, a user needs to explicitly add one
|
||||||
|
of the required modules for the code to be triggered. So it is better
|
||||||
|
to fail with an error rather than giving the user something he didn't
|
||||||
|
ask for.
|
||||||
|
|
||||||
|
Signed-off-by: Philipp Rudo <prudo@redhat.com>
|
||||||
|
(cherry picked from commit 8909d892a7a055ae95be45416e6fbf1b833ff426)
|
||||||
|
|
||||||
|
Resolves: RHEL-43460
|
||||||
|
---
|
||||||
|
dracut.sh | 2 +-
|
||||||
|
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||||
|
|
||||||
|
diff --git a/dracut.sh b/dracut.sh
|
||||||
|
index 71568fe0..3d73fe43 100755
|
||||||
|
--- a/dracut.sh
|
||||||
|
+++ b/dracut.sh
|
||||||
|
@@ -2278,7 +2278,7 @@ fi
|
||||||
|
|
||||||
|
if dracut_module_included "squash-lib"; then
|
||||||
|
dinfo "*** Squashing the files inside the initramfs ***"
|
||||||
|
- DRACUT_SQUASH_POST_INST=1 module_install "squash-lib"
|
||||||
|
+ DRACUT_SQUASH_POST_INST=1 module_install "squash-lib" || exit 1
|
||||||
|
rm -rf "$squashdir"
|
||||||
|
dinfo "*** Squashing the files inside the initramfs done ***"
|
||||||
|
|
||||||
|
--
|
||||||
|
2.42.0
|
||||||
|
|
@ -0,0 +1,40 @@
|
|||||||
|
From 85235ab58df8343a1a0314333b360648a5d0f452 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Philipp Rudo <prudo@redhat.com>
|
||||||
|
Date: Mon, 26 Aug 2024 15:29:01 +0200
|
||||||
|
Subject: [PATCH 35/35] fix(squash-lib): harden against empty $initdir
|
||||||
|
|
||||||
|
The postinstall phase of 99squash-lib has the potential to delete the
|
||||||
|
whole rootfs if $initdir is empty. This should(tm) never happen.
|
||||||
|
Nevertheless as the consequences are so devastating it is better to
|
||||||
|
double check.
|
||||||
|
|
||||||
|
Signed-off-by: Philipp Rudo <prudo@redhat.com>
|
||||||
|
(cherry picked from commit 6b089c70761c81a7b82a1bfba5f2c1faef7e972f)
|
||||||
|
|
||||||
|
Resolves: RHEL-43460
|
||||||
|
---
|
||||||
|
modules.d/99squash-lib/module-setup.sh | 8 ++++++++
|
||||||
|
1 file changed, 8 insertions(+)
|
||||||
|
|
||||||
|
diff --git a/modules.d/99squash-lib/module-setup.sh b/modules.d/99squash-lib/module-setup.sh
|
||||||
|
index 6a0b6f85..be3d3dc0 100755
|
||||||
|
--- a/modules.d/99squash-lib/module-setup.sh
|
||||||
|
+++ b/modules.d/99squash-lib/module-setup.sh
|
||||||
|
@@ -72,6 +72,14 @@ squash_install() {
|
||||||
|
squash_installpost() {
|
||||||
|
local _file _handler
|
||||||
|
|
||||||
|
+ # this shouldn't happen but...
|
||||||
|
+ # ...better safe than deleting your rootfs
|
||||||
|
+ if [[ -z $initdir ]]; then
|
||||||
|
+ #shellcheck disable=SC2016
|
||||||
|
+ dfatal '$initdir not set. Something went terribly wrong.'
|
||||||
|
+ exit 1
|
||||||
|
+ fi
|
||||||
|
+
|
||||||
|
_handler=$(squash_get_handler)
|
||||||
|
[[ -n $_handler ]] || return 1
|
||||||
|
|
||||||
|
--
|
||||||
|
2.42.0
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
Loading…
Reference in new issue