summaryrefslogtreecommitdiffstats
path: root/build
diff options
context:
space:
mode:
authorP. J. McDermott <pj@pehjota.net>2015-02-19 20:54:51 (EST)
committer Francis Rowe <info@gluglug.org.uk>2015-02-19 21:06:55 (EST)
commit88521e3bf4e377d06dc9b2b9eb2e2bb1d9e0019e (patch)
treebe37534aa3009877796e9507c7fbbc8cfc31d7d0 /build
parent2ebc06de90395e7aba20716c97eb855589653a5c (diff)
downloadlibreboot-88521e3bf4e377d06dc9b2b9eb2e2bb1d9e0019e.zip
libreboot-88521e3bf4e377d06dc9b2b9eb2e2bb1d9e0019e.tar.gz
libreboot-88521e3bf4e377d06dc9b2b9eb2e2bb1d9e0019e.tar.bz2
build: Support multiple extra options
Drop the $extraoption variable. Also change the argument count test to something more portable.
Diffstat (limited to 'build')
-rwxr-xr-xbuild32
1 files changed, 14 insertions, 18 deletions
diff --git a/build b/build
index bca8a6b..9ba38e4 100755
--- a/build
+++ b/build
@@ -23,41 +23,37 @@ set -u -e -v
build=./resources/scripts/helpers/build
mode="unknown"
option="unknown"
-extraoption=""
usage="./build mode option"
availablemodes="$(ls $build/)"
availableoptions="unknown" # unknown until the mode is determined
# User specified no or too few/many parameters
-if (( $# != 2 )); then
- if (( $# != 3 )); then
- printf "$usage\n\n"
- printf "possible values for 'mode':\n$availablemodes\n\n"
- printf "Example: ./build module all\n"
- printf "Example: ./build module flashrom\n"
- printf "Example: ./build roms withgrub\n"
- printf "Example: ./build release archives\n"
- printf "Example: ./build clean all\n"
- printf "Example (extra option) ./build module bucts static\n"
- printf "Refer to the libreboot documentation for more info\n\n"
- exit 1
- else
- extraoption=$3
- fi
+if [ $# -lt 2 ]; then
+ printf "$usage\n\n"
+ printf "possible values for 'mode':\n$availablemodes\n\n"
+ printf "Example: ./build module all\n"
+ printf "Example: ./build module flashrom\n"
+ printf "Example: ./build roms withgrub\n"
+ printf "Example: ./build release archives\n"
+ printf "Example: ./build clean all\n"
+ printf "Example (extra option) ./build module bucts static\n"
+ printf "Refer to the libreboot documentation for more info\n\n"
+ exit 1
fi
mode=$1
option=$2
+shift 2
if [ -d "$build/$mode" ]; then
availableoptions="$(ls $build/$mode/)"
if [ "$option" = "list" ]; then
printf "Available options for '$mode' are:\nall\n$availableoptions\n\n"
elif [ -f "$build/$mode/$option" ]; then
- $build/$mode/$option $extraoption
+ $build/$mode/$option "$@"
elif [ "$option" = "all" ]; then
for option in $availableoptions; do
- $build/$mode/$option $extraoption
+ $build/$mode/$option "$@"
done
else
printf "Invalid option for '$mode'. Available options are:\nall\n$availableoptions\n\n"