diff options
author | Chee Yang Lee <chee.yang.lee@intel.com> | 2019-11-21 14:28:52 +0800 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2019-11-27 13:23:27 +0000 |
commit | bd669c1809a378f93580eb9e0679a26ec6746cb8 (patch) | |
tree | 0d82d99e5d51c3f3c64eefa6e4bf4c5677e50d2f /scripts/wic | |
parent | 7356ae622bd71ba1a022a9ed18c4cf085e948b38 (diff) | |
download | openembedded-core-contrib-bd669c1809a378f93580eb9e0679a26ec6746cb8.tar.gz |
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]
Signed-off-by: Chee Yang Lee <chee.yang.lee@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'scripts/wic')
-rwxr-xr-x | scripts/wic | 16 |
1 files changed, 13 insertions, 3 deletions
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: <image>:<vfat partition>[<path>]") + help="image spec: <image>:<vfat partition>[<path>] or <file>") + subparser.add_argument("dest", + help="image spec: <image>:<vfat partition>[<path>] or <file>") 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) |