Allow automated labelling of partitions
This commit is contained in:
parent
3c73b0851c
commit
a73b04f56b
1 changed files with 8 additions and 0 deletions
|
@ -88,6 +88,7 @@
|
||||||
format
|
format
|
||||||
index
|
index
|
||||||
keepExisting
|
keepExisting
|
||||||
|
label
|
||||||
sizeScript
|
sizeScript
|
||||||
type
|
type
|
||||||
;
|
;
|
||||||
|
@ -102,6 +103,12 @@
|
||||||
${fs.fat32} = "mkfs.fat -F 32 ${diskVar}";
|
${fs.fat32} = "mkfs.fat -F 32 ${diskVar}";
|
||||||
};
|
};
|
||||||
|
|
||||||
|
labelScripts = {
|
||||||
|
${fs.ext4} = label: "e2label ${diskVar} ${label}";
|
||||||
|
${fs.ntfs} = label: "ntfslabel ${diskVar} ${label}";
|
||||||
|
${fs.fat32} = label: "fatlabel ${diskVar} ${label}";
|
||||||
|
};
|
||||||
|
|
||||||
create = lib.strings.concatLines [
|
create = lib.strings.concatLines [
|
||||||
(appendScript "${toString index}: \"$(${sizeOption})\" type=${lib.strings.escapeShellArg type}")
|
(appendScript "${toString index}: \"$(${sizeOption})\" type=${lib.strings.escapeShellArg type}")
|
||||||
formatScripts.${format}
|
formatScripts.${format}
|
||||||
|
@ -115,6 +122,7 @@
|
||||||
'';
|
'';
|
||||||
in [
|
in [
|
||||||
(if keepExisting then fallback else create)
|
(if keepExisting then fallback else create)
|
||||||
|
(labelScripts.${format} label)
|
||||||
])
|
])
|
||||||
partitions)
|
partitions)
|
||||||
);
|
);
|
||||||
|
|
Loading…
Reference in a new issue