Format partition only if newly created

This commit is contained in:
Manuel Thalmann 2024-06-22 22:51:11 +02:00
parent d0d14bff0f
commit b78adb6df8

View file

@ -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)