From 89288705c682bceea52302cc607ff221ca30f3d1 Mon Sep 17 00:00:00 2001 From: Chee Yang Lee Date: Thu, 21 Nov 2019 14:28:52 +0800 Subject: wic: 'wic cp' to copy from image currently 'wic cp' only works for copy file from local storage to wic image. enhance 'wic cp' to copy file/directory from wic image to local storage. include selftest and 'wic help' updates. [YOCTO#12169] (From OE-Core rev: bd669c1809a378f93580eb9e0679a26ec6746cb8) Signed-off-by: Chee Yang Lee Signed-off-by: Richard Purdie --- scripts/wic | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) (limited to 'scripts/wic') diff --git a/scripts/wic b/scripts/wic index ea614100c2..24700f380f 100755 --- a/scripts/wic +++ b/scripts/wic @@ -392,9 +392,9 @@ def imgpathtype(arg): def wic_init_parser_cp(subparser): subparser.add_argument("src", - help="source spec") - subparser.add_argument("dest", type=imgpathtype, - help="image spec: :[]") + help="image spec: :[] or ") + subparser.add_argument("dest", + help="image spec: :[] or ") subparser.add_argument("-n", "--native-sysroot", help="path to the native sysroot containing the tools") @@ -522,6 +522,16 @@ def main(argv): hlpt[0](hlpt[1], hlpt[2]) return 0 + # validate wic cp src and dest parameter to identify which one of it is + # image and cast it into imgtype + if args.command == "cp": + if ":" in args.dest: + args.dest = imgtype(args.dest) + elif ":" in args.src: + args.src = imgtype(args.src) + else: + raise argparse.ArgumentTypeError("no image or partition number specified.") + return hlp.invoke_subcommand(args, parser, hlp.wic_help_usage, subcommands) -- cgit v1.2.3-54-g00ecf