mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-11-15 22:36:23 +01:00
daa8ecfe7a
svn path=/nixos/trunk/; revision=7631
36 lines
629 B
Nix
36 lines
629 B
Nix
{kernel, module_init_tools, mdadm}:
|
|
|
|
let
|
|
|
|
tempConf = "/var/state/mdadm.conf";
|
|
|
|
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
|
|
|
|
";
|
|
|
|
}
|