From 8065f5490e38bce5fafd403df5b6c02f41f6ea1d Mon Sep 17 00:00:00 2001 From: Sebastian Rieger Date: Mon, 14 Mar 2016 09:29:06 +0100 Subject: [PATCH] support for variable VEOS images sizes --- create-arista-veos-image/create-arista-veos-image.sh | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/create-arista-veos-image/create-arista-veos-image.sh b/create-arista-veos-image/create-arista-veos-image.sh index 4cdcdf7..eb0afb4 100644 --- a/create-arista-veos-image/create-arista-veos-image.sh +++ b/create-arista-veos-image/create-arista-veos-image.sh @@ -10,7 +10,8 @@ # V1.21 checking whether it safe to unmount working directories # V1.3 added support to delete existing image with the same name and generating the default nova flavor # V1.31 added support for newer glance releases (e.g. kilo) used in VIRL 1.0.0 - +# V1.32 changed the extension of the bootloader iso to match the size of the partitions to be injected +# V1.4 support for variable VEOS image sizes (as requested by @Jade_Deane to use custom VEOS images) # usage if [ ! $# -eq 3 ] ; then @@ -76,7 +77,6 @@ echo "===========================================================" # create a copy of Aboot bootloader and extend it to 3G cp $1 $TMP_NAME.raw -truncate -s +3G $TMP_NAME.raw echo echo "Extracting partitions from vEOS vmdk..." @@ -150,6 +150,10 @@ PART2_START=$(fdisk -l $VEOS_VMDK_BASENAME.raw | grep "\.raw2" | tr -s " " | cut PART2_END=$(fdisk -l $VEOS_VMDK_BASENAME.raw | grep "\.raw2" | tr -s " " | cut -d ' ' -f 3) PART2_LENGTH=$(expr $PART2_END - $PART2_START) +# extend the bootloader iso to be able to append the two partitions +EXTENSION_SIZE=$(ls -lk $VEOS_VMDK_BASENAME.raw | tr -s " " | cut -d " " -f 5) +truncate -s +$EXTENSION_SIZE $TMP_NAME.raw + # append the two partitions from vmdk in the bootloader iso echo -e "n p