summaryrefslogtreecommitdiffstats
path: root/scripts/lib/wic
diff options
context:
space:
mode:
Diffstat (limited to 'scripts/lib/wic')
-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):