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