2007-01-11 01:40:28 +01:00
|
|
|
{kernel, module_init_tools, mdadm}:
|
|
|
|
|
|
|
|
let
|
|
|
|
|
2007-01-23 21:09:06 +01:00
|
|
|
tempConf = "/var/run/mdadm.conf";
|
2007-01-11 01:40:28 +01:00
|
|
|
|
|
|
|
in
|
|
|
|
|
|
|
|
{
|
|
|
|
name = "swraid";
|
|
|
|
|
|
|
|
job = "
|
|
|
|
start on udev
|
|
|
|
#start on new-devices
|
|
|
|
|
|
|
|
script
|
|
|
|
|
|
|
|
# Load the necessary RAID personalities.
|
|
|
|
export MODULE_DIR=${kernel}/lib/modules/
|
|
|
|
for mod in raid0 raid1 raid5; do
|
|
|
|
${module_init_tools}/sbin/modprobe $mod || true
|
|
|
|
done
|
|
|
|
|
|
|
|
# Scan /proc/partitions for RAID devices.
|
|
|
|
${mdadm}/sbin/mdadm --examine --brief --scan -c partitions > ${tempConf}
|
|
|
|
|
|
|
|
# Activate each device found.
|
|
|
|
${mdadm}/sbin/mdadm --assemble -c ${tempConf} --scan
|
|
|
|
|
|
|
|
initctl emit new-devices
|
|
|
|
|
|
|
|
end script
|
|
|
|
|
|
|
|
";
|
|
|
|
|
|
|
|
}
|