diff options
author | Ed Bartosh <ed.bartosh@linux.intel.com> | 2017-09-05 14:54:38 +0300 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2017-09-11 17:30:11 +0100 |
commit | be530b7c7beae6f9fc95eed245cb37066d56581e (patch) | |
tree | 74cefa331aaa116818fecde456be3c75845406c6 /scripts/lib | |
parent | 1a2bc70e6f85f414e7af48489e24c09ff335486d (diff) | |
download | openembedded-core-be530b7c7beae6f9fc95eed245cb37066d56581e.tar.gz openembedded-core-be530b7c7beae6f9fc95eed245cb37066d56581e.tar.bz2 openembedded-core-be530b7c7beae6f9fc95eed245cb37066d56581e.zip |
wic: implement ext fs support for 'wic rm'
Implemented removing files or directories from the ext
partition using debugfs tool.
Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com>
Signed-off-by: Ross Burton <ross.burton@intel.com>
Diffstat (limited to 'scripts/lib')
-rw-r--r-- | scripts/lib/wic/engine.py | 27 |
1 files changed, 16 insertions, 11 deletions
diff --git a/scripts/lib/wic/engine.py b/scripts/lib/wic/engine.py index 9ebd93ae27..edcfab39ef 100644 --- a/scripts/lib/wic/engine.py +++ b/scripts/lib/wic/engine.py @@ -339,18 +339,23 @@ class Disk: def remove(self, pnum, path): """Remove files/dirs from the partition.""" partimg = self._get_part_image(pnum) - cmd = "{} -i {} ::{}".format(self.mdel, partimg, path) - try: - exec_cmd(cmd) - except WicError as err: - if "not found" in str(err) or "non empty" in str(err): - # mdel outputs 'File ... not found' or 'directory .. non empty" - # try to use mdeltree as path could be a directory - cmd = "{} -i {} ::{}".format(self.mdeltree, - partimg, path) + if self.partitions[pnum].fstype.startswith('ext'): + exec_cmd("{} {} -wR 'rm {}'".format(self.debugfs, + self._get_part_image(pnum), + path), as_shell=True) + else: # fat + cmd = "{} -i {} ::{}".format(self.mdel, partimg, path) + try: exec_cmd(cmd) - else: - raise err + except WicError as err: + if "not found" in str(err) or "non empty" in str(err): + # mdel outputs 'File ... not found' or 'directory .. non empty" + # try to use mdeltree as path could be a directory + cmd = "{} -i {} ::{}".format(self.mdeltree, + partimg, path) + exec_cmd(cmd) + else: + raise err self._put_part_image(pnum) def write(self, target, expand): |