From 42732078c9050522ea08b22fae6a4d639fac4929 Mon Sep 17 00:00:00 2001 From: Silvio Rhatto Date: Wed, 13 Jun 2018 19:22:09 -0300 Subject: Fix partition handling for device image_types at kvmx-create --- kvmx-create | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'kvmx-create') diff --git a/kvmx-create b/kvmx-create index 4c1ee0b..2d3e8b8 100755 --- a/kvmx-create +++ b/kvmx-create @@ -238,10 +238,12 @@ function kvmx_create_custom { #kvmx_sudo_run dd if=/dev/zero of=$image bs=$size count=1 kvmx_sudo_run qemu-img create -f raw $image $size device="`sudo losetup --find --show $image`" + partition_prefix="p" elif [ -e "$image" ]; then - device="$image" + device="`readlink $image || echo $image`" else echo "$BASENAME: image device $image does not exist" + exit 1 fi echo "Partitioning image at $device..." @@ -250,8 +252,8 @@ function kvmx_create_custom { kvmx_sudo_run parted -s -- $device set 1 bios_grub on kvmx_sudo_run parted -s -- $device unit MB mkpart ext2 3 -1 kvmx_sudo_run parted -s -- $device set 2 boot on - kvmx_sudo_run mkfs.ext4 ${device}p2 - kvmx_sudo_run mount ${device}p2 $WORK/ + kvmx_sudo_run mkfs.ext4 ${device}${partition_prefix}2 + kvmx_sudo_run mount ${device}${partition_prefix}2 $WORK/ # Non-interactive installation APT_INSTALL="kvmx_sudo_run LC_ALL=C DEBIAN_FRONTEND=noninteractive chroot $WORK/ apt-get install -y" -- cgit v1.2.3