aboutsummaryrefslogtreecommitdiffstats
path: root/scripts/contrib/mkefidisk.sh
diff options
context:
space:
mode:
Diffstat (limited to 'scripts/contrib/mkefidisk.sh')
-rwxr-xr-xscripts/contrib/mkefidisk.sh32
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 ""