From: Reto Gantenbein Date: Sat, 18 Feb 2017 15:33:48 +0000 (+0100) Subject: Various fixes for bootstrap image download via HTTPS X-Git-Tag: lxc-2.1.0~195^2~2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=509140b0cd3ef113d9b0e9e8c292fd9e7816460f;p=thirdparty%2Flxc.git Various fixes for bootstrap image download via HTTPS - Make sure mirror URL is queried for $FEDORA_RELEASE_DEFAULT - Fix image path for URLs queried via mirror list Signed-off-by: Reto Gantenbein --- diff --git a/templates/lxc-fedora.in b/templates/lxc-fedora.in index c14c88f97..252bcc0e5 100644 --- a/templates/lxc-fedora.in +++ b/templates/lxc-fedora.in @@ -125,7 +125,7 @@ bootstrap_fedora() fi fi - echo "Setting up new Fedora ${FEDORA_RELEASE_DEFAULT} (${arch}) bootstrap environment." + echo "Setting up new Fedora ${FEDORA_RELEASE_DEFAULT} (${basearch}) bootstrap environment." [[ -d "${cache}" ]] || mkdir -p "${cache}" @@ -137,29 +137,33 @@ bootstrap_fedora() # download the LiveOS squashfs image if [ ! -f "${cache}/install.img" ] then - - local image_path="/linux/releases/${FEDORA_RELEASE_DEFAULT}/Everything/${arch}/os/images/install.img" + local os_path="linux/releases/${FEDORA_RELEASE_DEFAULT}/Everything/${basearch}/os" + local image_path="images/install.img" local ret=1 if [ -n "${rsync}" ] then echo "Syncing LiveOS squashfs image from ${FEDORA_RSYNC_URL} ... " - rsync --archive --info=progress "${FEDORA_RSYNC_URL}${image_path}" . + rsync --archive --info=progress "${FEDORA_RSYNC_URL}/${os_path}/${image_path}" . ret=$? else if [ -z "${mirror}" ] then - get_mirrors "${basearch}" || return $? + get_mirrors "${FEDORA_RELEASE_DEFAULT}" "${basearch}" || return $? + else + local mirror_url="${mirror}/${os_path}" fi - for url in ${mirror:${mirror_urls}} + for url in ${mirror:-${mirror_urls}} do echo "Downloading LiveOS squashfs image from ${url} ... " - if ! curl --silent --show-error --fail --remote-name "${mirror}${image_path}" + curl --silent --show-error --fail --remote-name "${url}/${image_path}" + ret=$? + if [ ${ret} -ne 0 ] then - echo "Error: Image download failed." continue + else + break fi - ret=$? done fi @@ -659,7 +663,8 @@ download_fedora() # get_mirrors() { - local mirror_arch="${1}" + local release="${1}" + local mirror_arch="${2}" for trynumber in 1 2 3 4 do @@ -815,7 +820,7 @@ setup_repositories() # if no mirror given, get an appropriate mirror from the mirror list if [ -z "${mirror}" ] then - get_mirrors "${target_arch}" || return $? + get_mirrors "${release}" "${target_arch}" || return $? else # construct release-specific mirror url mirror="${mirror}/linux/releases/${release}/Everything/${target_arch}/os"