[installer]: Umount before delete partition (#1575)
Signed-off-by: Qi Luo <qiluo-msft@users.noreply.github.com>
This commit is contained in:
parent
af0013e939
commit
c29def6379
@ -163,11 +163,21 @@ create_demo_gpt_partition()
|
|||||||
while read -r part_index; do
|
while read -r part_index; do
|
||||||
if [ "$blk_dev$part_index" = "$cur_part" ]; then continue; fi
|
if [ "$blk_dev$part_index" = "$cur_part" ]; then continue; fi
|
||||||
echo "deleting partition $part_index ..."
|
echo "deleting partition $part_index ..."
|
||||||
|
# if the partition is already mounted, umount first
|
||||||
|
df $blk_dev$part_index 2>/dev/null && {
|
||||||
|
umount $blk_dev$part_index || {
|
||||||
|
echo "Error: Unable to umount $blk_dev$part_index"
|
||||||
|
exit 1
|
||||||
|
}
|
||||||
|
}
|
||||||
sgdisk -d $part_index $blk_dev || {
|
sgdisk -d $part_index $blk_dev || {
|
||||||
echo "Error: Unable to delete partition $part_index on $blk_dev"
|
echo "Error: Unable to delete partition $part_index on $blk_dev"
|
||||||
exit 1
|
exit 1
|
||||||
}
|
}
|
||||||
partprobe
|
partprobe || {
|
||||||
|
echo "Error: Unable to partprobe"
|
||||||
|
exit 1
|
||||||
|
}
|
||||||
done < $tmpfifo
|
done < $tmpfifo
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user