47 lines
1.1 KiB
Diff
47 lines
1.1 KiB
Diff
From 4811d40604f58696ddd738cea336d3af53248329 Mon Sep 17 00:00:00 2001
|
|
From: Wang shuo <wangshuo47@huawei.com>
|
|
Date: Thu, 20 Jun 2019 11:17:28 +0800
|
|
Subject: [PATCH] os-prober: wait for device mapper device is created
|
|
|
|
reason: wait for device mapper device is created
|
|
|
|
Signed-off-by: Wang shuo <wangshuo47@huawei.com>
|
|
---
|
|
common.sh | 10 ++++++++++
|
|
1 file changed, 10 insertions(+)
|
|
|
|
diff --git a/common.sh b/common.sh
|
|
index 8030efa..0980208 100644
|
|
--- a/common.sh
|
|
+++ b/common.sh
|
|
@@ -225,9 +225,11 @@ find_uuid () {
|
|
|
|
do_dmsetup () {
|
|
local prefix partition dm_device partition_name size_p
|
|
+ local int
|
|
prefix="$1"
|
|
partition="$2"
|
|
dm_device=
|
|
+ int=1
|
|
|
|
if type dmsetup >/dev/null 2>&1 && \
|
|
type blockdev >/dev/null 2>&1; then
|
|
@@ -240,6 +242,14 @@ do_dmsetup () {
|
|
else
|
|
debug "creating device mapper device $dm_device"
|
|
echo "0 $size_p linear $partition 0" | dmsetup create -r $partition_name
|
|
+ while(( $int<=3 ))
|
|
+ do
|
|
+ if [ -e "$dm_device" ]; then
|
|
+ break
|
|
+ fi
|
|
+ let "int++"
|
|
+ sleep 1
|
|
+ done
|
|
fi
|
|
fi
|
|
echo "$dm_device"
|
|
--
|
|
2.19.1
|
|
|