diff options
author | P. J. McDermott <pj@pehjota.net> | 2015-10-30 16:32:23 (EDT) |
---|---|---|
committer | P. J. McDermott <pj@pehjota.net> | 2015-10-30 16:32:23 (EDT) |
commit | 71ee5b97be733632fca35fffd46c6a57065f2d2e (patch) | |
tree | 85d632c0ecbe11baeffd8bc84e5c844793143d8d | |
parent | ec8051f3a2fb91ecdbf086460d39fd31fb115210 (diff) | |
download | firman.sh-71ee5b97be733632fca35fffd46c6a57065f2d2e.zip firman.sh-71ee5b97be733632fca35fffd46c6a57065f2d2e.tar.gz firman.sh-71ee5b97be733632fca35fffd46c6a57065f2d2e.tar.bz2 |
dist_get_versions(): Handle errors from dl()
Also, replace while+read+heredoc with for.
-rw-r--r-- | src/dist/libiquity.sh | 16 | ||||
-rw-r--r-- | src/dist/libreboot.sh | 13 |
2 files changed, 19 insertions, 10 deletions
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 |