summaryrefslogtreecommitdiffstats
path: root/scripts/lib/wic
diff options
context:
space:
mode:
authorEd Bartosh <ed.bartosh@linux.intel.com>2017-06-13 14:22:12 +0300
committerRichard Purdie <richard.purdie@linuxfoundation.org>2017-06-14 10:18:29 +0100
commitc5fadce5f90c7e49cb5e40943f1c38f95cc13588 (patch)
treef57dc33a00ba7b42e9a2c3c553916e74bc264687 /scripts/lib/wic
parentc869c1d6b234dc3aa5286f0b1d1b589c83c5fcfa (diff)
downloadpoky-c5fadce5f90c7e49cb5e40943f1c38f95cc13588.tar.gz
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] (From OE-Core rev: 4abf2d2643c58322d96d63d5f3ffaf52d62c6792) Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'scripts/lib/wic')
-rw-r--r--scripts/lib/wic/engine.py16
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:
238 self._partitions = None 238 self._partitions = None
239 self._mdir = None 239 self._mdir = None
240 self._mcopy = None 240 self._mcopy = None
241 self._mdel = None
241 self._partimages = {} 242 self._partimages = {}
242 243
243 # find parted 244 # find parted
@@ -285,6 +286,10 @@ class Disk:
285 def mcopy(self): 286 def mcopy(self):
286 return self._prop("mcopy") 287 return self._prop("mcopy")
287 288
289 @property
290 def mdel(self):
291 return self._prop("mdel")
292
288 def _get_part_image(self, pnum): 293 def _get_part_image(self, pnum):
289 if pnum not in self.partitions: 294 if pnum not in self.partitions:
290 raise WicError("Partition %s is not in the image") 295 raise WicError("Partition %s is not in the image")
@@ -318,6 +323,14 @@ class Disk:
318 exec_cmd(cmd) 323 exec_cmd(cmd)
319 self._put_part_image(pnum) 324 self._put_part_image(pnum)
320 325
326 def remove(self, pnum, path):
327 """Remove files/dirs from the partition."""
328 cmd = "{} -i {} ::{}".format(self.mdel,
329 self._get_part_image(pnum),
330 path)
331 exec_cmd(cmd)
332 self._put_part_image(pnum)
333
321def wic_ls(args, native_sysroot): 334def wic_ls(args, native_sysroot):
322 """List contents of partitioned image or vfat partition.""" 335 """List contents of partitioned image or vfat partition."""
323 disk = Disk(args.path.image, native_sysroot) 336 disk = Disk(args.path.image, native_sysroot)
@@ -345,7 +358,8 @@ def wic_rm(args, native_sysroot):
345 Remove files or directories from the vfat partition of 358 Remove files or directories from the vfat partition of
346 partitioned image. 359 partitioned image.
347 """ 360 """
348 pass 361 disk = Disk(args.path.image, native_sysroot)
362 disk.remove(args.path.part, args.path.path)
349 363
350def find_canned(scripts_path, file_name): 364def find_canned(scripts_path, file_name):
351 """ 365 """