From ce1b7118187403d7f226ef50ae21c4761eb664d1 Mon Sep 17 00:00:00 2001 From: Leo Sandoval Date: Mon, 9 Sep 2024 13:42:16 -0600 Subject: [PATCH] 50mounted-tests: trap do_unmount function on errors Resolves: RHEL-56629 Signed-off-by: Leo Sandoval --- os-prober-trap_unmount.patch | 27 +++++++++++++++++++++++++++ os-prober.spec | 5 +++++ 2 files changed, 32 insertions(+) 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 60d56b5..0b8104a 100644 --- a/os-prober.spec +++ b/os-prober.spec @@ -22,6 +22,7 @@ Patch8: os-prober-grub2-parsefix.patch Patch9: os-prober-grepfix.patch Patch10: os-prober-grub2-mount-workaround.patch Patch11: os-prober-arm64-win11.patch +Patch13: os-prober-trap_unmount.patch Requires: udev coreutils util-linux Requires: grep /bin/sed /sbin/modprobe @@ -91,6 +92,10 @@ fi %{_var}/lib/%{name} %changelog +* Mon Sep 9 2024 Leo Sandoval - 1.81-8 +- 50mounted-tests: trap do_unmount function on errors +- Resolves: RHEL-56629 + * Mon Jun 24 2024 Troy Dawson - 1.81-7 - Bump release for June 2024 mass rebuild