From 2a49aa8a48994806b96003b7ef702d8b5d3f4825 Mon Sep 17 00:00:00 2001 From: Nikolaus Schulz Date: Wed, 24 Mar 2010 04:51:49 +0100 Subject: hook-functions: let dep_add_modules() recurse into lvm slave devices When searching for the root block device, there may be multiple device mapper indirections. Fixes MODULES=dep if crypto-root fs has snapshot. (closes: 573761) Signed-off-by: Nikolaus Schulz Signed-off-by: maximilian attems --- hook-functions | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'hook-functions') diff --git a/hook-functions b/hook-functions index c5c3f05..189ad78 100644 --- a/hook-functions +++ b/hook-functions @@ -284,10 +284,10 @@ dep_add_modules() || [ "${root#/dev/dm-}" != "${root}" ]; then minor=$((0x$(stat --format "%T" ${root}) % 256)) block=$(ls -1 /sys/block/dm-${minor}/slaves | head -n 1) - # lvm on luks or luks on lvm - if [ "${block#dm-}" != "${block}" ]; then + # lvm on luks or luks on lvm, possibly lvm snapshots + while [ "${block#dm-}" != "${block}" ]; do block=$(ls -1 /sys/block/${block}/slaves | head -n 1) - fi + done # lvm on md or luks on md if [ "${block#md}" != "${block}" ]; then block=$(awk "/^${block}/{print substr(\$5, 1, 4); exit}" \ -- cgit v1.2.3