diff options
author | Ed Bartosh <ed.bartosh@linux.intel.com> | 2017-06-13 14:22:12 +0300 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2017-06-14 10:18:22 +0100 |
commit | 4abf2d2643c58322d96d63d5f3ffaf52d62c6792 (patch) | |
tree | ba06bcdb6acac582295a74f850b854e885e592fc /scripts/lib | |
parent | f8e42c13609c482359fbdb225fb16a45101ae9ae (diff) | |
download | openembedded-core-4abf2d2643c58322d96d63d5f3ffaf52d62c6792.tar.gz openembedded-core-4abf2d2643c58322d96d63d5f3ffaf52d62c6792.tar.bz2 openembedded-core-4abf2d2643c58322d96d63d5f3ffaf52d62c6792.zip |
wic: implement removing files
Added implementation of Disk.del method and wic_r
function that removes files from the vfat partition
using mdel utility.
[YOCTO #11283]
Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'scripts/lib')
-rw-r--r-- | scripts/lib/wic/engine.py | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/scripts/lib/wic/engine.py b/scripts/lib/wic/engine.py index 9a8055c05c..6fc8bb72c3 100644 --- a/scripts/lib/wic/engine.py +++ b/scripts/lib/wic/engine.py @@ -238,6 +238,7 @@ class Disk: self._partitions = None self._mdir = None self._mcopy = None + self._mdel = None self._partimages = {} # find parted @@ -285,6 +286,10 @@ class Disk: def mcopy(self): return self._prop("mcopy") + @property + def mdel(self): + return self._prop("mdel") + def _get_part_image(self, pnum): if pnum not in self.partitions: raise WicError("Partition %s is not in the image") @@ -318,6 +323,14 @@ class Disk: exec_cmd(cmd) self._put_part_image(pnum) + def remove(self, pnum, path): + """Remove files/dirs from the partition.""" + cmd = "{} -i {} ::{}".format(self.mdel, + self._get_part_image(pnum), + path) + exec_cmd(cmd) + self._put_part_image(pnum) + def wic_ls(args, native_sysroot): """List contents of partitioned image or vfat partition.""" disk = Disk(args.path.image, native_sysroot) @@ -345,7 +358,8 @@ def wic_rm(args, native_sysroot): Remove files or directories from the vfat partition of partitioned image. """ - pass + disk = Disk(args.path.image, native_sysroot) + disk.remove(args.path.part, args.path.path) def find_canned(scripts_path, file_name): """ |