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 [
|
||||
(appendScript "${toString index}: \"$(${sizeOption})\" type=${mkType type}")
|
||||
# Wait for partition to be detected
|
||||
''
|
||||
while true;
|
||||
do
|
||||
[ -b ${partVar} ] && break;
|
||||
done;
|
||||
''
|
||||
"sudo ${formatScripts.${format}}"
|
||||
];
|
||||
|
||||
fallback = ''
|
||||
|
@ -132,17 +140,9 @@
|
|||
fi
|
||||
'';
|
||||
in [
|
||||
(if keepExisting then fallback else create)
|
||||
''local diskPath="$(find -L /dev/disk/by-diskseq -samefile ${diskVar})"''
|
||||
''local ${partVarName}="$diskPath-part${toString index}"''
|
||||
# Wait for partition to be detected
|
||||
''
|
||||
while true;
|
||||
do
|
||||
[ -b ${partVar} ] && break;
|
||||
done;
|
||||
''
|
||||
"sudo ${formatScripts.${format}}"
|
||||
(if keepExisting then fallback else create)
|
||||
"sudo ${labelScripts.${format} label}"
|
||||
])
|
||||
partitions)
|
||||
|
|
Loading…
Reference in a new issue