From f05cccbc66d6123fbd076c4a1cbd5d4cfe18c6d7 Mon Sep 17 00:00:00 2001 From: Marc Weber Date: Fri, 6 Mar 2009 12:27:28 +0000 Subject: [PATCH] Convert "lvm" svn path=/nixos/branches/fix-style/; revision=14399 --- system/options.nix | 2 ++ upstart-jobs/default.nix | 6 ----- upstart-jobs/lvm.nix | 53 ++++++++++++++++++++++++---------------- 3 files changed, 34 insertions(+), 27 deletions(-) diff --git a/system/options.nix b/system/options.nix index 32e3a5b7b8e5..2444edaeb59f 100644 --- a/system/options.nix +++ b/system/options.nix @@ -416,6 +416,8 @@ in (import ../upstart-jobs/klogd.nix) + (import ../upstart-jobs/lvm.nix) # Makes LVM logical volumes available. + # security diff --git a/upstart-jobs/default.nix b/upstart-jobs/default.nix index 69289bcf99d4..5b455eeaa781 100644 --- a/upstart-jobs/default.nix +++ b/upstart-jobs/default.nix @@ -71,12 +71,6 @@ let jobs = map makeJob ([ - # Makes LVM logical volumes available. - (import ../upstart-jobs/lvm.nix { - inherit modprobe; - inherit (pkgs) lvm2 devicemapper; - }) - # Activate software RAID arrays. (import ../upstart-jobs/swraid.nix { inherit modprobe; diff --git a/upstart-jobs/lvm.nix b/upstart-jobs/lvm.nix index d860224685e7..1d16da59befc 100644 --- a/upstart-jobs/lvm.nix +++ b/upstart-jobs/lvm.nix @@ -1,30 +1,41 @@ -{modprobe, lvm2, devicemapper}: +{pkgs, config, ...}: + +###### implementation + +let + modprobe = config.system.sbin.modprobe; + +in + { - name = "lvm"; - - job = " -start on udev -#start on new-devices -script + services = { + extraJobs = [{ + name = "lvm"; + + job = '' + start on udev + #start on new-devices - # Load the device mapper. - ${modprobe}/sbin/modprobe dm_mod || true + script - ${devicemapper}/sbin/dmsetup mknodes - # Scan for block devices that might contain LVM physical volumes - # and volume groups. - ${lvm2}/sbin/vgscan --mknodes + # Load the device mapper. + ${modprobe}/sbin/modprobe dm_mod || true - # Make all logical volumes on all volume groups available, i.e., - # make them appear in /dev. - ${lvm2}/sbin/vgchange --available y + ${pkgs.devicemapper}/sbin/dmsetup mknodes + # Scan for block devices that might contain LVM physical volumes + # and volume groups. + ${pkgs.lvm2}/sbin/vgscan --mknodes - initctl emit new-devices - -end script - - "; + # Make all logical volumes on all volume groups available, i.e., + # make them appear in /dev. + ${pkgs.lvm2}/sbin/vgchange --available y + initctl emit new-devices + + end script + ''; + }]; + }; }