diff options
author | Silvio Rhatto <rhatto@riseup.net> | 2018-06-13 19:22:09 -0300 |
---|---|---|
committer | Silvio Rhatto <rhatto@riseup.net> | 2018-06-13 19:22:09 -0300 |
commit | 42732078c9050522ea08b22fae6a4d639fac4929 (patch) | |
tree | 88c3b3e4c8f016158f7155978ca9c66680923f30 /kvmx-create | |
parent | bea5fce59d4c01d19f995a45659fddd7d7e42793 (diff) | |
download | kvmx-42732078c9050522ea08b22fae6a4d639fac4929.tar.gz kvmx-42732078c9050522ea08b22fae6a4d639fac4929.tar.bz2 |
Fix partition handling for device image_types at kvmx-create
Diffstat (limited to 'kvmx-create')
-rwxr-xr-x | kvmx-create | 8 |
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" |