2009-12-11 11:28:56 +01:00
|
|
|
# Created by Tobias Powalowski <tpowa@archlinux.org>
|
|
|
|
|
2009-03-28 14:07:42 +01:00
|
|
|
run_hook ()
|
|
|
|
{
|
2009-07-25 10:23:59 +02:00
|
|
|
if ! [ "$MDADMRUN" = "1" ]; then
|
|
|
|
input="$(cat /proc/cmdline)"
|
|
|
|
mdconfig="/etc/mdadm.conf"
|
|
|
|
# for partitionable raid, we need to load md_mod first!
|
|
|
|
modprobe md_mod 2>/dev/null
|
2010-02-06 21:40:50 +01:00
|
|
|
# If md is specified on commandline, create config file from those parameters.
|
|
|
|
if [ "$(echo $input | grep "md=")" ]; then
|
2009-07-25 10:23:59 +02:00
|
|
|
#Create initial mdadm.conf
|
|
|
|
# scan all devices in /proc/partitions
|
|
|
|
echo DEVICE partitions > $mdconfig
|
|
|
|
for i in $input; do
|
2010-02-06 21:40:50 +01:00
|
|
|
case $i in
|
2009-07-25 10:23:59 +02:00
|
|
|
# raid
|
|
|
|
md=[0-9]*,/*)
|
2010-02-06 21:40:50 +01:00
|
|
|
device="$(echo "$i" | sed -e 's|,/.*||g' -e 's|=||g')"
|
|
|
|
array="$(echo $i | cut -d, -f2-)"
|
|
|
|
echo "ARRAY /dev/$device devices=$array" >> $mdconfig
|
2009-07-25 10:23:59 +02:00
|
|
|
;;
|
|
|
|
# partitionable raid
|
|
|
|
md=d[0-9]*,/*)
|
2010-02-06 21:40:50 +01:00
|
|
|
device="$(echo "$i" | sed -e 's|,/.*||g' -e 's|=|_|g')"
|
|
|
|
array="$(echo $i | cut -d, -f2-)"
|
|
|
|
echo "ARRAY /dev/$device devices=$array" >> $mdconfig
|
2009-07-25 10:23:59 +02:00
|
|
|
;;
|
|
|
|
# raid UUID
|
|
|
|
md=[0-9]*,[0-9,a-z]*)
|
2010-02-06 21:40:50 +01:00
|
|
|
device="$(echo "$i" | sed -e 's|,.*||g' -e 's|=||g')"
|
|
|
|
array="$(echo $i | cut -d, -f2-)"
|
|
|
|
echo "ARRAY /dev/$device UUID=$array" >> $mdconfig
|
2009-07-25 10:23:59 +02:00
|
|
|
;;
|
|
|
|
# partitionable raid UUID
|
|
|
|
md=d[0-9]*,[0-9,a-z]*)
|
2010-02-06 21:40:50 +01:00
|
|
|
device="$(echo "$i" | sed -e 's|,.*||g' -e 's|=|_|g')"
|
|
|
|
array="$(echo $i | cut -d, -f2-)"
|
|
|
|
echo "ARRAY /dev/$device UUID=$array" >> $mdconfig
|
2009-07-25 10:23:59 +02:00
|
|
|
;;
|
|
|
|
esac
|
|
|
|
done
|
2013-05-22 12:25:50 +02:00
|
|
|
[ -e $mdconfig ] && mdassemble
|
2009-07-25 10:23:59 +02:00
|
|
|
fi
|
2009-07-26 18:18:30 +02:00
|
|
|
else
|
2009-07-26 21:58:20 +02:00
|
|
|
msg ":: Skipping already run by arch_root_advanced hook..."
|
2009-03-28 14:07:42 +01:00
|
|
|
fi
|
2013-08-08 19:43:57 +02:00
|
|
|
### HACK: allow udev assembly again!
|
|
|
|
rm /etc/udev/rules.d/64-md-raid-assembly.rules
|
2009-03-28 14:07:42 +01:00
|
|
|
}
|