nixos: initrd/luks: make uuid specified devices discoverable
This commit is contained in:
parent
4b1e3376d1
commit
8ab4cbdac3
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user