init: make resolve_device() more readable

This commit is contained in:
illiliti 2021-05-10 14:40:38 +03:00
parent 1d8b2ca1e9
commit 50d18b28a5

11
init
View File

@ -33,14 +33,17 @@ resolve_device()
# Race condition may occur if device manager is not yet initialized device. # Race condition may occur if device manager is not yet initialized device.
# To fix this, we simply waiting until device is available. If device # To fix this, we simply waiting until device is available. If device
# didn't appear in specified time, we panic. # didn't appear in specified time, we panic.
while [ ! -b "$device" ]; do while :; do
if [ "$((count += 1))" = "${rootdelay:=30}" ]; then if [ -b "$device" ]; then
panic "failed to lookup partition" return 0
elif [ "$((count += 1))" = "${rootdelay:=30}" ]; then
break break
else else
sleep 1 sleep 1
fi fi
done || : done
panic "failed to lookup partition"
} }
run_hook() run_hook()