diff options
author | Francis Rowe <info@gluglug.org.uk> | 2015-06-13 11:13:22 (EDT) |
---|---|---|
committer | Francis Rowe <info@gluglug.org.uk> | 2015-06-13 11:13:22 (EDT) |
commit | 510e9792c5add61aeb7a048d4e98b242c0b79878 (patch) | |
tree | 41f4a99fd7d4550e699c2e1e2cc92570cc23929a | |
parent | 3ca13619e3b8abca9d8ed0b2ac46263e82fa2223 (diff) | |
download | libreboot-510e9792c5add61aeb7a048d4e98b242c0b79878.zip libreboot-510e9792c5add61aeb7a048d4e98b242c0b79878.tar.gz libreboot-510e9792c5add61aeb7a048d4e98b242c0b79878.tar.bz2 |
build script: use a standard style (compared to other scripts)
-rwxr-xr-x | build | 34 |
1 files changed, 17 insertions, 17 deletions
@@ -22,18 +22,18 @@ [ "x${DEBUG+set}" = 'xset' ] && set -v set -u -e -build=./resources/scripts/helpers/build +build="./resources/scripts/helpers/build" mode="unknown" option="unknown" usage="./build mode option" -availablemodes="$(ls $build/)" +availablemodes="$(ls ${build}/)" availableoptions="unknown" # unknown until the mode is determined # User specified no or too few/many parameters if [ $# -lt 2 ]; then - printf "$usage\n\n" - printf "possible values for 'mode':\n$availablemodes\n\n" + printf "%s\n\n" "${usage}" + printf "possible values for 'mode':\n%s\n\n" "${availablemodes}" printf "Example: ./build module all\n" printf "Example: ./build module flashrom\n" printf "Example: ./build roms withgrub\n" @@ -43,26 +43,26 @@ if [ $# -lt 2 ]; then printf "Refer to the libreboot documentation for more info\n\n" exit 1 fi -mode=$1 -option=$2 +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 "$@" - elif [ "$option" = "all" ]; then - for option in $availableoptions; do - $build/$mode/$option "$@" +if [ -d "${build}/${mode}" ]; then + availableoptions="$(ls ${build}/${mode}/)" + if [ "${option}" = "list" ]; then + printf "Available options for '%s' are:\nall\n%s\n\n" "${mode}" "${availableoptions}" + elif [ -f "${build}/${mode}/${option}" ]; then + ${build}/${mode}/${option} "$@" + elif [ "${option}" = "all" ]; then + for option in ${availableoptions}; do + ${build}/${mode}/${option} "$@" done else - printf "Invalid option for '$mode'. Available options are:\nall\n$availableoptions\n\n" + printf "Invalid option for '%s'. Available options are:\nall\n%s\n\n" "${mode}" "${availableoptions}" exit 1 fi else - printf "Invalid mode. Available modes are:\n$availablemodes\n\n" + printf "Invalid mode. Available modes are:\n%s\n\n" "${availablemodes}" exit 1 fi |