From 29e77f0ef394fd1a6e6bbc1d7391bcea0537d96c Mon Sep 17 00:00:00 2001 From: Leo Sandoval Date: Mon, 9 Sep 2024 12:59:25 -0600 Subject: [PATCH] 50mounted-tests: trap do_unmount function on errors Resolves: RHEL-41244 Signed-off-by: Leo Sandoval --- os-prober-trap_unmount.patch | 27 +++++++++++++++++++++++++++ os-prober.spec | 7 ++++++- 2 files changed, 33 insertions(+), 1 deletion(-) create mode 100644 os-prober-trap_unmount.patch diff --git a/os-prober-trap_unmount.patch b/os-prober-trap_unmount.patch new file mode 100644 index 0000000..d42234b --- /dev/null +++ b/os-prober-trap_unmount.patch @@ -0,0 +1,27 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Leo Sandoval +Date: Thu, 13 Jun 2024 17:05:44 -0600 +Subject: [PATCH] 50mounted-tests: trap do_unmount function on errors + +Traps the do_unmount function on error, unmounting any previous +partition in case of error and not letting the partition to be included +as boot entry when called on behalf of grub2-mkconfig. + +Signed-off-by: Leo Sandoval +--- + linux-boot-probes/common/50mounted-tests | 2 ++ + 1 file changed, 2 insertions(+) + +diff --git a/linux-boot-probes/common/50mounted-tests b/linux-boot-probes/common/50mounted-tests +index ad68874..63b2174 100755 +--- a/linux-boot-probes/common/50mounted-tests ++++ b/linux-boot-probes/common/50mounted-tests +@@ -13,6 +13,8 @@ do_unmount() { + rmdir "$tmpmnt" || true + } + ++trap do_unmount ERR ++ + partition="$1" + + types="$(fs_type "$partition")" diff --git a/os-prober.spec b/os-prober.spec index 7af058a..8ede936 100644 --- a/os-prober.spec +++ b/os-prober.spec @@ -1,6 +1,6 @@ Name: os-prober Version: 1.77 -Release: 11%{?dist} +Release: 12%{?dist} Summary: Probes disks on the system for installed operating systems # For more information about licensing, see copyright file. @@ -23,6 +23,7 @@ Patch10: os-prober-gentoo-fix.patch Patch11: os-prober-grub2-mount-workaround.patch Patch12: os-prober-90fallback-include-possible-kernel-parameters-from-g.patch Patch13: os-prober-common.sh-do-not-resolve-symbolic-link-on-mapped-dev.patch +Patch14: os-prober-trap_unmount.patch Requires: udev coreutils util-linux Requires: grep /bin/sed /sbin/modprobe @@ -92,6 +93,10 @@ fi %{_var}/lib/%{name} %changelog +* Mon Sep 9 2024 Leo Sandoval - 1.77.12 +- 50mounted-tests: trap do_unmount function on errors +- Resolves: RHEL-41244 + * Mon Aug 19 2024 Leo Sandoval - 1.77-11 - 90fallback: include possible kernel parameters from grub's default file - common.sh: do not resolve symbolic link on mapped device filesystems