device-helper: sleep conditionally
Call sleep in loop instead of hoping that sleep 2 is enough.
This commit is contained in:
parent
91c6692e80
commit
e8858c1d34
@ -26,7 +26,13 @@ read -r dm_name < "/sys/block/${dev_name}/dm/name" && {
|
|||||||
command -v blkid || exit 0
|
command -v blkid || exit 0
|
||||||
|
|
||||||
# prevent race condition
|
# prevent race condition
|
||||||
blkid "/dev/${dev_name}" || sleep 2
|
while ! blkid "/dev/${dev_name}"; do
|
||||||
|
if [ "$((count += 1))" = 30 ]; then
|
||||||
|
exit 1
|
||||||
|
else
|
||||||
|
sleep 1
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
for line in $(blkid "/dev/${dev_name}"); do case "${line%%=*}" in
|
for line in $(blkid "/dev/${dev_name}"); do case "${line%%=*}" in
|
||||||
UUID) create_symlink /dev/disk/by-uuid "${line##*=}" ;;
|
UUID) create_symlink /dev/disk/by-uuid "${line##*=}" ;;
|
||||||
|
Loading…
Reference in New Issue
Block a user