summaryrefslogtreecommitdiffstats
path: root/scripts
diff options
context:
space:
mode:
Diffstat (limited to 'scripts')
-rw-r--r--scripts/lib/wic/engine.py16
1 files changed, 14 insertions, 2 deletions
diff --git a/scripts/lib/wic/engine.py b/scripts/lib/wic/engine.py
index 11dedb8cac..850cec30e5 100644
--- a/scripts/lib/wic/engine.py
+++ b/scripts/lib/wic/engine.py
@@ -340,9 +340,21 @@ class Disk:
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 if self.partitions[pnum].fstype.startswith('ext'): 342 if self.partitions[pnum].fstype.startswith('ext'):
343 exec_cmd("{} {} -wR 'rm {}'".format(self.debugfs, 343 cmd = "{} {} -wR 'rm {}'".format(self.debugfs,
344 self._get_part_image(pnum), 344 self._get_part_image(pnum),
345 path), as_shell=True) 345 path)
346 out = exec_cmd(cmd , as_shell=True)
347 for line in out.splitlines():
348 if line.startswith("rm:"):
349 if "file is a directory" in line:
350 # Try rmdir to see if this is an empty directory. This won't delete
351 # any non empty directory so let user know about any error that this might
352 # generate.
353 print(exec_cmd("{} {} -wR 'rmdir {}'".format(self.debugfs,
354 self._get_part_image(pnum),
355 path), as_shell=True))
356 else:
357 raise WicError("Could not complete operation: wic %s" % str(line))
346 else: # fat 358 else: # fat
347 cmd = "{} -i {} ::{}".format(self.mdel, partimg, path) 359 cmd = "{} -i {} ::{}".format(self.mdel, partimg, path)
348 try: 360 try: