summaryrefslogtreecommitdiff
path: root/scripts/local-top/mdrun
blob: 3ed995cceea3e8fa29fdb4cf2d7a3e8985bd4ecb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
#!/bin/sh

PREREQ="udev_helper"

prereqs()
{
	echo "$PREREQ"
}

case $1 in
# get pre-requisites
prereqs)
	prereqs
	exit 0
	;;
esac

if [ -e /scripts/local-top/mdadm ]; then
        exit 0
fi

unset raidlvl
gotraid=n

# Detect raid level
for x in /dev/hd[a-z][0-9]* /dev/sd[a-z][0-9]*; do
	if [ ! -e ${x} ]; then
		continue
	fi
	raidlvl=$(mdadm --examine ${x} 2>/dev/null | grep "Level" | sed -e 's/.*Raid Level : \(.*\)/\1/')
	if [ "$raidlvl" ]; then
		modprobe -q ${raidlvl} 2>/dev/null
		gotraid=y
	fi
done

[ "${gotraid}" = y ] || exit

# source the presumed root md and it's info
. ./conf/mdadm.conf

# assemble root raid first due to initrd-tools compatibility
mdadm -A ${rootraiddev} -R -u $uuid $devices

# assemble all raid devices
/sbin/mdrun /dev