From 9516353ff89620e353c65883bd63da9db05d9f23 Mon Sep 17 00:00:00 2001 From: Patrick Zysset Date: Thu, 11 Oct 2018 10:55:47 +0200 Subject: [PATCH] sw-update: provide usage info with option -h or with invalid arguments a usage info is printed to the console. BugzID: 53654 Signed-off-by: Patrick Zysset --- recipes-core/sw-update/sw-update/sw-update.sh | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/recipes-core/sw-update/sw-update/sw-update.sh b/recipes-core/sw-update/sw-update/sw-update.sh index 50ea4d7..2dd7802 100755 --- a/recipes-core/sw-update/sw-update/sw-update.sh +++ b/recipes-core/sw-update/sw-update/sw-update.sh @@ -276,6 +276,12 @@ update_spl() log INFO "spl update succeed!" } +usage() +{ + echo "Usage: $0 [ -l .tar.gz ] [ -u .img ] [ -s .img ] [ -h ]" + exit 2 +} + ############################ Start of script ################################### if [ ! -b $PLATFORM_MAIN_STORAGE ]; then @@ -295,7 +301,11 @@ while getopts ":l:u:s:h" opt; do update_spl $OPTARG ;; h) - echo "Invalid option: -$OPTARG" >&2 + usage + ;; + ?) + log INFO "Invalid option: -$OPTARG" + usage ;; esac done