diff options
Diffstat (limited to 'scripts')
-rw-r--r-- | scripts/lib/wic/engine.py | 16 |
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 | |||
321 | def wic_ls(args, native_sysroot): | 334 | def 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 | ||
350 | def find_canned(scripts_path, file_name): | 364 | def find_canned(scripts_path, file_name): |
351 | """ | 365 | """ |