summary refs log blame commit diff
path: root/upstart-jobs/swraid.nix
blob: 5cf7d82e3833d4600b2a64d6402482991a88ecec (plain) (tree)
1
2
3
4
5
                  


   
                                   












                                            
                                                          
                                    
                                              














                                                                            
{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

  ";

}