mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-12-28 00:24:18 +00:00
119df37858
important for /proc/sys/kernel/modprobe, i.e., modprobing by the kernel. svn path=/nixos/trunk/; revision=8164
37 lines
615 B
Nix
37 lines
615 B
Nix
{modprobe, mdadm}:
|
|
|
|
let
|
|
|
|
tempConf = "/var/run/mdadm.conf";
|
|
|
|
in
|
|
|
|
{
|
|
name = "swraid";
|
|
|
|
job = "
|
|
start on udev
|
|
#start on new-devices
|
|
|
|
script
|
|
|
|
# Load the necessary RAID personalities.
|
|
# !!! hm, doesn't the kernel load these automatically?
|
|
for mod in raid0 raid1 raid5; do
|
|
${modprobe}/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
|
|
|
|
";
|
|
|
|
}
|