summaryrefslogtreecommitdiffstats
path: root/scripts/lib/wic/engine.py
diff options
context:
space:
mode:
Diffstat (limited to 'scripts/lib/wic/engine.py')
-rw-r--r--scripts/lib/wic/engine.py4
1 files changed, 3 insertions, 1 deletions
diff --git a/scripts/lib/wic/engine.py b/scripts/lib/wic/engine.py
index fe036f60e9..f0c5ff0aaf 100644
--- a/scripts/lib/wic/engine.py
+++ b/scripts/lib/wic/engine.py
@@ -416,6 +416,7 @@ class Disk:
416 416
417 # calculate expanded partitions sizes 417 # calculate expanded partitions sizes
418 sizes = {} 418 sizes = {}
419 num_auto_resize = 0
419 for num, part in enumerate(parts['partitiontable']['partitions'], 1): 420 for num, part in enumerate(parts['partitiontable']['partitions'], 1):
420 if num in expand: 421 if num in expand:
421 if expand[num] != 0: # don't resize partition if size is set to 0 422 if expand[num] != 0: # don't resize partition if size is set to 0
@@ -425,10 +426,11 @@ class Disk:
425 sizes[num] = sectors 426 sizes[num] = sectors
426 elif part['type'] != 'f': 427 elif part['type'] != 'f':
427 sizes[num] = -1 428 sizes[num] = -1
429 num_auto_resize += 1
428 430
429 for num, part in enumerate(parts['partitiontable']['partitions'], 1): 431 for num, part in enumerate(parts['partitiontable']['partitions'], 1):
430 if sizes.get(num) == -1: 432 if sizes.get(num) == -1:
431 part['size'] += free // len(sizes) 433 part['size'] += free // num_auto_resize
432 434
433 # write resized partition table to the target 435 # write resized partition table to the target
434 write_ptable(parts, target) 436 write_ptable(parts, target)