Skip to content

Commit

Permalink
Allow fstab entries starting with /dev/disk.
Browse files Browse the repository at this point in the history
  • Loading branch information
gmileka committed Jan 15, 2025
1 parent 9b2e6aa commit 3e4fd40
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
2 changes: 2 additions & 0 deletions toolkit/tools/imagecustomizerapi/mountidentifiertype.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ const (

MountIdentifierTypeOverlay MountIdentifierType = "overlay"

MountIdentifierTypeCustom MountIdentifierType = "custom"

// MountIdentifierTypeDefault uses the default type, which is PARTUUID.
MountIdentifierTypeDefault MountIdentifierType = ""
)
Expand Down
8 changes: 7 additions & 1 deletion toolkit/tools/pkg/imagecustomizerlib/partitionutils.go
Original file line number Diff line number Diff line change
Expand Up @@ -313,7 +313,8 @@ func findSourcePartitionHelper(source string,
var partitionIndex int

if mountIdType != imagecustomizerapi.MountIdentifierTypeDeviceMapper &&
mountIdType != imagecustomizerapi.MountIdentifierTypeOverlay {
mountIdType != imagecustomizerapi.MountIdentifierTypeOverlay &&
mountIdType != imagecustomizerapi.MountIdentifierTypeCustom {
partition, partitionIndex, err = findPartition(mountIdType, mountId, partitions)
if err != nil {
return imagecustomizerapi.MountIdentifierTypeDefault, diskutils.PartitionInfo{}, 0, err
Expand Down Expand Up @@ -378,6 +379,11 @@ func parseSourcePartition(source string) (imagecustomizerapi.MountIdentifierType
return imagecustomizerapi.MountIdentifierTypeDeviceMapper, deviceMapperValue, nil
}

_, isDeviceCustom := strings.CutPrefix(source, "/dev/disk")
if isDeviceCustom {
return imagecustomizerapi.MountIdentifierTypeCustom, "", nil
}

if source == "overlay" {
return imagecustomizerapi.MountIdentifierTypeOverlay, "", nil
}
Expand Down

0 comments on commit 3e4fd40

Please sign in to comment.