genimage.sh: fix calling from BR2_ROOTFS_POST_IMAGE_SCRIPT
PATCH v10 1/2 genimage.sh: fix calling from BR2_ROOTFS_POST_IMAGE_SCRIPT
From: Abhimanyu Vishwakarma <[email protected]>
When called from BR2_ROOTFS_POST_IMAGE_SCRIPT, this script ends up with following error:
Error: Missing argument
This is because, an extra positional argument is also passed along with BR2_ROOTFS_POST_SCRIPT_ARGS. genimage.sh didn't have support to parse positional and optional arguments together.
---
Changes v7->v8
- New file
Changes v8->v9
- Fix indentation
- Use bash basename as script name instead hardcoding (by arnout)
Changes v9->v10 (Suggested by Arnout)
- Remove tab indentation (use existing 2 space indent)
- Fix commit message grammer
- add reviewed-by tag
- keep tested-by tag as no code change just indentation
support/scripts/genimage.sh | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-)
support/scripts/genimage.sh +14 -5
@@ -5,13 +5,22 @@ die() { exit 1 } +# Parse arguments and put into argument list of the script +opts="$(getopt -n "${0##*/}" -o c: -- "$@")" || exit $? +eval set -- "$opts" + GENIMAGE_TMP="${BUILD_DIR}/genimage.tmp" -while getopts c: OPT ; do - case "${OPT}" in - c) GENIMAGE_CFG="${OPTARG}";; - :) die "option '${OPTARG}' expects a mandatory argument\n";; - \?) die "unknown option '${OPTARG}'\n";; +while true ; do + case "$1" in + -c) + GENIMAGE_CFG="${2}"; + shift 2 ;; + --) # Discard all non-option parameters + shift 1; + break ;; + *) + die "unknown option '${1}'" ;; esac done
Signature · 1 line
2.11.0
PATCH v10 1/2 genimage.sh: fix calling from BR2_ROOTFS_POST_IMAGE_SCRIPT
Quoted 29 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
"Abhimanyu" == Abhimanyu Vishwakarma <[email protected]> writes:
From: Abhimanyu Vishwakarma <[email protected]> When called from
BR2_ROOTFS_POST_IMAGE_SCRIPT, this script ends up with following error:Error: Missing argument
This is because, an extra positional argument is also passed along with
BR2_ROOTFS_POST_SCRIPT_ARGS.genimage.shdidn't have support to parse positional and optional arguments together.Signed-off-by Abhimanyu Vishwakarma <[email protected]>Tested-by Rahul Bedarkar <[email protected]>---
Changesv7->v8
- New file
Changesv8->v9
- Fix indentation
- Use bash basename as script name instead hardcoding (by arnout)
Changesv9->v10(Suggested by Arnout)
- Remove tab indentation (use existing 2 space indent)
- Fix commit message grammer
- add reviewed-by tag
- keep tested-by tag as no code change just indentation
Quoted 2 lines
support/scripts/genimage.sh | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-)
Committed, thanks.
Signature · 1 line
Bye, Peter Korsgaard