From 380323d0f6f75078ea6f77b14aceb99cbe33da7d Mon Sep 17 00:00:00 2001 From: Bill Nottingham Date: Fri, 31 Oct 2008 16:50:06 -0400 Subject: Properly handle multiple DM devices when checking for slaves. (#462371, ) Also, do some manipulation of the device name to (hopefully) handle things like /dev/cciss/c0d0p1, and other devices with nested /dev hierarchies. --- rc.d/rc.sysinit | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'rc.d') diff --git a/rc.d/rc.sysinit b/rc.d/rc.sysinit index 40d67fdf..5d9a710d 100755 --- a/rc.d/rc.sysinit +++ b/rc.d/rc.sysinit @@ -161,9 +161,13 @@ init_crypto() { # Is it a block device? [ -b "$src" ] || continue # Is it already a device mapper slave? (this is gross) - [[ " $(ls /sys/block/dm-*/slaves) " =~ " ${src##/dev/} " ]] && continue - # Parse the options field, convert to cryptsetup parameters - # and contruct the command line + devesc=${src##/dev/} + devesc=${devesc//\//!} + for d in /sys/block/dm-*/slaves ; do + [ -e $d/$devesc ] && continue 2 + done + # Parse the options field, convert to cryptsetup parameters and + # contruct the command line while [ -n "$opt" ]; do arg=${opt%%,*} opt=${opt##$arg} -- cgit v1.2.1