Skip to content

Instantly share code, notes, and snippets.

@Dishwasha
Created January 13, 2017 04:45
Show Gist options
  • Save Dishwasha/ba75aebc448d6b56a3d9c15028aed363 to your computer and use it in GitHub Desktop.
Save Dishwasha/ba75aebc448d6b56a3d9c15028aed363 to your computer and use it in GitHub Desktop.
Create custom qcow2 cloud images for OpenNebula
#!/bin/sh
qemu-img create -f qcow2 -b $1 modified.qcow2
virt-customize -v --attach packages.iso --format qcow2 -a modified.qcow2 --run script.sh
qemu-img convert -O qcow2 modified.qcow2 final.qcow2
TMPDIR=/tmp virt-sparsify final.qcow2 $2
rm -f modified.qcow2 final.qcow2
mkdir /tmp/mount
mount LABEL=PACKAGES /tmp/mount
# Install opennebula context package
rpm -Uvh /tmp/mount/one-context*rpm
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment