diff options
author | Francis Rowe <info@gluglug.org.uk> | 2015-08-29 21:44:02 +0100 |
---|---|---|
committer | Francis Rowe <info@gluglug.org.uk> | 2015-08-29 21:44:02 +0100 |
commit | 610711747339162004801b28a08cf81c33d65e48 (patch) | |
tree | 3309bb37f91e127fb67a97d6073ba6ed55a534ab | |
parent | fcb1cfffb0e62aafd72994922b9c7aec1d4fbb5c (diff) | |
download | librebootfr-610711747339162004801b28a08cf81c33d65e48.tar.gz librebootfr-610711747339162004801b28a08cf81c33d65e48.zip |
download script: re-factor. only have 1 loop for downloading
-rwxr-xr-x | download | 21 |
1 files changed, 10 insertions, 11 deletions
@@ -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 |