aboutsummaryrefslogtreecommitdiffstats
path: root/rc.d/init.d
diff options
context:
space:
mode:
authorPeter Jones <pjones@redhat.com>2006-01-31 19:58:44 +0000
committerPeter Jones <pjones@redhat.com>2006-01-31 19:58:44 +0000
commitf4879ffdbc135f6a31d6db955e672cee5fbb57a0 (patch)
treea1ced0058aa22feef3ce684991981f197beac5d0 /rc.d/init.d
parent465f2780aca7ef1f8760a3a90640fab016402546 (diff)
downloadinitscripts-f4879ffdbc135f6a31d6db955e672cee5fbb57a0.tar
initscripts-f4879ffdbc135f6a31d6db955e672cee5fbb57a0.tar.gz
initscripts-f4879ffdbc135f6a31d6db955e672cee5fbb57a0.tar.bz2
initscripts-f4879ffdbc135f6a31d6db955e672cee5fbb57a0.tar.xz
initscripts-f4879ffdbc135f6a31d6db955e672cee5fbb57a0.zip
- check for active dmraid devices by table (rather than name) beforer8-21
activation
Diffstat (limited to 'rc.d/init.d')
-rwxr-xr-xrc.d/init.d/functions29
1 files changed, 29 insertions, 0 deletions
diff --git a/rc.d/init.d/functions b/rc.d/init.d/functions
index 7ba1090a..59dca79a 100755
--- a/rc.d/init.d/functions
+++ b/rc.d/init.d/functions
@@ -475,3 +475,32 @@ confirm() {
fi
done
}
+
+# resolve a device node to its major:minor numbers in decimal or hex
+get_numeric_dev() {
+(
+ fmt="%d:%d"
+ if [ "$1" == "hex" ]; then
+ fmt="%x:%x"
+ fi
+ eval printf "$fmt" $(stat -c "0x%t 0x%T" $2)
+) 2>/dev/null
+}
+
+# find the working name for a running dm device with the same table as one
+# that dmraid would create
+resolve_dm_name() {
+(
+ name="$1"
+
+ line=$(/sbin/dmraid -ay -t --ignorelocking | grep "^$name:" | cut -d\ -f2-)
+ newline=$line
+ 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")
+ fi
+ done
+ /sbin/dmsetup table | sed -n "s/\(^[^:]\+\): $newline\( \+$\|$\)/\1/p"
+) 2>/dev/null
+}