#!/bin/bash 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" ] if [ 'amd64' = "$ARCH" ] ; then ARCH="x86_64" fi if [ 'i386' = "$ARCH" ] ; then ARCH="i586" 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} 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/^.*\