summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFrancis Rowe <info@gluglug.org.uk>2015-06-26 23:03:12 (EDT)
committer Francis Rowe <info@gluglug.org.uk>2015-06-26 23:03:12 (EDT)
commitd7718287d29e1d96c382a0ce262bc725de85628f (patch)
treee44ef72cd7caf904c29c997493381793c5d4c132
parent2f72e90c475f8e3ceeeb1c4ea067798d39c522ce (diff)
downloadlibreboot-d7718287d29e1d96c382a0ce262bc725de85628f.zip
libreboot-d7718287d29e1d96c382a0ce262bc725de85628f.tar.gz
libreboot-d7718287d29e1d96c382a0ce262bc725de85628f.tar.bz2
download script: support specifying more than one option
Also, invalid options now generate a warning, instead of producting an error.
-rwxr-xr-xdownload27
1 files changed, 16 insertions, 11 deletions
diff --git a/download b/download
index 2c04732..bf3147a 100755
--- a/download
+++ b/download
@@ -23,30 +23,35 @@
set -u -e
download="./resources/scripts/helpers/download"
-programme="unknown"
+programmes="unknown"
-usage="./download programme"
+usage="./download programme(s) # programmes are space separated, if specifing multiple programmes"
availableprogrammes="$(ls ${download}/)"
# User specified no or too few/many parameters
-if (( $# != 1 )); then
+if [ $# -lt 1 ]; then
printf "%s\n\n" "${usage}"
- printf "possible values for 'programme':\nall:\n%s\n\n" "${availableprogrammes}"
+ printf "possible values for 'programmes':\nall:\n%s\n\n" "${availableprogrammes}"
printf "Example (download everything): ./download all\n"
- printf "Example (download coreboot): ./download coreboot\n\n"
+ printf "Example (download flashrom): ./download flashrom\n"
+ printf "Example (download coreboot): ./download coreboot\n"
+ printf "Example (download coreboot and flashrom): ./download coreboot flashrom\n"
exit 1
fi
-programme="${1}"
+programmes="$@"
-if [ "${programme}" = "all" ]; then
+if [ "${programmes}" = "all" ]; then
for programme in ${availableprogrammes}; do
${download}/${programme}
done
-elif [ -f "${download}/${programme}" ]; then
- ${download}/${programme}
else
- printf "Invalid programme. Available programmes are:\nall\n%s\n" "${availableprogrammes}"
- exit 1
+ for programme in programmes; do
+ if [ -f "${download}/${programme}" ]; then
+ ${download}/${programme}
+ else
+ printf "download: WARNING: Invalid programme '%s'. Available programmes are:\nall\n%s\n" "${programme}" "${availableprogrammes}"
+ fi
+ done
fi
# ------------------- DONE ----------------------