From 5be001f1b5ba29ccc3391f6e5e2f0361b631b127 Mon Sep 17 00:00:00 2001 From: Peter Jones Date: Thu, 31 Aug 2006 17:27:40 +0000 Subject: - make resolve_dm_name ignore core logger block size when comparing rules - slightly more readable formatting - make "line" and "newline" the same variable - kill 2 exec() calls, add 1. - shell quoting rill ROT YOUR BRANE. --- rc.d/init.d/functions | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/rc.d/init.d/functions b/rc.d/init.d/functions index 0c278f8a..8847f792 100755 --- a/rc.d/init.d/functions +++ b/rc.d/init.d/functions @@ -562,15 +562,21 @@ resolve_dm_name() { ( name="$1" - line=$(/sbin/dmraid -ay -t --ignorelocking | egrep -iv "^[nN]o " | awk -F ':' "{ if (\$1 ~ /^$name$/) { print \$2; }}") - newline=$line + line=$(/sbin/dmraid -ay -t --ignorelocking | \ + egrep -iv "no block devices found|No RAID disks" | \ + awk -F ':' "{ if (\$1 ~ /^$name$/) { print \$2; }}") for x in $line ; do if [[ "$x" =~ "^/dev/" ]] ; then majmin=$(get_numeric_dev dec $x) - newline=$(echo $newline | sed -e "s,$x\( \|$\),$majmin\1,g") + line=$(sed -e "s,$x\( \|$\),$majmin\1,g" <<< "$line") fi done - /sbin/dmsetup table | egrep -iv "no block devices found|No devices found" | sed -n "s/\(^[^:]\+\): $newline\( \+$\|$\)/\1/p" + line=$(sed -e 's/^[ \t]*//' -e 's/[ \t]*$//' \ + -e 's/ core [12] [[:digit:]]\+ / core [12] [[:digit:]]\\+ /' \ + <<< "$line") + /sbin/dmsetup table | \ + sed -n -e "s/.*\(no block devices found\|No devices found\).*//" \ + -e "s/\(^[^:]\+\): $line\( \+$\|$\)/\1/p" ) 2>/dev/null } -- cgit v1.2.1