From 71ee5b97be733632fca35fffd46c6a57065f2d2e Mon Sep 17 00:00:00 2001 From: P. J. McDermott Date: Fri, 30 Oct 2015 16:32:23 -0400 Subject: dist_get_versions(): Handle errors from dl() Also, replace while+read+heredoc with for. --- diff --git a/src/dist/libiquity.sh b/src/dist/libiquity.sh index 66596be..d4fced8 100644 --- a/src/dist/libiquity.sh +++ b/src/dist/libiquity.sh @@ -35,10 +35,17 @@ dist_libiquity_get_versions() local mirror="${1}" local board="${2}" shift 2 - local version= local versions='' + local version= - while read -r version; do + if ! versions="$(dl "${mirror}/Manifest")"; then + err 'Failed to download list of firmware versions' + return 1 + fi + + IFS="${LF}" + for version in ${versions}; do + unset IFS case "${version}" in 'libiquity-20150501') # This version had unique ROM organization. @@ -60,9 +67,8 @@ dist_libiquity_get_versions() grep -F " ${archive}" >/dev/null 2>&1; then versions="${versions} ${version}" fi - done <<-EOF - $(dl "${mirror}/Manifest") - EOF + done + unset IFS printf '%s ' ${versions} return 0 diff --git a/src/dist/libreboot.sh b/src/dist/libreboot.sh index 1b30e72..00d53ca 100644 --- a/src/dist/libreboot.sh +++ b/src/dist/libreboot.sh @@ -49,10 +49,14 @@ dist_libreboot_get_versions() local mirror="${1}" local board="${2}" shift 2 - local version= local versions='' + local version= + + versions='20150518' # Hardcode this list until a manifest is available. - while read -r version; do + IFS="${LF}" + for version in ${versions}; do + unset IFS case "${version}" in 201[34]* | 20150[1-4]*) # These versions had ROMs in X60_binary.tar.gz, @@ -74,9 +78,8 @@ dist_libreboot_get_versions() grep -F " ${archive}" >/dev/null 2>&1; then versions="${versions} ${version}" fi - done <<-EOF - 20150518 $(: Hardcode this list until a manifest is available) - EOF + done + unset IFS printf '%s ' ${versions} return 0 -- cgit v0.9.1