libreboot

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | README

commit 610711747339162004801b28a08cf81c33d65e48
parent fcb1cfffb0e62aafd72994922b9c7aec1d4fbb5c
Author: Francis Rowe <info@gluglug.org.uk>
Date:   Sat, 29 Aug 2015 21:44:02 +0100

download script: re-factor. only have 1 loop for downloading

Diffstat:
download | 21++++++++++-----------
1 file changed, 10 insertions(+), 11 deletions(-)

diff --git a/download b/download @@ -24,20 +24,18 @@ set -u -e download=./resources/scripts/helpers/download -availableprogrammes=$(ls ${download}/) +programmes="none" case ${@} in all) - for programme in ${availableprogrammes}; do - ${download}/${programme} - done + programmes=$(ls ${download}/) ;; list) - printf "possible values for 'programmes':\nall:\n%s\n\n" "${availableprogrammes}" + printf "possible values for 'programmes':\nall:\n%s\n\n" "${programmes}" ;; help) printf "%s\n\n" "./download programme(s) # programmes are space separated, if specifing multiple programmes" - printf "possible values for 'programmes':\nall:\n%s\n\n" "${availableprogrammes}" + printf "possible values for 'programmes':\nall:\n%s\n\n" "${programmes}" printf "Example (download everything): ./download all\n" printf "Example (download flashrom): ./download flashrom\n" printf "Example (download coreboot): ./download coreboot\n" @@ -46,11 +44,12 @@ case ${@} in ;; *) for programme in ${@}; do - echo ${availableprogrammes} | grep -wq ${programme} || (printf "ERROR: Invalid programme '${programme}'. See ./download help.\n"; exit 1) - done - for programme in ${@}; do - ${download}/${programme} + echo ${programmes} | grep -wq ${programme} || (printf "ERROR: Invalid programme '${programme}'. See ./download help.\n"; exit 1) done + programmes=${@} ;; esac -# ------------------- DONE ---------------------- + +for programme in ${programmes}; do + ${download}/${programme} +done