diff options
Diffstat (limited to 'scripts/contrib')
-rwxr-xr-x | scripts/contrib/mkefidisk.sh | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/scripts/contrib/mkefidisk.sh b/scripts/contrib/mkefidisk.sh index af06b4bd5b..c86849d395 100755 --- a/scripts/contrib/mkefidisk.sh +++ b/scripts/contrib/mkefidisk.sh | |||
@@ -134,6 +134,11 @@ fi | |||
134 | # Partition $DEVICE | 134 | # Partition $DEVICE |
135 | # | 135 | # |
136 | DEVICE_SIZE=$(parted $DEVICE unit mb print | grep ^Disk | cut -d" " -f 3 | sed -e "s/MB//") | 136 | DEVICE_SIZE=$(parted $DEVICE unit mb print | grep ^Disk | cut -d" " -f 3 | sed -e "s/MB//") |
137 | # If the device size is not reported there may not be a valid label | ||
138 | if [ "$DEVICE_SIZE" = "" ] ; then | ||
139 | parted $DEVICE mklabel msdos | ||
140 | DEVICE_SIZE=$(parted $DEVICE unit mb print | grep ^Disk | cut -d" " -f 3 | sed -e "s/MB//") | ||
141 | fi | ||
137 | SWAP_SIZE=$((DEVICE_SIZE*SWAP_RATIO/100)) | 142 | SWAP_SIZE=$((DEVICE_SIZE*SWAP_RATIO/100)) |
138 | ROOTFS_SIZE=$((DEVICE_SIZE-BOOT_SIZE-SWAP_SIZE)) | 143 | ROOTFS_SIZE=$((DEVICE_SIZE-BOOT_SIZE-SWAP_SIZE)) |
139 | ROOTFS_START=$((BOOT_SIZE)) | 144 | ROOTFS_START=$((BOOT_SIZE)) |
@@ -142,7 +147,7 @@ SWAP_START=$((ROOTFS_END)) | |||
142 | 147 | ||
143 | # MMC devices use a partition prefix character 'p' | 148 | # MMC devices use a partition prefix character 'p' |
144 | PART_PREFIX="" | 149 | PART_PREFIX="" |
145 | if [ ! "${DEVICE#/dev/mmcblk}" = "${DEVICE}" ]; then | 150 | if [ ! "${DEVICE#/dev/mmcblk}" = "${DEVICE}" ] || [ ! "${DEVICE#/dev/loop}" = "${DEVICE}" ]; then |
146 | PART_PREFIX="p" | 151 | PART_PREFIX="p" |
147 | fi | 152 | fi |
148 | BOOTFS=$DEVICE${PART_PREFIX}1 | 153 | BOOTFS=$DEVICE${PART_PREFIX}1 |
@@ -197,7 +202,12 @@ unmount_device | |||
197 | # | 202 | # |
198 | echo "" | 203 | echo "" |
199 | echo "Formatting $BOOTFS as vfat..." | 204 | echo "Formatting $BOOTFS as vfat..." |
200 | mkfs.vfat $BOOTFS -n "efi" | 205 | if [ ! "${DEVICE#/dev/loop}" = "${DEVICE}" ]; then |
206 | mkfs.vfat -I $BOOTFS -n "efi" | ||
207 | else | ||
208 | mkfs.vfat $BOOTFS -n "efi" | ||
209 | |||
210 | fi | ||
201 | 211 | ||
202 | echo "Formatting $ROOTFS as ext3..." | 212 | echo "Formatting $ROOTFS as ext3..." |
203 | mkfs.ext3 $ROOTFS -L "root" | 213 | mkfs.ext3 $ROOTFS -L "root" |