mirror of
https://github.com/flatcar/scripts.git
synced 2025-09-26 16:11:56 +02:00
Merge pull request #353 from marineam/gptprio
disk_util: Set priority and successful attributes in new images
This commit is contained in:
commit
204f0024fb
@ -29,7 +29,8 @@
|
||||
"blocks":"2097152",
|
||||
"fs_blocks":"262144",
|
||||
"fs_type":"ext2",
|
||||
"mount":"/usr"
|
||||
"mount":"/usr",
|
||||
"features": ["prioritize"]
|
||||
},
|
||||
"4":{
|
||||
"label":"USR-B",
|
||||
|
@ -278,6 +278,7 @@ def WritePartitionTable(options, config=None, partitions=None):
|
||||
|
||||
syslinux = False
|
||||
hybrid = None
|
||||
prioritize = []
|
||||
for partition in partitions.itervalues():
|
||||
if partition['type'] != 'blank':
|
||||
Cgpt('add', '-i', partition['num'],
|
||||
@ -293,6 +294,8 @@ def WritePartitionTable(options, config=None, partitions=None):
|
||||
hybrid = partition['num']
|
||||
if 'syslinux' in features:
|
||||
syslinux = True
|
||||
if 'prioritize' in features:
|
||||
prioritize.append(partition)
|
||||
|
||||
if hybrid:
|
||||
# Enable legacy boot flag and generate a hybrid MBR partition table
|
||||
@ -314,6 +317,10 @@ def WritePartitionTable(options, config=None, partitions=None):
|
||||
with open(options.disk_image, 'r+') as image_fd:
|
||||
image_fd.write(mbr_code)
|
||||
|
||||
prioritize.reverse()
|
||||
for i, partition in enumerate(prioritize):
|
||||
Cgpt('add', '-i', partition['num'], '-S1', '-P', i+1, options.disk_image)
|
||||
|
||||
Cgpt('show', options.disk_image)
|
||||
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user