Browse code

Allow user to download and install arbitrary images

Anthony Young authored on 2011/10/14 15:03:23
Showing 2 changed files
... ...
@@ -660,38 +660,35 @@ screen_it dash "cd $DASH_DIR && sudo /etc/init.d/apache2 restart; sudo tail -f /
660 660
 # Install Images
661 661
 # ==============
662 662
 
663
-# Upload a couple images to glance.  **TTY** is a simple small image that use the 
664
-# lets you login to it with username/password of user/password.  TTY is useful 
665
-# for basic functionality.  We all include an Ubuntu cloud build of **Natty**.
666
-# Natty uses cloud-init, supporting login via keypair and sending scripts as
667
-# userdata.  
663
+# Upload an image to glance.
668 664
 #
669
-# Read more about cloud-init at https://help.ubuntu.com/community/CloudInit
665
+# The default image is a small ***TTY*** testing image, which lets you login
666
+# the username/password of root/password.
667
+#
668
+# TTY also uses cloud-init, supporting login via keypair and sending scripts as
669
+# userdata.  See https://help.ubuntu.com/community/CloudInit for more on cloud-init
670
+#
671
+# Override IMAGE_URL if you would to launch a different image.  Some other options:
672
+#   natty: http://uec-images.ubuntu.com/natty/current/natty-server-cloudimg-amd64.tar.gz
670 673
 
671 674
 if [[ "$ENABLED_SERVICES" =~ "g-reg" ]]; then
672
-    # create a directory for the downloadedthe images tarballs.
675
+    # Create a directory for the downloadedthe images tarballs.
673 676
     mkdir -p $FILES/images
674 677
 
675
-    # Debug Image (TTY)
676
-    # -----------------
677
-
678
-    # Downloads the image (ami/aki/ari style), then extracts it.  Upon extraction
679
-    # we upload to glance with the glance cli tool.  TTY is a stripped down 
680
-    # version of ubuntu.
681
-    IMAGE_URL=http://smoser.brickies.net/ubuntu/ttylinux-uec/ttylinux-uec-amd64-11.2_2.6.35-15_1.tar.gz
678
+    # Downloads the image (uec ami+aki style), then extracts it.
682 679
     IMAGE_FNAME=`echo "$IMAGE_URL" | python -c "import sys; print sys.stdin.read().split('/')[-1]"`
683 680
     IMAGE_NAME=`echo "$IMAGE_FNAME" | python -c "import sys; print sys.stdin.read().split('.tar.gz')[0].split('.tgz')[0]"`
684 681
     if [ ! -f $FILES/$IMAGE_FNAME ]; then
685 682
         wget -c $IMAGE_URL -O $FILES/$IMAGE_FNAME
686 683
     fi
687 684
 
688
-    # extract ami-tty/image, aki-tty/image & ari-tty/image
685
+    # Extract ami and aki files
689 686
     tar -zxf $FILES/$IMAGE_FNAME -C $FILES/images
690 687
 
688
+    # Upload to glance with the glance cli tool.
691 689
     RVAL=`glance add -A $SERVICE_TOKEN name="$IMAGE_NAME-kernel" is_public=true container_format=aki disk_format=aki < $FILES/images/$IMAGE_NAME-vmlinuz*`
692 690
     KERNEL_ID=`echo $RVAL | cut -d":" -f2 | tr -d " "`
693 691
     glance add -A $SERVICE_TOKEN name="$IMAGE_NAME" is_public=true container_format=ami disk_format=ami kernel_id=$KERNEL_ID < $FILES/images/$IMAGE_NAME.img
694
-
695 692
 fi
696 693
 
697 694
 # Fin
... ...
@@ -27,6 +27,9 @@ NOVACLIENT_BRANCH=master
27 27
 OPENSTACKX_REPO=https://github.com/cloudbuilders/openstackx.git
28 28
 OPENSTACKX_BRANCH=diablo
29 29
 
30
+# Specify a uec image to download and install into glance.
31
+IMAGE_URL=http://smoser.brickies.net/ubuntu/ttylinux-uec/ttylinux-uec-amd64-11.2_2.6.35-15_1.tar.gz
32
+
30 33
 # allow local overrides of env variables
31 34
 if [ -f ./localrc ]; then
32 35
     source ./localrc