mkefidisk: Unmount after partitioning
Some automounters are rather overzealous and like to mount things immediately after partitioning. This can happen if the disk is being reused and the partitions align exactly with the existing partitions which have already been formatted. Move the unmount code into a function and call it before and after partitioning. (From OE-Core rev: f1854e458e5e77806b1fc837033500fa91272261) Signed-off-by: Darren Hart <dvhart@linux.intel.com> Signed-off-by: Saul Wold <sgw@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
parent
8d3285f99b
commit
c09866b4cf
|
@ -71,6 +71,20 @@ function device_details() {
|
|||
echo ""
|
||||
}
|
||||
|
||||
function unmount_device() {
|
||||
grep -q $DEVICE /proc/mounts
|
||||
if [ $? -eq 0 ]; then
|
||||
echo -n "$DEVICE listed in /proc/mounts, attempting to unmount..."
|
||||
umount $DEVICE* 2>/dev/null
|
||||
grep -q $DEVICE /proc/mounts
|
||||
if [ $? -eq 0 ]; then
|
||||
echo "FAILED"
|
||||
exit 1
|
||||
fi
|
||||
echo "OK"
|
||||
fi
|
||||
}
|
||||
|
||||
|
||||
#
|
||||
# Parse and validate arguments
|
||||
|
@ -100,17 +114,7 @@ fi
|
|||
#
|
||||
# Check if any $DEVICE partitions are mounted
|
||||
#
|
||||
grep -q $DEVICE /proc/mounts
|
||||
if [ $? -eq 0 ]; then
|
||||
echo -n "$DEVICE listed in /proc/mounts, attempting to unmount..."
|
||||
umount $DEVICE* 2>/dev/null
|
||||
grep -q $DEVICE /proc/mounts
|
||||
if [ $? -eq 0 ]; then
|
||||
echo "FAILED"
|
||||
exit 1
|
||||
fi
|
||||
echo "OK"
|
||||
fi
|
||||
unmount_device
|
||||
|
||||
|
||||
#
|
||||
|
@ -182,6 +186,12 @@ parted $DEVICE mkpart primary $SWAP_START 100%
|
|||
parted $DEVICE print
|
||||
|
||||
|
||||
#
|
||||
# Check if any $DEVICE partitions are mounted after partitioning
|
||||
#
|
||||
unmount_device
|
||||
|
||||
|
||||
#
|
||||
# Format $DEVICE partitions
|
||||
#
|
||||
|
|
Loading…
Reference in New Issue