tools/osbuild-mpp: set part ID from name if missing

For our Fedora CoreOS disk images we set the partition labels (name)
for the partitions. This is also supported using the primitives here
in OSBuild, but it wasn't obvious that I needed to set the name in
the mpp-define-images definition. Let's set the name there, but let's
also allow osbuild-mpp to set the `id`, which is what is used later
to access that partition from the `name` too if `id` isn't set.

This means we allow something like:

   - name: BIOS-BOOT
     type: 21686148-6449-6E6F-744E-656564454649
     bootable: true
     uuid: FAC7F1FB-3E8D-4137-A512-961DE09A5549
     size: 100

rather than requiring something like:

   - id: BIOS-BOOT
     name: BIOS-BOOT
     type: 21686148-6449-6E6F-744E-656564454649
     bootable: true
     uuid: FAC7F1FB-3E8D-4137-A512-961DE09A5549
     size: 100
This commit is contained in:
Dusty Mabe 2023-11-27 15:53:13 -05:00 committed by Simon de Vlieger
parent 5ad3f968e1
commit e191dc1d0d
3 changed files with 19 additions and 9 deletions

View file

@ -567,24 +567,28 @@
"size": 2048,
"type": "21686148-6449-6E6F-744E-656564454649",
"bootable": true,
"name": "BIOS-BOOT",
"uuid": "FAC7F1FB-3E8D-4137-A512-961DE09A5549"
},
{
"start": 4096,
"size": 260096,
"type": "C12A7328-F81F-11D2-BA4B-00A0C93EC93B",
"name": "EFI-SYSTEM",
"uuid": "68B2905B-DF3E-4FB3-80FA-49D1E773AA33"
},
{
"start": 264192,
"size": 786432,
"type": "0FC63DAF-8483-4772-8E79-3D69D8477DE4",
"name": "boot",
"uuid": "61B2905B-DF3E-4FB3-80FA-49D1E773AA32"
},
{
"start": 1050624,
"size": 4194304,
"type": "0FC63DAF-8483-4772-8E79-3D69D8477DE4",
"name": "root",
"uuid": "CA7D7CCB-63ED-4C53-861C-1742536059CC"
}
]
@ -762,24 +766,28 @@
"size": 256,
"type": "21686148-6449-6E6F-744E-656564454649",
"bootable": true,
"name": "BIOS-BOOT",
"uuid": "FAC7F1FB-3E8D-4137-A512-961DE09A5549"
},
{
"start": 512,
"size": 32512,
"type": "C12A7328-F81F-11D2-BA4B-00A0C93EC93B",
"name": "EFI-SYSTEM",
"uuid": "68B2905B-DF3E-4FB3-80FA-49D1E773AA33"
},
{
"start": 33024,
"size": 98304,
"type": "0FC63DAF-8483-4772-8E79-3D69D8477DE4",
"name": "boot",
"uuid": "61B2905B-DF3E-4FB3-80FA-49D1E773AA32"
},
{
"start": 131328,
"size": 524288,
"type": "0FC63DAF-8483-4772-8E79-3D69D8477DE4",
"name": "root",
"uuid": "CA7D7CCB-63ED-4C53-861C-1742536059CC"
}
]

View file

@ -15,23 +15,23 @@ mpp-define-images:
uuid: 00000000-0000-4000-a000-000000000001
label: gpt
partitions:
- id: BIOS-BOOT
- name: BIOS-BOOT
type: 21686148-6449-6E6F-744E-656564454649
bootable: true
uuid: FAC7F1FB-3E8D-4137-A512-961DE09A5549
size:
mpp-format-int: "{bios_boot_size_mb * 1024 * 1024 / sector_size}"
- id: EFI-SYSTEM
- name: EFI-SYSTEM
type: C12A7328-F81F-11D2-BA4B-00A0C93EC93B
uuid: 68B2905B-DF3E-4FB3-80FA-49D1E773AA33
size:
mpp-format-int: "{efi_system_size_mb * 1024 * 1024 / sector_size}"
- id: boot
- name: boot
type: 0FC63DAF-8483-4772-8E79-3D69D8477DE4
uuid: 61B2905B-DF3E-4FB3-80FA-49D1E773AA32
size:
mpp-format-int: "{boot_size_mb * 1024 * 1024 / sector_size}"
- id: root
- name: root
type: 0FC63DAF-8483-4772-8E79-3D69D8477DE4
uuid: CA7D7CCB-63ED-4C53-861C-1742536059CC
size:
@ -45,23 +45,23 @@ mpp-define-images:
uuid: 00000000-0000-4000-a000-000000000001
label: gpt
partitions:
- id: BIOS-BOOT
- name: BIOS-BOOT
type: 21686148-6449-6E6F-744E-656564454649
bootable: true
uuid: FAC7F1FB-3E8D-4137-A512-961DE09A5549
size:
mpp-format-int: "{bios_boot_size_mb * 1024 * 1024 / four_k_sector_size}"
- id: EFI-SYSTEM
- name: EFI-SYSTEM
type: C12A7328-F81F-11D2-BA4B-00A0C93EC93B
uuid: 68B2905B-DF3E-4FB3-80FA-49D1E773AA33
size:
mpp-format-int: "{efi_system_size_mb * 1024 * 1024 / four_k_sector_size}"
- id: boot
- name: boot
type: 0FC63DAF-8483-4772-8E79-3D69D8477DE4
uuid: 61B2905B-DF3E-4FB3-80FA-49D1E773AA32
size:
mpp-format-int: "{boot_size_mb * 1024 * 1024 / four_k_sector_size}"
- id: root
- name: root
type: 0FC63DAF-8483-4772-8E79-3D69D8477DE4
uuid: CA7D7CCB-63ED-4C53-861C-1742536059CC
size: