diff options
author | Edward Tjörnhammar <ed@cflags.cc> | 2018-09-03 19:45:54 +0200 |
---|---|---|
committer | Edward Tjörnhammar <ed@cflags.cc> | 2018-09-24 16:35:46 +0200 |
commit | 8ab4cbdac337525c76d00fb14ffc30b1f9fbb79b (patch) | |
tree | 56978dfc979b3845732dfb40ec5ce3419e94da9b /nixos/modules/system/boot/luksroot.nix | |
parent | 4b1e3376d11fbf5d16dcaf9f9d8351972d81393b (diff) | |
download | nixpkgs-8ab4cbdac337525c76d00fb14ffc30b1f9fbb79b.tar nixpkgs-8ab4cbdac337525c76d00fb14ffc30b1f9fbb79b.tar.gz nixpkgs-8ab4cbdac337525c76d00fb14ffc30b1f9fbb79b.tar.bz2 nixpkgs-8ab4cbdac337525c76d00fb14ffc30b1f9fbb79b.tar.lz nixpkgs-8ab4cbdac337525c76d00fb14ffc30b1f9fbb79b.tar.xz nixpkgs-8ab4cbdac337525c76d00fb14ffc30b1f9fbb79b.tar.zst nixpkgs-8ab4cbdac337525c76d00fb14ffc30b1f9fbb79b.zip |
nixos: initrd/luks: make uuid specified devices discoverable
Diffstat (limited to 'nixos/modules/system/boot/luksroot.nix')
-rw-r--r-- | nixos/modules/system/boot/luksroot.nix | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/nixos/modules/system/boot/luksroot.nix b/nixos/modules/system/boot/luksroot.nix index ed8b9f01e27..1079089bc5a 100644 --- a/nixos/modules/system/boot/luksroot.nix +++ b/nixos/modules/system/boot/luksroot.nix @@ -11,19 +11,30 @@ let exit 1 } + dev_exist() { + local target="$1" + if [ -e $target ]; then + return 0 + else + local uuid=$(echo -n $target | sed -e 's,UUID=\(.*\),\1,g') + local dev=$(blkid --uuid $uuid) + return $? + fi + } + wait_target() { local name="$1" local target="$2" local secs="''${3:-10}" local desc="''${4:-$name $target to appear}" - if [ ! -e $target ]; then + if ! dev_exist $target; then echo -n "Waiting $secs seconds for $desc..." local success=false; for try in $(seq $secs); do echo -n "." sleep 1 - if [ -e $target ]; then + if dev_exist $target; then success=true break fi |