Browse Source

support for variable VEOS images sizes

master
Sebastian Rieger 9 years ago
parent
commit
8065f5490e
  1. 8
      create-arista-veos-image/create-arista-veos-image.sh

8
create-arista-veos-image/create-arista-veos-image.sh

@ -10,7 +10,8 @@
# V1.21 checking whether it safe to unmount working directories # 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.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.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 # usage
if [ ! $# -eq 3 ] ; then if [ ! $# -eq 3 ] ; then
@ -76,7 +77,6 @@ echo "==========================================================="
# create a copy of Aboot bootloader and extend it to 3G # create a copy of Aboot bootloader and extend it to 3G
cp $1 $TMP_NAME.raw cp $1 $TMP_NAME.raw
truncate -s +3G $TMP_NAME.raw
echo echo
echo "Extracting partitions from vEOS vmdk..." 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_END=$(fdisk -l $VEOS_VMDK_BASENAME.raw | grep "\.raw2" | tr -s " " | cut -d ' ' -f 3)
PART2_LENGTH=$(expr $PART2_END - $PART2_START) 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 # append the two partitions from vmdk in the bootloader iso
echo -e "n echo -e "n
p p

Loading…
Cancel
Save