50mounted-tests: trap do_unmount function on errors

Resolves: RHEL-56629
Signed-off-by: Leo Sandoval <lsandova@lsandova-thinkpadp1gen5.rmtmx.csb>
This commit is contained in:
Leo Sandoval 2024-09-09 13:42:16 -06:00
parent 4951dd026d
commit ce1b711818
2 changed files with 32 additions and 0 deletions

View File

@ -0,0 +1,27 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Leo Sandoval <lsandova@redhat.com>
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 <lsandova@redhat.com>
---
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")"

View File

@ -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 <lsandova@redhat.com> - 1.81-8
- 50mounted-tests: trap do_unmount function on errors
- Resolves: RHEL-56629
* Mon Jun 24 2024 Troy Dawson <tdawson@redhat.com> - 1.81-7
- Bump release for June 2024 mass rebuild