From ea60090213ef5d98ba3071ef58fc5ba29e44f7ef Mon Sep 17 00:00:00 2001 From: Marc Weber Date: Fri, 6 Mar 2009 12:27:30 +0000 Subject: [PATCH] Convert "swraid" svn path=/nixos/branches/fix-style/; revision=14400 --- system/options.nix | 1 + upstart-jobs/default.nix | 6 ---- upstart-jobs/swraid.nix | 60 +++++++++++++++++++++++----------------- 3 files changed, 35 insertions(+), 32 deletions(-) diff --git a/system/options.nix b/system/options.nix index 2444edaeb59f..6b167d82c1a1 100644 --- a/system/options.nix +++ b/system/options.nix @@ -418,6 +418,7 @@ in (import ../upstart-jobs/lvm.nix) # Makes LVM logical volumes available. + (import ../upstart-jobs/swraid.nix) # Activate software RAID arrays. # security diff --git a/upstart-jobs/default.nix b/upstart-jobs/default.nix index 5b455eeaa781..6f14800d2967 100644 --- a/upstart-jobs/default.nix +++ b/upstart-jobs/default.nix @@ -71,12 +71,6 @@ let jobs = map makeJob ([ - # Activate software RAID arrays. - (import ../upstart-jobs/swraid.nix { - inherit modprobe; - inherit (pkgs) mdadm; - }) - # Mount file systems. (import ../upstart-jobs/filesystems.nix { inherit mount; diff --git a/upstart-jobs/swraid.nix b/upstart-jobs/swraid.nix index 5cf7d82e3833..a0a25efa3548 100644 --- a/upstart-jobs/swraid.nix +++ b/upstart-jobs/swraid.nix @@ -1,36 +1,44 @@ -{modprobe, mdadm}: +{pkgs, config, ...}: + +###### implementation let tempConf = "/var/run/mdadm.conf"; + modprobe = config.system.sbin.modprobe; + inherit (pkgs) mdadm; 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 - - "; + services = { + extraJobs = [{ + 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 + + ''; + }]; + }; }