diff options
Diffstat (limited to 'scripts/contrib')
-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() { | |||
71 | echo "" | 71 | echo "" |
72 | } | 72 | } |
73 | 73 | ||
74 | function unmount_device() { | ||
75 | grep -q $DEVICE /proc/mounts | ||
76 | if [ $? -eq 0 ]; then | ||
77 | echo -n "$DEVICE listed in /proc/mounts, attempting to unmount..." | ||
78 | umount $DEVICE* 2>/dev/null | ||
79 | grep -q $DEVICE /proc/mounts | ||
80 | if [ $? -eq 0 ]; then | ||
81 | echo "FAILED" | ||
82 | exit 1 | ||
83 | fi | ||
84 | echo "OK" | ||
85 | fi | ||
86 | } | ||
87 | |||
74 | 88 | ||
75 | # | 89 | # |
76 | # Parse and validate arguments | 90 | # Parse and validate arguments |
@@ -100,17 +114,7 @@ fi | |||
100 | # | 114 | # |
101 | # Check if any $DEVICE partitions are mounted | 115 | # Check if any $DEVICE partitions are mounted |
102 | # | 116 | # |
103 | grep -q $DEVICE /proc/mounts | 117 | unmount_device |
104 | if [ $? -eq 0 ]; then | ||
105 | echo -n "$DEVICE listed in /proc/mounts, attempting to unmount..." | ||
106 | umount $DEVICE* 2>/dev/null | ||
107 | grep -q $DEVICE /proc/mounts | ||
108 | if [ $? -eq 0 ]; then | ||
109 | echo "FAILED" | ||
110 | exit 1 | ||
111 | fi | ||
112 | echo "OK" | ||
113 | fi | ||
114 | 118 | ||
115 | 119 | ||
116 | # | 120 | # |
@@ -183,6 +187,12 @@ parted $DEVICE print | |||
183 | 187 | ||
184 | 188 | ||
185 | # | 189 | # |
190 | # Check if any $DEVICE partitions are mounted after partitioning | ||
191 | # | ||
192 | unmount_device | ||
193 | |||
194 | |||
195 | # | ||
186 | # Format $DEVICE partitions | 196 | # Format $DEVICE partitions |
187 | # | 197 | # |
188 | echo "" | 198 | echo "" |