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 <patrick.zysset@netmodule.com>
This commit is contained in:
Patrick Zysset 2018-10-11 10:55:47 +02:00
parent 2d1b39425a
commit 9516353ff8
1 changed files with 11 additions and 1 deletions

View File

@ -276,6 +276,12 @@ update_spl()
log INFO "spl update succeed!"
}
usage()
{
echo "Usage: $0 [ -l <linux-image>.tar.gz ] [ -u <u-boot>.img ] [ -s <spl>.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