Handle partition loading time

This commit is contained in:
Manuel Thalmann 2024-07-16 18:50:24 +02:00
parent 28fd9b8640
commit dd7ff686bb

View file

@ -137,6 +137,7 @@
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 # Wait for partition to be detected
''echo "Waiting for ${partVar} to appear..."''
'' ''
while true; while true;
do do
@ -326,14 +327,23 @@
partitions = (builtins.concatMap (_: (builtins.attrValues _.partitions)) disks); partitions = (builtins.concatMap (_: (builtins.attrValues _.partitions)) disks);
mountScript = lib.strings.concatLines ( mountScript = lib.strings.concatLines (
builtins.map builtins.concatMap
(_: builtins.concatStringsSep " " [ (_: [
"sudo" ''echo "Waiting for "${lib.strings.escapeShellArg (partPath _)}" to appear..."''
"mount" ''
"--mkdir" while true;
(builtins.concatStringsSep " " (builtins.map (_: "-o ${_}") _.mountOptions)) do
(partPath _) [ -b ${lib.strings.escapeShellArg (partPath _)} ] && break
(normalizePath "/${rootDir}/${_.mountPoint}") done
''
(builtins.concatStringsSep " " [
"sudo"
"mount"
"--mkdir"
(builtins.concatStringsSep " " (builtins.map (_: "-o ${_}") _.mountOptions))
(partPath _)
(normalizePath "/${rootDir}/${_.mountPoint}")
])
]) ])
(lib.lists.sortOn (lib.lists.sortOn
(_: normalizePath "/${_.mountPoint}") (_: normalizePath "/${_.mountPoint}")