mirror of
https://github.com/nix-community/disko.git
synced 2026-12-03 14:33:28 +01:00
types/lvm_vg: create 100% size lvs last
This commit is contained in:
1 parent
af27d7917d
commit
e1d5b132d1
1 file changed
+19
-15
+19
-15
@@ -53,21 +53,25 @@
|
|||||||
};
|
};
|
||||||
_create = diskoLib.mkCreateOption {
|
_create = diskoLib.mkCreateOption {
|
||||||
inherit config options;
|
inherit config options;
|
||||||
default = _: ''
|
default = _:
|
||||||
readarray -t lvm_devices < <(cat "$disko_devices_dir"/lvm_${config.name})
|
let
|
||||||
vgcreate ${config.name} \
|
sortedLvs = lib.sort (a: _: !lib.hasInfix "100%" a.size) (lib.attrValues config.lvs);
|
||||||
"''${lvm_devices[@]}"
|
in
|
||||||
${lib.concatMapStrings (lv: ''
|
''
|
||||||
lvcreate \
|
readarray -t lvm_devices < <(cat "$disko_devices_dir"/lvm_${config.name})
|
||||||
--yes \
|
vgcreate ${config.name} \
|
||||||
${if lib.hasInfix "%" lv.size then "-l" else "-L"} ${lv.size} \
|
"''${lvm_devices[@]}"
|
||||||
-n ${lv.name} \
|
${lib.concatMapStrings (lv: ''
|
||||||
${lib.optionalString (lv.lvm_type != null) "--type=${lv.lvm_type}"} \
|
lvcreate \
|
||||||
${toString lv.extraArgs} \
|
--yes \
|
||||||
${config.name}
|
${if lib.hasInfix "%" lv.size then "-l" else "-L"} ${lv.size} \
|
||||||
${lib.optionalString (lv.content != null) (lv.content._create {dev = "/dev/${config.name}/${lv.name}";})}
|
-n ${lv.name} \
|
||||||
'') (lib.attrValues config.lvs)}
|
${lib.optionalString (lv.lvm_type != null) "--type=${lv.lvm_type}"} \
|
||||||
'';
|
${toString lv.extraArgs} \
|
||||||
|
${config.name}
|
||||||
|
${lib.optionalString (lv.content != null) (lv.content._create {dev = "/dev/${config.name}/${lv.name}";})}
|
||||||
|
'') sortedLvs}
|
||||||
|
'';
|
||||||
};
|
};
|
||||||
_mount = diskoLib.mkMountOption {
|
_mount = diskoLib.mkMountOption {
|
||||||
inherit config options;
|
inherit config options;
|
||||||
|
|||||||
Reference in new issue
Block a user