Skip to content

Commit

Permalink
actions: Fix regression introduced with FAT{12|16|32} support.
Browse files Browse the repository at this point in the history
The regression was introduced with the following commit :
  commit 94fedb2
  Author: Christopher Obbard <chris.obbard@collabora.com>
  Date:   Tue Mar 19 17:43:42 2024 +0000

  actions: image-partition: enable creation of FAT{12|16|32} partitions

This one added more options when it comes to creating FAT partitions.
So when partition fs is defined as "fat", "fat12", "fat16", "fat32",
"msdos" or "vfat", then mkfs.vfat is used to create the partition,
and different options were used depending on the FAT type.

The main issue is that  mounting a FAT partition should  use "vfat"
 as fs type when using syscall.Mount().

So, in order to fix this issue, "vfat" is simply used to mount "fat",
"fat12", "fat16", "fat32" or "msdos" partitions.

Signed-off-by: Aymen Zayet <aymen.zayet@flex.ai>
  • Loading branch information
azayet01 committed May 19, 2024
1 parent 6550de9 commit 84c4e58
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion actions/image_partition_action.go
Original file line number Diff line number Diff line change
Expand Up @@ -602,7 +602,14 @@ func (i ImagePartitionAction) Run(context *debos.DebosContext) error {
dev := i.getPartitionDevice(m.part.number, *context)
mntpath := path.Join(context.ImageMntDir, m.Mountpoint)
os.MkdirAll(mntpath, 0755)
err = syscall.Mount(dev, mntpath, m.part.FS, 0, "")
fsType := m.part.FS
switch m.part.FS {
case "fat", "fat12", "fat16", "fat32", "msdos":
fsType = "vfat"
default:
break
}
err = syscall.Mount(dev, mntpath, fsType, 0, "")
if err != nil {
return fmt.Errorf("%s mount failed: %v", m.part.Name, err)
}
Expand Down

0 comments on commit 84c4e58

Please sign in to comment.