mirror of
https://github.com/kevingruesser/bootstrap-vz.git
synced 2025-08-22 09:50:37 +00:00
Move swap partition before root
This commit is contained in:
parent
2af0968156
commit
637f49904a
2 changed files with 12 additions and 8 deletions
|
@ -8,15 +8,17 @@ class GPTPartitionMap(AbstractPartitionMap):
|
|||
|
||||
def __init__(self, data):
|
||||
self.partitions = []
|
||||
|
||||
def last_partition():
|
||||
return self.partitions[-1] if len(self.partitions) > 0 else None
|
||||
if 'boot' in data:
|
||||
self.boot = GPTPartition(data['boot']['size'], data['boot']['filesystem'], 'boot', None)
|
||||
self.partitions.append(self.boot)
|
||||
self.root = GPTPartition(data['root']['size'], data['root']['filesystem'], 'root',
|
||||
getattr(self, 'boot', None))
|
||||
self.partitions.append(self.root)
|
||||
if 'swap' in data:
|
||||
self.swap = GPTSwapPartition(data['swap']['size'], self.root)
|
||||
self.swap = GPTSwapPartition(data['swap']['size'], last_partition())
|
||||
self.partitions.append(self.swap)
|
||||
self.root = GPTPartition(data['root']['size'], data['root']['filesystem'], 'root', last_partition())
|
||||
self.partitions.append(self.root)
|
||||
|
||||
super(GPTPartitionMap, self).__init__()
|
||||
|
||||
|
|
|
@ -8,15 +8,17 @@ class MBRPartitionMap(AbstractPartitionMap):
|
|||
|
||||
def __init__(self, data):
|
||||
self.partitions = []
|
||||
|
||||
def last_partition():
|
||||
return self.partitions[-1] if len(self.partitions) > 0 else None
|
||||
if 'boot' in data:
|
||||
self.boot = MBRPartition(data['boot']['size'], data['boot']['filesystem'], None)
|
||||
self.partitions.append(self.boot)
|
||||
self.root = MBRPartition(data['root']['size'], data['root']['filesystem'],
|
||||
getattr(self, 'boot', None))
|
||||
self.partitions.append(self.root)
|
||||
if 'swap' in data:
|
||||
self.swap = MBRSwapPartition(data['swap']['size'], self.root)
|
||||
self.swap = MBRSwapPartition(data['swap']['size'], last_partition())
|
||||
self.partitions.append(self.swap)
|
||||
self.root = MBRPartition(data['root']['size'], data['root']['filesystem'], last_partition())
|
||||
self.partitions.append(self.root)
|
||||
|
||||
super(MBRPartitionMap, self).__init__()
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue