os-prober/os-prober-trap_unmount.patch
Leo Sandoval 29e77f0ef3 50mounted-tests: trap do_unmount function on errors
Resolves: RHEL-41244
Signed-off-by: Leo Sandoval <lsandova@lsandova-thinkpadp1gen5.rmtmx.csb>
2024-09-09 13:21:44 -06:00

28 lines
908 B
Diff

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")"