From 2bb805e2e07a7d3e1268a09d720ecd13e26af418 Mon Sep 17 00:00:00 2001 From: Denis 'GNUtoo' Carikli Date: Wed, 16 Feb 2022 14:04:16 +0100 Subject: download: Add --help in the individual download scripts This doesn't change the existing usage of the scripts: - For the Coreboot script, before this change, all arguments that were passed were considered as board to download the Coreboot source code for. Here we added the '--help' and '--list-boards' arguments, so it should not be an issue as it is extremely unlikely that a board would be called '--help' or '--list-boards'. - All the other scripts don't use any arguments so passing --help should not conflict with the existing usage. Signed-off-by: Denis 'GNUtoo' Carikli --- resources/scripts/download/coreboot | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) (limited to 'resources/scripts/download/coreboot') diff --git a/resources/scripts/download/coreboot b/resources/scripts/download/coreboot index 6d0aa353..b94b1bc9 100755 --- a/resources/scripts/download/coreboot +++ b/resources/scripts/download/coreboot @@ -21,6 +21,42 @@ [ "x${DEBUG+set}" = 'xset' ] && set -v set -u -e +list_supported_boards() +{ + for board in resources/coreboot/*; do + echo $board | sed 's#resources/coreboot/##' + done +} + +usage() +{ + progname="./download coreboot" + printf "Usage:\n" + printf "\t%s # %s\n" \ + "${progname}" \ + "Download and deblob Coreboot for all the boards" + printf "\t%s [board [board] ...] # %s\n" \ + "${progname}" \ + "Download and deblob Coreboot for the given boards" + printf "\t%s --list-boards # %s\n" \ + "${progname}" \ + "Prints this help" + printf "\t%s --help # %s\n" \ + "${progname}" \ + "List supported boards" + printf "\t%s --help # %s\n" \ + "${progname}" \ + "Prints this help" +} + +if [ $# -eq 1 -a "$1" == "--help" ] ; then + usage + exit 0 +elif [ $# -eq 1 -a "$1" == "--list-boards" ] ; then + list_supported_boards + exit 0 +fi + # set this when you want to modify each coreboot tree # for example, you want to test custom patches # NODELETE= ./download coreboot -- cgit v1.2.1