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:25:18 +0000 |
| commit | 89288705c682bceea52302cc607ff221ca30f3d1 (patch) | |
| tree | 8a1a42dffbd49ed7fd82c7c9665575e80225c30e /scripts/wic | |
| parent | 4d6a9708e6e1e1aadca7e9eb50841778d391a456 (diff) | |
| download | poky-89288705c682bceea52302cc607ff221ca30f3d1.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]
(From OE-Core rev: bd669c1809a378f93580eb9e0679a26ec6746cb8)
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): | |||
| 392 | 392 | ||
| 393 | def wic_init_parser_cp(subparser): | 393 | def wic_init_parser_cp(subparser): |
| 394 | subparser.add_argument("src", | 394 | subparser.add_argument("src", |
| 395 | help="source spec") | 395 | help="image spec: <image>:<vfat partition>[<path>] or <file>") |
| 396 | subparser.add_argument("dest", type=imgpathtype, | 396 | subparser.add_argument("dest", |
| 397 | help="image spec: <image>:<vfat partition>[<path>]") | 397 | help="image spec: <image>:<vfat partition>[<path>] or <file>") |
| 398 | subparser.add_argument("-n", "--native-sysroot", | 398 | subparser.add_argument("-n", "--native-sysroot", |
| 399 | help="path to the native sysroot containing the tools") | 399 | help="path to the native sysroot containing the tools") |
| 400 | 400 | ||
| @@ -522,6 +522,16 @@ def main(argv): | |||
| 522 | hlpt[0](hlpt[1], hlpt[2]) | 522 | hlpt[0](hlpt[1], hlpt[2]) |
| 523 | return 0 | 523 | return 0 |
| 524 | 524 | ||
| 525 | # validate wic cp src and dest parameter to identify which one of it is | ||
| 526 | # image and cast it into imgtype | ||
| 527 | if args.command == "cp": | ||
| 528 | if ":" in args.dest: | ||
| 529 | args.dest = imgtype(args.dest) | ||
| 530 | elif ":" in args.src: | ||
| 531 | args.src = imgtype(args.src) | ||
| 532 | else: | ||
| 533 | raise argparse.ArgumentTypeError("no image or partition number specified.") | ||
| 534 | |||
| 525 | return hlp.invoke_subcommand(args, parser, hlp.wic_help_usage, subcommands) | 535 | return hlp.invoke_subcommand(args, parser, hlp.wic_help_usage, subcommands) |
| 526 | 536 | ||
| 527 | 537 | ||
