4 input="$(cat /proc/cmdline)"
5 mdconfig="/etc/mdadm.conf"
6 # for partitionable raid, we need to load md_mod first!
7 modprobe md_mod 2>/dev/null
8 # If md is specified on commandline, create config file from those parameters.
9 if [ "$(echo $input | grep "md=")" ]; then
10 #Create initial mdadm.conf
11 # scan all devices in /proc/partitions
12 echo DEVICE partitions > $mdconfig
17 device="$(echo "$i" | sed -e 's|,/.*||g' -e 's|=||g')"
18 array="$(echo $i | cut -d, -f2-)"
19 echo "ARRAY /dev/$device devices=$array" >> $mdconfig
23 device="$(echo "$i" | sed -e 's|,/.*||g' -e 's|=|_|g')"
24 array="$(echo $i | cut -d, -f2-)"
25 echo "ARRAY /dev/$device devices=$array" >> $mdconfig
29 device="$(echo "$i" | sed -e 's|,.*||g' -e 's|=||g')"
30 array="$(echo $i | cut -d, -f2-)"
31 echo "ARRAY /dev/$device UUID=$array" >> $mdconfig
33 # partitionable raid UUID
34 md=d[0-9]*,[0-9,a-z]*)
35 device="$(echo "$i" | sed -e 's|,.*||g' -e 's|=|_|g')"
36 array="$(echo $i | cut -d, -f2-)"
37 echo "ARRAY /dev/$device UUID=$array" >> $mdconfig
43 [ -e $mdconfig ] && /sbin/mdassemble