From 1757ef20ea8a2a82658bdc0a62159a107a64fb88 Mon Sep 17 00:00:00 2001 From: Thomas Bechtold Date: Thu, 28 Aug 2014 13:40:03 +0200 Subject: [PATCH] Fix openSUSE cloud image download and extraction Use the latest available version of the rootfs (instead of a qcow2 image) to simplify rootfs extraction. Change-Id: Ic3a646b923738464b5217d799758b6980b2deaf2 --- .../opensuse/root.d/10-opensuse-cloud-image | 88 +++---------------- 1 file changed, 14 insertions(+), 74 deletions(-) diff --git a/elements/opensuse/root.d/10-opensuse-cloud-image b/elements/opensuse/root.d/10-opensuse-cloud-image index 092eab8b..7733aa18 100755 --- a/elements/opensuse/root.d/10-opensuse-cloud-image +++ b/elements/opensuse/root.d/10-opensuse-cloud-image @@ -3,20 +3,6 @@ set -eu set -o pipefail -function find_free_nbd_device () { - # Return first free nbd device - return_device='' - for chk_device in /sys/class/block/nbd*; do - # find free nbd device by checking size field - size_chk=`cat $chk_device/size` - if [ "$size_chk" = "0" ]; then - # device looks free. lets use it. - return_device=$chk_device - break - fi - done - echo $return_device -} [ -n "$ARCH" ] [ -n "$TARGET_ROOT" ] @@ -24,81 +10,35 @@ if [ 'amd64' = "$ARCH" ] ; then ARCH="x86_64" fi -if [ 'i386' = "$ARCH" ] ; then - ARCH="i586" +if ! [ 'x86_64' = "$ARCH" ] ; then + echo "Only x86_64 images are currently available but ARCH is set to $ARCH." + exit 1 fi DIB_CLOUD_IMAGES=${DIB_CLOUD_IMAGES:-http://download.opensuse.org/repositories/Cloud:/Images/images/} DIB_RELEASE=${DIB_RELEASE:-13.1} -# FIXME: Hard coded build numbers, versions, etc. -# NOTE: Actual file name seems unstable, and has changed several times. -BASE_IMAGE_NAME=${BASE_IMAGE_NAME:-openSUSE-$DIB_RELEASE-OS-guest.$ARCH-0.0.2-Build3.1} +BASE_IMAGE_FILE=${BASE_IMAGE_FILE:-openSUSE-${DIB_RELEASE}-OS-rootfs.${ARCH}.tbz} +SHA256SUMS_FILE=${SHA256SUMS_FILE:-${BASE_IMAGE_FILE}.sha256} -if [ -z "$DIB_OFFLINE" ] ; then - # XXX: Try to extract the filename of the current built from the index - # page. As there is one built available in the repo at a given time, this - # should work. This is a tempoary workaround until the fix for - # https://bugzilla.novell.com/show_bug.cgi?id=853882 is deployed - echo "Looking up current built of Base Image ($BASE_IMAGE_NAME):" - BASE_IMAGE_FILE=${BASE_IMAGE_FILE:-$(curl $DIB_CLOUD_IMAGES | \ - sed -n "s/^.*\