[Buildroot] [RFC 1/4] genimage.sh: fix argument parsing

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


When executed as a post-image script, BR sets BINARIE_DIR as first
argument.

This first argument causes the option parsing to break.

This patch shifts the first argument before performing the getopts
loop.

	BR2_ROOTFS_POST_IMAGE_SCRIPT="support/scripts/genimage.sh"
	BR2_ROOTFS_POST_SCRIPT_ARGS="-c path/to/genimage.cfg"

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

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



More information about the buildroot mailing list