diff options
author | Darren Hart <dvhart@linux.intel.com> | 2013-04-25 14:27:29 -0700 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2013-05-02 17:41:23 +0100 |
commit | f1854e458e5e77806b1fc837033500fa91272261 (patch) | |
tree | 2def53016bb91a3d8285c61078f03a4bc0efb5b6 /scripts | |
parent | 733f1d2a1bcf1c115613e21f7d09f1b4bee216ce (diff) | |
download | openembedded-core-f1854e458e5e77806b1fc837033500fa91272261.tar.gz openembedded-core-f1854e458e5e77806b1fc837033500fa91272261.tar.bz2 openembedded-core-f1854e458e5e77806b1fc837033500fa91272261.zip |
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.
Signed-off-by: Darren Hart <dvhart@linux.intel.com>
Signed-off-by: Saul Wold <sgw@linux.intel.com>
Diffstat (limited to 'scripts')
-rwxr-xr-x | scripts/contrib/mkefidisk.sh | 32 |
1 files changed, 21 insertions, 11 deletions
diff --git a/scripts/contrib/mkefidisk.sh b/scripts/contrib/mkefidisk.sh index 741c3ab967..0c15104bb3 100755 --- a/scripts/contrib/mkefidisk.sh +++ b/scripts/contrib/mkefidisk.sh @@ -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 # @@ -183,6 +187,12 @@ parted $DEVICE print # +# Check if any $DEVICE partitions are mounted after partitioning +# +unmount_device + + +# # Format $DEVICE partitions # echo "" |