Created
September 17, 2015 23:22
-
-
Save tjdett/430e7a42aedb52d7edf2 to your computer and use it in GitHub Desktop.
Create OpenStack Glance image for CoreOS
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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