From b8bbac951c42c6639a66696ade4477aa2be6aa54 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Rafa=C5=82=20Mi=C5=82ecki?= Date: Mon, 25 Oct 2021 10:17:15 +0200 Subject: [PATCH] layerscape: mkits-multiple-config: fail on invalid arguments MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Fail if arguments couldn't be parsed and print unrecognized part. It's important when running it from script with dynamic values. Missing value could result in skipping argument and silent failures (unexpected its). Signed-off-by: Rafał Miłecki --- target/linux/layerscape/image/mkits-multiple-config.sh | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/target/linux/layerscape/image/mkits-multiple-config.sh b/target/linux/layerscape/image/mkits-multiple-config.sh index 68870686c5..b2d8f4ef7f 100755 --- a/target/linux/layerscape/image/mkits-multiple-config.sh +++ b/target/linux/layerscape/image/mkits-multiple-config.sh @@ -198,6 +198,11 @@ parse_args() { usage;; esac done + shift $(($OPTIND - 1)) + [ $# -gt 0 ] && { + echo "Failed to parse all passed arguments (unrecognized: \"$@\")" + exit 1 + } [ -n "${OUTPUT}" ] || OUTPUT=fitimage.its [ -n "${VERSION}" ] || VERSION="Unknown" [ -n "${ARCH}" ] || ARCH=arm -- 2.30.2