mirror of
https://github.com/nix-community/disko.git
synced 2026-12-01 13:33:28 +01:00
lib: use lib.escapeShellArg for concatenated paths
This commit is contained in:
1 parent
ca47da60e5
commit
4be2aadf13
6 files changed
+10
-10
No files matched your search
@@ -20,7 +20,7 @@ let
|
|||||||
disks = lib.attrValues cfg_.disko.devices.disk;
|
disks = lib.attrValues cfg_.disko.devices.disk;
|
||||||
rootDisk = {
|
rootDisk = {
|
||||||
name = "root";
|
name = "root";
|
||||||
file = ''"$tmp/${(builtins.head disks).name}.qcow2"'';
|
file = ''"$tmp"/${lib.escapeShellArg (builtins.head disks).name}.qcow2'';
|
||||||
driveExtraOpts.cache = "writeback";
|
driveExtraOpts.cache = "writeback";
|
||||||
driveExtraOpts.werror = "report";
|
driveExtraOpts.werror = "report";
|
||||||
deviceExtraOpts.bootindex = "1";
|
deviceExtraOpts.bootindex = "1";
|
||||||
@@ -29,7 +29,7 @@ let
|
|||||||
otherDisks = map
|
otherDisks = map
|
||||||
(disk: {
|
(disk: {
|
||||||
name = disk.name;
|
name = disk.name;
|
||||||
file = ''"$tmp/${disk.name}.qcow2"'';
|
file = ''"$tmp"/${lib.escapeShellArg disk.name}.qcow2'';
|
||||||
driveExtraOpts.werror = "report";
|
driveExtraOpts.werror = "report";
|
||||||
})
|
})
|
||||||
(builtins.tail disks);
|
(builtins.tail disks);
|
||||||
@@ -72,8 +72,8 @@ in
|
|||||||
trap 'rm -rf "$tmp"' EXIT
|
trap 'rm -rf "$tmp"' EXIT
|
||||||
${lib.concatMapStringsSep "\n" (disk: ''
|
${lib.concatMapStringsSep "\n" (disk: ''
|
||||||
${hostPkgs.qemu}/bin/qemu-img create -f qcow2 \
|
${hostPkgs.qemu}/bin/qemu-img create -f qcow2 \
|
||||||
-b "${config.system.build.diskoImages}/${disk.name}.qcow2" \
|
-b ${config.system.build.diskoImages}/${lib.escapeShellArg disk.name}.qcow2 \
|
||||||
-F qcow2 "$tmp/${disk.name}.qcow2"
|
-F qcow2 "$tmp"/${lib.escapeShellArg disk.name}.qcow2
|
||||||
'') disks}
|
'') disks}
|
||||||
set +f
|
set +f
|
||||||
${config.system.build.vm}/bin/run-*-vm
|
${config.system.build.vm}/bin/run-*-vm
|
||||||
|
|||||||
@@ -34,7 +34,7 @@
|
|||||||
if ! (blkid "${config.device}" | grep -q 'TYPE='); then
|
if ! (blkid "${config.device}" | grep -q 'TYPE='); then
|
||||||
pvcreate "${config.device}"
|
pvcreate "${config.device}"
|
||||||
fi
|
fi
|
||||||
echo "${config.device}" >>"$disko_devices_dir/lvm_${config.vg}"
|
echo "${config.device}" >>"$disko_devices_dir"/lvm_${lib.escapeShellArg config.vg}
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
_mount = diskoLib.mkMountOption {
|
_mount = diskoLib.mkMountOption {
|
||||||
|
|||||||
@@ -84,7 +84,7 @@ in
|
|||||||
in
|
in
|
||||||
''
|
''
|
||||||
${lib.concatMapStringsSep "\n" (k: ''modprobe "${k}"'') kernelModules}
|
${lib.concatMapStringsSep "\n" (k: ''modprobe "${k}"'') kernelModules}
|
||||||
readarray -t lvm_devices < <(cat "$disko_devices_dir/lvm_${config.name}")
|
readarray -t lvm_devices < <(cat "$disko_devices_dir"/lvm_${lib.escapeShellArg config.name})
|
||||||
if ! vgdisplay "${config.name}" >/dev/null; then
|
if ! vgdisplay "${config.name}" >/dev/null; then
|
||||||
vgcreate "${config.name}" \
|
vgcreate "${config.name}" \
|
||||||
"''${lvm_devices[@]}"
|
"''${lvm_devices[@]}"
|
||||||
|
|||||||
+2
-2
@@ -35,10 +35,10 @@
|
|||||||
inherit config options;
|
inherit config options;
|
||||||
default = ''
|
default = ''
|
||||||
if ! test -e "/dev/md/${config.name}"; then
|
if ! test -e "/dev/md/${config.name}"; then
|
||||||
readarray -t disk_devices < <(cat "$disko_devices_dir/raid_${config.name}")
|
readarray -t disk_devices < <(cat "$disko_devices_dir"/raid_${lib.escapeShellArg config.name})
|
||||||
echo 'y' | mdadm --create "/dev/md/${config.name}" \
|
echo 'y' | mdadm --create "/dev/md/${config.name}" \
|
||||||
--level=${toString config.level} \
|
--level=${toString config.level} \
|
||||||
--raid-devices="$(wc -l "$disko_devices_dir/raid_${config.name}" | cut -f 1 -d " ")" \
|
--raid-devices="$(wc -l "$disko_devices_dir"/raid_${lib.escapeShellArg config.name} | cut -f 1 -d " ")" \
|
||||||
--metadata=${config.metadata} \
|
--metadata=${config.metadata} \
|
||||||
--force \
|
--force \
|
||||||
--homehost=any \
|
--homehost=any \
|
||||||
|
|||||||
@@ -32,7 +32,7 @@
|
|||||||
_create = diskoLib.mkCreateOption {
|
_create = diskoLib.mkCreateOption {
|
||||||
inherit config options;
|
inherit config options;
|
||||||
default = ''
|
default = ''
|
||||||
echo "${config.device}" >>"$disko_devices_dir/raid_${config.name}"
|
echo "${config.device}" >>"$disko_devices_dir"/raid_${lib.escapeShellArg config.name}
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
_mount = diskoLib.mkMountOption {
|
_mount = diskoLib.mkMountOption {
|
||||||
|
|||||||
+1
-1
@@ -31,7 +31,7 @@
|
|||||||
_create = diskoLib.mkCreateOption {
|
_create = diskoLib.mkCreateOption {
|
||||||
inherit config options;
|
inherit config options;
|
||||||
default = ''
|
default = ''
|
||||||
echo "${config.device}" >>"$disko_devices_dir/zfs_${config.pool}"
|
echo "${config.device}" >>"$disko_devices_dir"/zfs_${lib.escapeShellArg config.pool}
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
_mount = diskoLib.mkMountOption {
|
_mount = diskoLib.mkMountOption {
|
||||||
|
|||||||
Reference in new issue
Block a user