summaryrefslogtreecommitdiffstats
path: root/scripts/wic
diff options
context:
space:
mode:
authorChee Yang Lee <chee.yang.lee@intel.com>2019-11-21 14:28:52 +0800
committerRichard Purdie <richard.purdie@linuxfoundation.org>2019-11-27 13:23:27 +0000
commitbd669c1809a378f93580eb9e0679a26ec6746cb8 (patch)
tree0d82d99e5d51c3f3c64eefa6e4bf4c5677e50d2f /scripts/wic
parent7356ae622bd71ba1a022a9ed18c4cf085e948b38 (diff)
downloadopenembedded-core-contrib-bd669c1809a378f93580eb9e0679a26ec6746cb8.tar.gz
openembedded-core-contrib-bd669c1809a378f93580eb9e0679a26ec6746cb8.tar.bz2
openembedded-core-contrib-bd669c1809a378f93580eb9e0679a26ec6746cb8.zip
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-xscripts/wic16
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)