From ac1831e0747bcf3ce0ea871d5fd04fe42d00be61 Mon Sep 17 00:00:00 2001 From: Jesse Andrews Date: Mon, 24 Oct 2011 21:37:00 -0700 Subject: [PATCH] simplify uec image url parsing --- stack.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/stack.sh b/stack.sh index 18206cd..5eccaa6 100755 --- a/stack.sh +++ b/stack.sh @@ -740,8 +740,8 @@ if [[ "$ENABLED_SERVICES" =~ "g-reg" ]]; then for image_url in ${IMAGE_URLS//,/ }; do # Downloads the image (uec ami+aki style), then extracts it. - IMAGE_FNAME=`echo "$image_url" | python -c "import sys; print sys.stdin.read().split('/')[-1]"` - IMAGE_NAME=`echo "$IMAGE_FNAME" | python -c "import sys; print sys.stdin.read().split('.tar.gz')[0].split('.tgz')[0]"` + IMAGE_FNAME=`basename "$image_url"` + IMAGE_NAME=`basename -s .tar.gz "$IMAGE_FNAME"` if [ ! -f $FILES/$IMAGE_FNAME ]; then wget -c $image_url -O $FILES/$IMAGE_FNAME fi