[Buildroot] [RFC 2/4] genimage.sh: fix getopts traces

Etienne Phelip etienne.phelip at savoirfairelinux.com
Tue Apr 18 15:55:52 UTC 2017


The first trace is never displayed, the second shows an empty string
because OPTARG is not set.

To display both traces properly, the optstring of getopts needs to
start with a colon.

Signed-off-by: Etienne Phelip <etienne.phelip at savoirfairelinux.com>
---
 support/scripts/genimage.sh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/support/scripts/genimage.sh b/support/scripts/genimage.sh
index 6684e73..6f9102c 100755
--- a/support/scripts/genimage.sh
+++ b/support/scripts/genimage.sh
@@ -10,7 +10,7 @@ GENIMAGE_TMP="${BUILD_DIR}/genimage.tmp"
 # First argument is BINARIES_DIR, skip it
 shift
 
-while getopts c: OPT ; do
+while getopts :c: OPT ; do
 	case "${OPT}" in
 	c) GENIMAGE_CFG="${OPTARG}";;
 	:) die "option '${OPTARG}' expects a mandatory argument\n";;
-- 
2.9.3



More information about the buildroot mailing list