Convert "swraid"
svn path=/nixos/branches/fix-style/; revision=14400
This commit is contained in:
parent
f05cccbc66
commit
ea60090213
@ -418,6 +418,7 @@ in
|
|||||||
|
|
||||||
(import ../upstart-jobs/lvm.nix) # Makes LVM logical volumes available.
|
(import ../upstart-jobs/lvm.nix) # Makes LVM logical volumes available.
|
||||||
|
|
||||||
|
(import ../upstart-jobs/swraid.nix) # Activate software RAID arrays.
|
||||||
|
|
||||||
|
|
||||||
# security
|
# security
|
||||||
|
@ -71,12 +71,6 @@ let
|
|||||||
jobs = map makeJob
|
jobs = map makeJob
|
||||||
([
|
([
|
||||||
|
|
||||||
# Activate software RAID arrays.
|
|
||||||
(import ../upstart-jobs/swraid.nix {
|
|
||||||
inherit modprobe;
|
|
||||||
inherit (pkgs) mdadm;
|
|
||||||
})
|
|
||||||
|
|
||||||
# Mount file systems.
|
# Mount file systems.
|
||||||
(import ../upstart-jobs/filesystems.nix {
|
(import ../upstart-jobs/filesystems.nix {
|
||||||
inherit mount;
|
inherit mount;
|
||||||
|
@ -1,36 +1,44 @@
|
|||||||
{modprobe, mdadm}:
|
{pkgs, config, ...}:
|
||||||
|
|
||||||
|
###### implementation
|
||||||
|
|
||||||
let
|
let
|
||||||
|
|
||||||
tempConf = "/var/run/mdadm.conf";
|
tempConf = "/var/run/mdadm.conf";
|
||||||
|
modprobe = config.system.sbin.modprobe;
|
||||||
|
inherit (pkgs) mdadm;
|
||||||
|
|
||||||
in
|
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
|
||||||
|
|
||||||
|
'';
|
||||||
|
}];
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user