50mounted-tests: trap do_unmount function on errors

Resolves: RHEL-41244
Signed-off-by: Leo Sandoval <lsandova@lsandova-thinkpadp1gen5.rmtmx.csb>
This commit is contained in:
Leo Sandoval 2024-09-09 12:59:25 -06:00
parent 4875c757e3
commit 29e77f0ef3
2 changed files with 33 additions and 1 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

@ -1,6 +1,6 @@
Name: os-prober Name: os-prober
Version: 1.77 Version: 1.77
Release: 11%{?dist} Release: 12%{?dist}
Summary: Probes disks on the system for installed operating systems Summary: Probes disks on the system for installed operating systems
# For more information about licensing, see copyright file. # 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 Patch11: os-prober-grub2-mount-workaround.patch
Patch12: os-prober-90fallback-include-possible-kernel-parameters-from-g.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 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: udev coreutils util-linux
Requires: grep /bin/sed /sbin/modprobe Requires: grep /bin/sed /sbin/modprobe
@ -92,6 +93,10 @@ fi
%{_var}/lib/%{name} %{_var}/lib/%{name}
%changelog %changelog
* Mon Sep 9 2024 Leo Sandoval <lsandova@redhat.com> - 1.77.12
- 50mounted-tests: trap do_unmount function on errors
- Resolves: RHEL-41244
* Mon Aug 19 2024 Leo Sandoval <lsandova@redhat.com> - 1.77-11 * Mon Aug 19 2024 Leo Sandoval <lsandova@redhat.com> - 1.77-11
- 90fallback: include possible kernel parameters from grub's default file - 90fallback: include possible kernel parameters from grub's default file
- common.sh: do not resolve symbolic link on mapped device filesystems - common.sh: do not resolve symbolic link on mapped device filesystems