Skip to content

Instantly share code, notes, and snippets.

@tjdett
Created September 17, 2015 23:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tjdett/430e7a42aedb52d7edf2 to your computer and use it in GitHub Desktop.
Save tjdett/430e7a42aedb52d7edf2 to your computer and use it in GitHub Desktop.
Create OpenStack Glance image for CoreOS
#!/bin/bash
CURRENT_IMAGE_URL="http://alpha.release.core-os.net/amd64-usr/current/coreos_production_openstack_image.img.bz2"
rm coreos_production_openstack_image.{img,raw} coreos.{raw,qcow2} 2> /dev/null
curl -s http://alpha.release.core-os.net/amd64-usr/current/version.txt | grep COREOS_VERSION > ./current-version.sh
source ./current-version.sh
echo "Current CoreOS version is $COREOS_VERSION"
echo "Get current image signature"
curl -# -O -- ${CURRENT_IMAGE_URL}.sig
# Verify image integrity
gpg --verify coreos_production_openstack_image.img.bz2.sig
if [[ ! "$?" == 0 ]]; then
echo "Get current image"
curl -# -O -- $CURRENT_IMAGE_URL
gpg --verify coreos_production_openstack_image.img.bz2.sig
if [[ ! "$?" == 0 ]]; then
echo "Image verification failed"
exit 1
fi
else
echo "Already have current image"
fi
bunzip2 --keep coreos_production_openstack_image.img.bz2
mv coreos_production_openstack_image.img coreos.qcow2
glance image-create --name CoreOS-$COREOS_VERSION \
--container-format bare \
--disk-format qcow2 \
--min-disk 5 \
--file coreos.qcow2 \
--is-public True
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment