Skip to content

Commit

Permalink
Added Sample build custom image script
Browse files Browse the repository at this point in the history
  • Loading branch information
vpatel95 committed Sep 19, 2024
1 parent 5e665e6 commit 1f66db1
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 1 deletion.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ Python tool to deploy topologies on Ubuntu from the defined json config files.

## Prerequisites <a name = "prereq"></a>

Run `./install`
Run `./scripts/install`

## User Guide <a name = "usage"></a>

Expand Down
26 changes: 26 additions & 0 deletions scripts/build_image.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
#!/bin/bash

SOURCE_IMG=jammy-server-cloudimg-amd64.img
JCNR_TEMPLATE=jcnr-template.qcow2
JCNR_TEMPLATE_COMP=jcnr-template-comp.qcow2
TEMPLATE_SZ=5.5G
DIR=`pwd`

sudo rm ${SOURCE_IMG}
sudo rm ${JCNR_TEMPLATE}
sudo rm ${JCNR_TEMPLATE_COMP}

wget https://cloud-images.ubuntu.com/jammy/current/jammy-server-cloudimg-amd64.img

sudo qemu-img create -f qcow2 -o preallocation=metadata ${JCNR_TEMPLATE} ${TEMPLATE_SZ}
sudo virt-resize --expand /dev/sda1 ${SOURCE_IMG} ${JCNR_TEMPLATE}

sudo virt-customize -a ${JCNR_TEMPLATE} --run-command 'grub-install /dev/sda'
sudo virt-customize -a ${JCNR_TEMPLATE} --root-password password:c0ntrail123
sudo virt-customize -a ${JCNR_TEMPLATE} --run ${DIR}/setup_template.sh -v
sudo virt-customize -a ${JCNR_TEMPLATE} --copy-in ${DIR}/calico.yaml:/home
sudo virt-customize -a ${JCNR_TEMPLATE} --copy-in ${DIR}/multus.yaml:/home
sudo virt-customize -a ${JCNR_TEMPLATE} --copy-in ${DIR}/jcnr-secrets.yaml:/home
sudo virt-customize -a ${JCNR_TEMPLATE} --copy-in ${DIR}/dpdk-devbind.py:/home

sudo qemu-img convert -c -f qcow2 -O qcow2 ${JCNR_TEMPLATE} ${JCNR_TEMPLATE_COMP}
File renamed without changes.

0 comments on commit 1f66db1

Please sign in to comment.