aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBill Nottingham <notting@redhat.com>2008-10-31 16:50:06 -0400
committerBill Nottingham <notting@redhat.com>2008-10-31 16:50:06 -0400
commit380323d0f6f75078ea6f77b14aceb99cbe33da7d (patch)
treeb96b9cfa4d686137b3f8e239d096be7d30233c90
parent09b2d772028fcdab6e23ef7dc6d4ba70904ee530 (diff)
downloadinitscripts-380323d0f6f75078ea6f77b14aceb99cbe33da7d.tar
initscripts-380323d0f6f75078ea6f77b14aceb99cbe33da7d.tar.gz
initscripts-380323d0f6f75078ea6f77b14aceb99cbe33da7d.tar.bz2
initscripts-380323d0f6f75078ea6f77b14aceb99cbe33da7d.tar.xz
initscripts-380323d0f6f75078ea6f77b14aceb99cbe33da7d.zip
Properly handle multiple DM devices when checking for slaves. (#462371, <wwoods@redhat.com>)
Also, do some manipulation of the device name to (hopefully) handle things like /dev/cciss/c0d0p1, and other devices with nested /dev hierarchies.
-rwxr-xr-xrc.d/rc.sysinit10
1 files changed, 7 insertions, 3 deletions
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}