Browse code

Merge pull request #95 from cloudbuilders/simplify

simplify uec image url parsing

sleepsonthefloor authored on 2011/10/25 15:52:12
Showing 1 changed files
... ...
@@ -740,8 +740,8 @@ if [[ "$ENABLED_SERVICES" =~ "g-reg" ]]; then
740 740
 
741 741
     for image_url in ${IMAGE_URLS//,/ }; do
742 742
         # Downloads the image (uec ami+aki style), then extracts it.
743
-        IMAGE_FNAME=`echo "$image_url" | python -c "import sys; print sys.stdin.read().split('/')[-1]"`
744
-        IMAGE_NAME=`echo "$IMAGE_FNAME" | python -c "import sys; print sys.stdin.read().split('.tar.gz')[0].split('.tgz')[0]"`
743
+        IMAGE_FNAME=`basename "$image_url"`
744
+        IMAGE_NAME=`basename -s .tar.gz "$IMAGE_FNAME"`
745 745
         if [ ! -f $FILES/$IMAGE_FNAME ]; then
746 746
             wget -c $image_url -O $FILES/$IMAGE_FNAME
747 747
         fi