mirror of
https://github.com/kevingruesser/bootstrap-vz.git
synced 2025-08-24 15:36:27 +00:00
Related to 26bb907, both gpt and msdos partitions need the 1 sector gap now
This commit is contained in:
parent
a62ce1705a
commit
4cbc8e4f8e
2 changed files with 13 additions and 1 deletions
|
@ -34,7 +34,7 @@ class GPTPartitionMap(AbstractPartitionMap):
|
||||||
|
|
||||||
# Offset all partitions by 1 sector.
|
# Offset all partitions by 1 sector.
|
||||||
# parted in jessie has changed and no longer allows
|
# parted in jessie has changed and no longer allows
|
||||||
# gpt partitions to be right next to each other.
|
# partitions to be right next to each other.
|
||||||
partition_gap = Sectors(1, sector_size)
|
partition_gap = Sectors(1, sector_size)
|
||||||
|
|
||||||
# The boot and swap partitions are optional
|
# The boot and swap partitions are optional
|
||||||
|
|
|
@ -31,13 +31,25 @@ class MSDOSPartitionMap(AbstractPartitionMap):
|
||||||
last_partition())
|
last_partition())
|
||||||
self.partitions.append(self.boot)
|
self.partitions.append(self.boot)
|
||||||
|
|
||||||
|
# Offset all partitions by 1 sector.
|
||||||
|
# parted in jessie has changed and no longer allows
|
||||||
|
# partitions to be right next to each other.
|
||||||
|
partition_gap = Sectors(1, sector_size)
|
||||||
|
|
||||||
if 'swap' in data:
|
if 'swap' in data:
|
||||||
self.swap = MSDOSSwapPartition(Sectors(data['swap']['size'], sector_size), last_partition())
|
self.swap = MSDOSSwapPartition(Sectors(data['swap']['size'], sector_size), last_partition())
|
||||||
|
if self.swap.previous is not None:
|
||||||
|
# No need to pad if this is the first partition
|
||||||
|
self.swap.pad_start += partition_gap
|
||||||
|
self.swap.size -= partition_gap
|
||||||
self.partitions.append(self.swap)
|
self.partitions.append(self.swap)
|
||||||
|
|
||||||
self.root = MSDOSPartition(Sectors(data['root']['size'], sector_size),
|
self.root = MSDOSPartition(Sectors(data['root']['size'], sector_size),
|
||||||
data['root']['filesystem'], data['root'].get('format_command', None),
|
data['root']['filesystem'], data['root'].get('format_command', None),
|
||||||
last_partition())
|
last_partition())
|
||||||
|
if self.root.previous is not None:
|
||||||
|
self.root.pad_start += partition_gap
|
||||||
|
self.root.size -= partition_gap
|
||||||
self.partitions.append(self.root)
|
self.partitions.append(self.root)
|
||||||
|
|
||||||
# Mark boot as the boot partition, or root, if boot does not exist
|
# Mark boot as the boot partition, or root, if boot does not exist
|
||||||
|
|
Loading…
Add table
Reference in a new issue