Fix some thinkos in the loop device name handling

ubuntu/yakkety
Steve Langasek 9 years ago
parent 4594c28c1f
commit e9d31ea96a

@ -52,12 +52,8 @@ mount_image() {
exit 1
fi
# don't assume we know the separator between device number and partition
# number in the partition name, as this has changed over time.
partsep=$(echo "$loop_p1" | sed -e's/^loop[0-9]\+\(.*\)[0-9]\+/\1/')
# Find the rootfs location
rootfs_dev_mapper="/dev/mapper/${loop_device}${partsep}${rootpart}"
rootfs_dev_mapper="/dev/mapper/${loop_p1%%[0-9]}${rootpart}"
if [ ! -b "${rootfs_dev_mapper}" ]; then
echo "${rootfs_dev_mapper} is not a block device";
exit 1

@ -59,7 +59,7 @@ mkdir mountpoint
mount "${rootfs_dev_mapper}" mountpoint
if [ -n "$BOOT_MOUNTPOINT" ]; then
boot_dev_mapper="${rootfs_dev_mapper%[0-9]*}1"
boot_dev_mapper="${rootfs_dev_mapper%%[0-9]}1"
# assume fat32 for now
mkfs.vfat -n system-boot "$boot_dev_mapper"
mkdir -p "mountpoint/$BOOT_MOUNTPOINT"

Loading…
Cancel
Save