Skip to content

Commit

Permalink
otk-gen-partition-table: add part_type to supported inputs
Browse files Browse the repository at this point in the history
We need this to generate bit-by-bit compatible manifests from otk
to the ones that `images` generates.

See also osbuild/otk#186
  • Loading branch information
mvo5 authored and supakeen committed Sep 2, 2024
1 parent 3646aff commit 0a9d89e
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
2 changes: 2 additions & 0 deletions cmd/otk-gen-partition-table/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ type InputPartition struct {
Size string `json:"size"`
Type string `json:"type"`
PartUUID string `json:"part_uuid"`
PartType string `json:"part_type"`
FsUUID string `json:"fs_uuid"`
FSMntOps string `json:"fs_mntops"`
FSFreq uint64 `json:"fs_freq"`
Expand Down Expand Up @@ -164,6 +165,7 @@ func makePartitionTableFromOtkInput(input *Input) (*disk.PartitionTable, error)
pt.Partitions = append(pt.Partitions, disk.Partition{
Size: uintSize,
UUID: part.PartUUID,
Type: part.PartType,
// XXX: support lvm,luks here
Payload: &disk.Filesystem{
Label: part.Label,
Expand Down
7 changes: 5 additions & 2 deletions cmd/otk-gen-partition-table/main_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,8 @@ var partInputsComplete = `
"mountpoint": "/",
"label": "root",
"size": "7 GiB",
"type": "ext4"
"type": "ext4",
"part_uuid": "0FC63DAF-8483-4772-8E79-3D69D8477DE4"
},
{
"name": "home",
Expand Down Expand Up @@ -70,6 +71,7 @@ var expectedInput = &genpart.Input{
Label: "root",
Size: "7 GiB",
Type: "ext4",
PartUUID: "0FC63DAF-8483-4772-8E79-3D69D8477DE4",
}, {
Name: "home",
Mountpoint: "/home",
Expand Down Expand Up @@ -113,6 +115,7 @@ func TestUnmarshalOutput(t *testing.T) {
Partitions: []disk.Partition{
{
UUID: "911911",
Type: "119119",
Payload: &disk.Filesystem{
Type: "ext4",
},
Expand Down Expand Up @@ -143,7 +146,7 @@ func TestUnmarshalOutput(t *testing.T) {
{
"Start": 0,
"Size": 0,
"Type": "",
"Type": "119119",
"Bootable": false,
"UUID": "911911",
"Payload": {
Expand Down

0 comments on commit 0a9d89e

Please sign in to comment.