summaryrefslogtreecommitdiffstats
path: root/scripts
diff options
context:
space:
mode:
authorEd Bartosh <ed.bartosh@linux.intel.com>2017-09-05 14:54:38 +0300
committerRichard Purdie <richard.purdie@linuxfoundation.org>2017-09-11 17:30:28 +0100
commit2c16117dce6b760f165f7522516356f74b3d8904 (patch)
treeb0283174a63a0ec448ec3430271a8e0624c40abd /scripts
parent9f90956967caca7be50e501b3843dfaf03d90943 (diff)
downloadpoky-2c16117dce6b760f165f7522516356f74b3d8904.tar.gz
wic: implement ext fs support for 'wic rm'
Implemented removing files or directories from the ext partition using debugfs tool. (From OE-Core rev: be530b7c7beae6f9fc95eed245cb37066d56581e) Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com> Signed-off-by: Ross Burton <ross.burton@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'scripts')
-rw-r--r--scripts/lib/wic/engine.py27
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:
339 def remove(self, pnum, path): 339 def remove(self, pnum, path):
340 """Remove files/dirs from the partition.""" 340 """Remove files/dirs from the partition."""
341 partimg = self._get_part_image(pnum) 341 partimg = self._get_part_image(pnum)
342 cmd = "{} -i {} ::{}".format(self.mdel, partimg, path) 342 if self.partitions[pnum].fstype.startswith('ext'):
343 try: 343 exec_cmd("{} {} -wR 'rm {}'".format(self.debugfs,
344 exec_cmd(cmd) 344 self._get_part_image(pnum),
345 except WicError as err: 345 path), as_shell=True)
346 if "not found" in str(err) or "non empty" in str(err): 346 else: # fat
347 # mdel outputs 'File ... not found' or 'directory .. non empty" 347 cmd = "{} -i {} ::{}".format(self.mdel, partimg, path)
348 # try to use mdeltree as path could be a directory 348 try:
349 cmd = "{} -i {} ::{}".format(self.mdeltree,
350 partimg, path)
351 exec_cmd(cmd) 349 exec_cmd(cmd)
352 else: 350 except WicError as err:
353 raise err 351 if "not found" in str(err) or "non empty" in str(err):
352 # mdel outputs 'File ... not found' or 'directory .. non empty"
353 # try to use mdeltree as path could be a directory
354 cmd = "{} -i {} ::{}".format(self.mdeltree,
355 partimg, path)
356 exec_cmd(cmd)
357 else:
358 raise err
354 self._put_part_image(pnum) 359 self._put_part_image(pnum)
355 360
356 def write(self, target, expand): 361 def write(self, target, expand):