diff --git a/0005.patch b/0005.patch index 9da286d..e4b162a 100644 --- a/0005.patch +++ b/0005.patch @@ -1,4 +1,4 @@ -From 805599442110985dfee83ea826d35b5943805313 Mon Sep 17 00:00:00 2001 +From 148e420be5b5809aa8d5033f47477573bbbf3e60 Mon Sep 17 00:00:00 2001 From: Harald Hoyer Date: Tue, 18 May 2021 10:13:56 +0200 Subject: [PATCH] fix(base): add missing `str_replace` to `dracut-dev-lib.sh` @@ -55,3 +55,4 @@ index 7eb0a277..07c33eef 100755 # shellcheck source=dracut-dev-lib.sh . "$moddir/dracut-dev-lib.sh" + diff --git a/0006.patch b/0006.patch new file mode 100644 index 0000000..ac65703 --- /dev/null +++ b/0006.patch @@ -0,0 +1,61 @@ +From fa63c9be13660ae5223f9c3e87234ab281b97a95 Mon Sep 17 00:00:00 2001 +From: Harald Hoyer +Date: Mon, 17 May 2021 13:07:09 +0200 +Subject: [PATCH] ci: add shfmt to Fedora containers + +--- + test/container/Dockerfile-Fedora-33 | 1 + + test/container/Dockerfile-Fedora-34 | 1 + + test/container/Dockerfile-Fedora-latest | 1 + + test/container/Dockerfile-Fedora-rawhide | 1 + + 4 files changed, 4 insertions(+) + +diff --git a/test/container/Dockerfile-Fedora-33 b/test/container/Dockerfile-Fedora-33 +index 51ca39f4..8e09cf5e 100644 +--- a/test/container/Dockerfile-Fedora-33 ++++ b/test/container/Dockerfile-Fedora-33 +@@ -48,6 +48,7 @@ RUN dnf -y install --setopt=install_weak_deps=False \ + python3-imgcreate \ + which \ + ShellCheck \ ++ shfmt \ + && dnf -y update && dnf clean all + + # Set default command +diff --git a/test/container/Dockerfile-Fedora-34 b/test/container/Dockerfile-Fedora-34 +index 7e295e9a..b9701f6d 100644 +--- a/test/container/Dockerfile-Fedora-34 ++++ b/test/container/Dockerfile-Fedora-34 +@@ -48,6 +48,7 @@ RUN dnf -y install --setopt=install_weak_deps=False \ + python3-imgcreate \ + which \ + ShellCheck \ ++ shfmt \ + && dnf -y update && dnf clean all + + # Set default command +diff --git a/test/container/Dockerfile-Fedora-latest b/test/container/Dockerfile-Fedora-latest +index 81d5b9b9..3fc4a370 100644 +--- a/test/container/Dockerfile-Fedora-latest ++++ b/test/container/Dockerfile-Fedora-latest +@@ -48,6 +48,7 @@ RUN dnf -y install --setopt=install_weak_deps=False \ + python3-imgcreate \ + which \ + ShellCheck \ ++ shfmt \ + && dnf -y update && dnf clean all + + # Set default command +diff --git a/test/container/Dockerfile-Fedora-rawhide b/test/container/Dockerfile-Fedora-rawhide +index bd75e611..2d5653a7 100644 +--- a/test/container/Dockerfile-Fedora-rawhide ++++ b/test/container/Dockerfile-Fedora-rawhide +@@ -48,6 +48,7 @@ RUN dnf -y install --setopt=install_weak_deps=False \ + python3-imgcreate \ + which \ + ShellCheck \ ++ shfmt \ + && dnf -y update && dnf clean all + + # Set default command + diff --git a/0007.patch b/0007.patch new file mode 100644 index 0000000..7154a68 --- /dev/null +++ b/0007.patch @@ -0,0 +1,61 @@ +From 636d6df3134dde1dac72241937724bc59deb9303 Mon Sep 17 00:00:00 2001 +From: Kairui Song +Date: Wed, 7 Apr 2021 02:11:41 +0800 +Subject: [PATCH] fix(squash): don't mount the mount points if already mounted + +It is possible that user setup some early mount in the rootfs even +earlier, so just be more robust and cover that case too. + +Signed-off-by: Kairui Song +--- + modules.d/99squash/init-squash.sh | 17 +++++++++++------ + modules.d/99squash/module-setup.sh | 4 ++-- + 2 files changed, 13 insertions(+), 8 deletions(-) + +diff --git a/modules.d/99squash/init-squash.sh b/modules.d/99squash/init-squash.sh +index 3de6f819..59769f62 100755 +--- a/modules.d/99squash/init-squash.sh ++++ b/modules.d/99squash/init-squash.sh +@@ -1,12 +1,17 @@ + #!/bin/sh + PATH=/bin:/sbin + +-# Basic mounts for mounting a squash image +-mkdir /proc /sys /dev /run +-mount -t proc -o nosuid,noexec,nodev proc /proc +-mount -t sysfs -o nosuid,noexec,nodev sysfs /sys +-mount -t devtmpfs -o mode=755,noexec,nosuid,strictatime devtmpfs /dev +-mount -t tmpfs -o mode=755,nodev,nosuid,strictatime tmpfs /run ++[ -e /proc/self/mounts ] \ ++ || (mkdir -p /proc && mount -t proc -o nosuid,noexec,nodev proc /proc) ++ ++grep -q '^sysfs /sys sysfs' /proc/self/mounts \ ++ || (mkdir -p /sys && mount -t sysfs -o nosuid,noexec,nodev sysfs /sys) ++ ++grep -q '^devtmpfs /dev devtmpfs' /proc/self/mounts \ ++ || (mkdir -p /dev && mount -t devtmpfs -o mode=755,noexec,nosuid,strictatime devtmpfs /dev) ++ ++grep -q '^tmpfs /run tmpfs' /proc/self/mounts \ ++ || (mkdir -p /run && mount -t tmpfs -o mode=755,noexec,nosuid,strictatime tmpfs /run) + + # Load required modules + modprobe loop +diff --git a/modules.d/99squash/module-setup.sh b/modules.d/99squash/module-setup.sh +index 77520027..e3196213 100644 +--- a/modules.d/99squash/module-setup.sh ++++ b/modules.d/99squash/module-setup.sh +@@ -42,11 +42,11 @@ installpost() { + # 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; do ++ for _i in sh echo mount modprobe mkdir switch_root grep; do + ln_r /usr/bin/busybox /usr/bin/$_i + done + else +- DRACUT_RESOLVE_DEPS=1 inst_multiple sh mount modprobe mkdir switch_root ++ DRACUT_RESOLVE_DEPS=1 inst_multiple sh mount modprobe mkdir switch_root grep + fi + + hostonly="" instmods "loop" "squashfs" "overlay" + diff --git a/0008.patch b/0008.patch new file mode 100644 index 0000000..be44ece --- /dev/null +++ b/0008.patch @@ -0,0 +1,59 @@ +From 9355cb8ea5024533210067373657dc337d63ecb9 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?J=C3=B3hann=20B=2E=20Gu=C3=B0mundsson?= +Date: Tue, 18 May 2021 12:39:34 +0000 +Subject: [PATCH] fix(bash): minor cleanups + +- Remove hard coded path to binary +- Add missing license header +- Document sections +- refactor install section +--- + modules.d/00bash/module-setup.sh | 28 ++++++++++++++++++++-------- + 1 file changed, 20 insertions(+), 8 deletions(-) + +diff --git a/modules.d/00bash/module-setup.sh b/modules.d/00bash/module-setup.sh +index f72c297b..89ef6541 100755 +--- a/modules.d/00bash/module-setup.sh ++++ b/modules.d/00bash/module-setup.sh +@@ -1,20 +1,32 @@ + #!/bin/bash ++# This file is part of dracut. ++# SPDX-License-Identifier: GPL-2.0-or-later + +-# called by dracut ++# Prerequisite check(s) for module. + check() { +- require_binaries /bin/bash ++ ++ # If the binary(s) requirements are not fulfilled the module can't be installed. ++ require_binaries bash || return 1 ++ ++ # Return 255 to only include the module, if another module requires it. ++ return 255 ++ + } + +-# called by dracut ++# Module dependency requirements. + depends() { ++ ++ # Return 0 to include the dependent module(s) in the initramfs. + return 0 ++ + } + +-# called by dracut ++# Install the required file(s) and directories for the module in the initramfs. + install() { +- # If another shell is already installed, do not use bash +- [[ -x $initdir/bin/sh ]] && return + +- # Prefer bash as /bin/sh if it is available. +- inst /bin/bash && ln -sf bash "${initdir}/bin/sh" ++ inst /bin/bash ++ ++ # Prefer bash as default shell if no other shell is preferred. ++ [[ -L $initdir/bin/sh ]] || ln -sf bash "${initdir}/bin/sh" ++ + } + diff --git a/0009.patch b/0009.patch new file mode 100644 index 0000000..e3890f7 --- /dev/null +++ b/0009.patch @@ -0,0 +1,29 @@ +From c1ab36139d416e580e768c29f2addf7ccbc2c612 Mon Sep 17 00:00:00 2001 +From: Marcos Mello +Date: Thu, 20 May 2021 15:41:26 -0300 +Subject: [PATCH] fix(install): sane default --kerneldir + +If --kerneldir is not specified, use /lib/modules/$(uname -r). + +Fixes #1505 +--- + src/install/dracut-install.c | 5 ++++- + 1 file changed, 4 insertions(+), 1 deletion(-) + +diff --git a/src/install/dracut-install.c b/src/install/dracut-install.c +index 9f044ae0..3fd70fc8 100644 +--- a/src/install/dracut-install.c ++++ b/src/install/dracut-install.c +@@ -1167,7 +1167,10 @@ static int parse_argv(int argc, char *argv[]) + if (!kerneldir) { + struct utsname buf; + uname(&buf); +- kerneldir = strdup(buf.version); ++ if (asprintf(&kerneldir, "%s%s", "/lib/modules/", buf.release) < 0) { ++ log_error("Out of memory!"); ++ exit(EXIT_FAILURE); ++ } + } + + if (arg_modalias) { + diff --git a/0010.patch b/0010.patch new file mode 100644 index 0000000..94ce603 --- /dev/null +++ b/0010.patch @@ -0,0 +1,33 @@ +From 0a6007bf4f472565d2c0c205a56edea7ba3e3bc3 Mon Sep 17 00:00:00 2001 +From: Harald Hoyer +Date: Fri, 21 May 2021 11:30:47 +0200 +Subject: [PATCH] fix(dracut): pipe hardlink output to `dinfo` + +Otherwise the output is cluttered with: +``` +Mode: real +Files: 1364 +Linked: 5 files +Compared: 0 xattrs +Compared: 384 files +Saved: 12.84 KiB +Duration: 0.052674 seconds +``` +--- + dracut.sh | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/dracut.sh b/dracut.sh +index 24e1c2e7..60ac46f4 100755 +--- a/dracut.sh ++++ b/dracut.sh +@@ -2092,7 +2092,7 @@ done + + if [[ $do_hardlink == yes ]] && command -v hardlink > /dev/null; then + dinfo "*** Hardlinking files ***" +- hardlink "$initdir" 2>&1 ++ hardlink "$initdir" 2>&1 | dinfo + dinfo "*** Hardlinking files done ***" + fi + + diff --git a/0011.patch b/0011.patch new file mode 100644 index 0000000..6b31ffa --- /dev/null +++ b/0011.patch @@ -0,0 +1,43 @@ +From a277a5fc7acc0a9e8d853f09671495f9d27645c1 Mon Sep 17 00:00:00 2001 +From: Harald Hoyer +Date: Fri, 21 May 2021 12:19:32 +0200 +Subject: [PATCH] fix(dracut-functions): get_maj_min without + get_maj_min_cache_file set + +If `get_maj_min_cache_file` is unset `get_maj_min()` would error out. + +Fix it to work without a cache file set. +--- + dracut-functions.sh | 17 ++++++++++++----- + 1 file changed, 12 insertions(+), 5 deletions(-) + +diff --git a/dracut-functions.sh b/dracut-functions.sh +index 1991c62e..5206bd21 100755 +--- a/dracut-functions.sh ++++ b/dracut-functions.sh +@@ -234,13 +234,20 @@ get_fs_env() { + # 8:2 + get_maj_min() { + local _majmin +- out="$(grep -m1 -oP "^$1 \K\S+$" "${get_maj_min_cache_file:?}")" +- if [ -z "$out" ]; then ++ local _out ++ ++ if [[ $get_maj_min_cache_file ]]; then ++ _out="$(grep -m1 -oP "^$1 \K\S+$" "$get_maj_min_cache_file")" ++ fi ++ ++ if ! [[ "$_out" ]]; then + _majmin="$(stat -L -c '%t:%T' "$1" 2> /dev/null)" +- out="$(printf "%s" "$((0x${_majmin%:*})):$((0x${_majmin#*:}))")" +- echo "$1 $out" >> "${get_maj_min_cache_file:?}" ++ _out="$(printf "%s" "$((0x${_majmin%:*})):$((0x${_majmin#*:}))")" ++ if [[ $get_maj_min_cache_file ]]; then ++ echo "$1 $_out" >> "$get_maj_min_cache_file" ++ fi + fi +- echo -n "$out" ++ echo -n "$_out" + } + + # get_devpath_block diff --git a/dracut.spec b/dracut.spec index 499c844..536891a 100644 --- a/dracut.spec +++ b/dracut.spec @@ -5,7 +5,7 @@ # strip the automatically generated dep here and instead co-own the # directory. %global __requires_exclude pkg-config -%define dist_free_release 6.git20210518 +%define dist_free_release 12.git20210521 Name: dracut Version: 054 @@ -34,6 +34,12 @@ Patch2: 0002.patch Patch3: 0003.patch Patch4: 0004.patch Patch5: 0005.patch +Patch6: 0006.patch +Patch7: 0007.patch +Patch8: 0008.patch +Patch9: 0009.patch +Patch10: 0010.patch +Patch11: 0011.patch Source1: https://www.gnu.org/licenses/lgpl-2.1.txt @@ -489,6 +495,12 @@ echo 'dracut_rescue_image="yes"' > $RPM_BUILD_ROOT%{dracutlibdir}/dracut.conf.d/ %{_prefix}/lib/kernel/install.d/51-dracut-rescue.install %changelog +* Fri May 21 2021 Harald Hoyer - 054-12.git20210521 +- fix `get_maj_min` for kdump +- suppress hardlink output +- sane default --kerneldir for dracut-install +- squash: don't mount the mount points if already mounted + * Tue May 18 2021 Harald Hoyer - 054-6.git20210518 - fix for `str_replace: command not found`