nixos/zfs: check pool state with -d, like import

This can avoid unnecessary wait-looping for pool to be 'ready' on some
systems when the paths don't match
This commit is contained in:
Daniel Carosone 2023-12-08 10:33:26 +11:00
parent 2c7f3c0fb7
commit 88f50101ac

View file

@ -71,7 +71,7 @@ let
done
poolReady() {
pool="$1"
state="$("${zpoolCmd}" import 2>/dev/null | "${awkCmd}" "/pool: $pool/ { found = 1 }; /state:/ { if (found == 1) { print \$2; exit } }; END { if (found == 0) { print \"MISSING\" } }")"
state="$("${zpoolCmd}" import -d "${cfgZfs.devNodes}" 2>/dev/null | "${awkCmd}" "/pool: $pool/ { found = 1 }; /state:/ { if (found == 1) { print \$2; exit } }; END { if (found == 0) { print \"MISSING\" } }")"
if [[ "$state" = "ONLINE" ]]; then
return 0
else