Format partition only if newly created
This commit is contained in:
parent
1f24914de4
commit
d919d2b6b9
1 changed files with 9 additions and 9 deletions
|
@ -123,6 +123,14 @@
|
||||||
|
|
||||||
create = lib.strings.concatLines [
|
create = lib.strings.concatLines [
|
||||||
(appendScript "${toString index}: \"$(${sizeOption})\" type=${mkType type}")
|
(appendScript "${toString index}: \"$(${sizeOption})\" type=${mkType type}")
|
||||||
|
# Wait for partition to be detected
|
||||||
|
''
|
||||||
|
while true;
|
||||||
|
do
|
||||||
|
[ -b ${partVar} ] && break;
|
||||||
|
done;
|
||||||
|
''
|
||||||
|
"sudo ${formatScripts.${format}}"
|
||||||
];
|
];
|
||||||
|
|
||||||
fallback = ''
|
fallback = ''
|
||||||
|
@ -132,17 +140,9 @@
|
||||||
fi
|
fi
|
||||||
'';
|
'';
|
||||||
in [
|
in [
|
||||||
(if keepExisting then fallback else create)
|
|
||||||
''local diskPath="$(find -L /dev/disk/by-diskseq -samefile ${diskVar})"''
|
''local diskPath="$(find -L /dev/disk/by-diskseq -samefile ${diskVar})"''
|
||||||
''local ${partVarName}="$diskPath-part${toString index}"''
|
''local ${partVarName}="$diskPath-part${toString index}"''
|
||||||
# Wait for partition to be detected
|
(if keepExisting then fallback else create)
|
||||||
''
|
|
||||||
while true;
|
|
||||||
do
|
|
||||||
[ -b ${partVar} ] && break;
|
|
||||||
done;
|
|
||||||
''
|
|
||||||
"sudo ${formatScripts.${format}}"
|
|
||||||
"sudo ${labelScripts.${format} label}"
|
"sudo ${labelScripts.${format} label}"
|
||||||
])
|
])
|
||||||
partitions)
|
partitions)
|
||||||
|
|
Loading…
Reference in a new issue