aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xkvmx-create8
1 files changed, 5 insertions, 3 deletions
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"