#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..."
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"