diff options
author | Francis Rowe <info@gluglug.org.uk> | 2016-03-10 21:59:28 +0000 |
---|---|---|
committer | Francis Rowe <info@gluglug.org.uk> | 2016-03-10 21:59:28 +0000 |
commit | 8f41da759a0f5352093ced98a2f03e62c970f8de (patch) | |
tree | ffe5565b26f5d39f4a136aaed519e380ba95ec03 /build | |
parent | 25a828190b2a08105ad561b5b417bb61a383fc4f (diff) | |
download | librebootfr-8f41da759a0f5352093ced98a2f03e62c970f8de.tar.gz librebootfr-8f41da759a0f5352093ced98a2f03e62c970f8de.zip |
build: allow unlimited number of additional parameters
This restores previous functionality, which is needed for the build/roms/
scripts.
Diffstat (limited to 'build')
-rwxr-xr-x | build | 55 |
1 files changed, 31 insertions, 24 deletions
@@ -59,34 +59,41 @@ die() { exit 1 } -if [ ${#} -eq 0 ] || [ ${#} -ge 4 ]; then +if [ $# -lt 1 ]; then die "Wrong number of arguments specified. See './build help'." fi mode="${1}" -option="${2}" -shift 2 [ "${mode}" = help ] && help && exit 0 -case "${option}" in - list) - printf "Available options for mode '%s':\n\n" "${mode}" - listoptions "${mode}" - ;; - all) - for option in $(listoptions "${mode}"); do - "${build}"/"${mode}"/"${option}" "$@" - done - ;; - *) - if [ -d "${build}"/"${mode}"/ ]; then - if [ -f "${build}"/"${mode}"/"${option}" ]; then - "${build}"/"${mode}"/"${option}" "$@" - else - die "Invalid option for '${mode}'. See './build ${mode} list'." - fi - else - die "Invalid mode. See './build help'." - fi -esac +if [ $# -gt 1 ]; then + + option="${2}" + shift 2 + + case "${option}" in + list) + printf "Available options for mode '%s':\n\n" "${mode}" + listoptions "${mode}" + ;; + all) + for option in $(listoptions "${mode}"); do + "${build}"/"${mode}"/"${option}" "$@" + done + ;; + *) + if [ -d "${build}"/"${mode}"/ ]; then + if [ -f "${build}"/"${mode}"/"${option}" ]; then + "${build}"/"${mode}"/"${option}" "$@" + else + die "Invalid option for '${mode}'. See './build ${mode} list'." + fi + else + die "Invalid mode. See './build help'." + fi + esac +else + help + exit 0 +fi |