downloader fails to follow redirects

A redirect is used to aid in the transition from
mirror.starlingx.cengn.ca to mirror.starlingx.windriver.com.

Curl does not support redirects, unless the -L/--location options
are specified.

Partial-Bug: 2028678
Signed-off-by: Scott Little <scott.little@windriver.com>
Change-Id: I44a25952a832a5461f3833fbc74f267c2d72838a
This commit is contained in:
Scott Little 2023-08-02 12:36:18 -04:00
parent 08b18c40ab
commit 2b2379dc4f
4 changed files with 10 additions and 9 deletions

View File

@ -138,7 +138,7 @@ download () {
dl_result=1
download_url="$_url/$rpm_name"
download_cmd="curl --silent --output $rpm_name ${download_url}"
download_cmd="curl -L --silent --output $rpm_name ${download_url}"
echo "Looking for $rpm_name"
echo "--> run: $download_cmd"

View File

@ -315,7 +315,7 @@ for key in "${!layer_pkg_urls[@]}"; do
url="${layer_pkg_urls[${key}]}"
name_from_url=$(url_to_file_name $url)
list="${rpms_from_layer_build_dir}/${name_from_url}"
curl --silent --fail ${url} > ${list} ||
curl -L --silent --fail ${url} > ${list} ||
if [ $? -ne 0 ]; then
echo "ERROR: Failed to download from url: ${url}"
exit 1

View File

@ -53,9 +53,9 @@ get_download_file_command() {
_opts+=" -O"
fi
if [[ "$_name" == http?(s)://* ]]; then
_ret="curl $_opts $_name"
_ret="curl -L $_opts $_name"
else
_ret="curl $_opts $(koji_url $_name)"
_ret="curl -L $_opts $(koji_url $_name)"
fi
echo "$_ret"
}
@ -82,7 +82,7 @@ download_file() {
else
_dest_file="$(basename "$1")"
fi
if curl $_opts -o "${_dest_file}.dl_part" "$1" ; then
if curl -L $_opts -o "${_dest_file}.dl_part" "$1" ; then
\mv -fT "${_dest_file}.dl_part" "${_dest_file}"
return 0
fi

View File

@ -221,7 +221,7 @@ for key in "${!layer_image_inc_urls[@]}"; do
done
if [ ! -f ${inc_file_dir}/${list} ]; then
curl --silent --fail ${url} > ${inc_file_dir}/${list}
curl -L --silent --fail ${url} > ${inc_file_dir}/${list}
if [ $? -ne 0 ]; then
echo "ERROR: Failed to download from url '${url}'"
exit 1
@ -252,7 +252,7 @@ for key in "${!layer_wheels_inc_urls[@]}"; do
done
if [ ! -f ${wheels_file_dir}/${list} ]; then
curl --silent --fail ${url} > ${wheels_file_dir}/${list}
curl -L --silent --fail ${url} > ${wheels_file_dir}/${list}
if [ $? -ne 0 ]; then
echo "ERROR: Failed to download from url '${url}'"
exit 1
@ -292,7 +292,7 @@ for key in "${!layer_image_inc_urls[@]}"; do
done
if [ ! -f ${build_info_file_dir}/${list} ]; then
curl --silent --fail ${url} > ${build_info_file_dir}/${list}
curl -L --silent --fail ${url} > ${build_info_file_dir}/${list}
if [ $? -ne 0 ]; then
echo "WARNING: Failed to download from url '${url}'"
fi
@ -319,7 +319,7 @@ for key in "${!layer_pkg_urls[@]}"; do
done
if [ ! -f ${lst_file_dir}/${list} ]; then
curl --silent --fail ${url} > ${lst_file_dir}/${list}
curl -L --silent --fail ${url} > ${lst_file_dir}/${list}
if [ $? -ne 0 ]; then
echo "ERROR: Failed to download from url '${url}'"
exit 1
@ -360,6 +360,7 @@ process_lst_file () {
local lst_file="${1}"
local dest_dir="${2}"
echo "process_lst_file: ${1} ${2}"
grep -v "^#" ${lst_file_dir}/${lst_file} | while IFS="#" read rpmname extrafields; do
if [ -z "${rpmname}" ]; then
continue