Skip to content

Commit f9c9b59

Browse files
committed
scripts/forensic-mark-readonly: Fix properly finding the parent of a device-mapper device
Parent devices of device-mapper devices use a directory named "holders" in their sysfs block device directory that lists all device-mapper devices which use that device. This is unlike partition devices of block devices which have directory directly in the sysfs block device directory. So if the current device name is not found directly in the sysfs block device directory, then check the "holders" directory. Signed-off-by: Glenn Washburn <[email protected]>
1 parent c673a40 commit f9c9b59

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

config/files/GRMLBASE/etc/udev/scripts/forensic-mark-readonly

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,9 @@ SYS_DIR="$(get_blockdev_dir)"
5050
base_device=$(base "${BLOCK_DEVICE}")
5151
if [ -n "${SYS_DIR}" ] && [ -n "${base_device}" ] ; then
5252
tmp_parent="$(readlink -f "${SYS_DIR}"/*/"${base_device}")"
53+
if [ -z "${tmp_parent}" ]; then
54+
tmp_parent=$(dir "${SYS_DIR}"/*/holders/"${base_device}")
55+
fi
5356
if [ -d "${tmp_parent}" ] ; then
5457
parent_device=$(dir "${tmp_parent}")
5558
parent_device=$(base "${parent_device}")

0 commit comments

Comments
 (0)